Skip to content

Commit fc8b21a

Browse files
committed
Allow for Oh My Zsh integration.
Start replacing $ZSH variable with $DOTFILES in a backward-compatible way, so that existing users have a chance to migrate.
1 parent 0628581 commit fc8b21a

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

git/gitconfig.symlink

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
protocol = https
66
[alias]
77
co = checkout
8-
promote = !$ZSH/bin/git-promote
9-
wtf = !$ZSH/bin/git-wtf
10-
rank-contributors = !$ZSH/bin/git-rank-contributors
8+
promote = !$DOTFILES/bin/git-promote
9+
wtf = !$DOTFILES/bin/git-wtf
10+
rank-contributors = !$DOTFILES/bin/git-rank-contributors
1111
count = !git shortlog -sn
1212
[color]
1313
diff = auto

zsh/prompt.zsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ directory_name() {
5555
}
5656

5757
battery_status() {
58-
$ZSH/bin/battery-status
58+
$DOTFILES/bin/battery-status
5959
}
6060

6161
export PROMPT=$'\n$(battery_status)in $(directory_name) $(git_dirty)$(need_push)\n'

zsh/zshrc.symlink

+23-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# shortcut to this dotfiles path is $ZSH
2-
export ZSH=$HOME/.dotfiles
1+
# shortcut to this dotfiles path is $DOTFILES
2+
export DOTFILES=$HOME/.dotfiles
3+
4+
# $ZSH variable is deprecated, use $DOTFILES instead
5+
export ZSH="$DOTFILES"
36

47
# your project folder that we can `c [tab]` to
58
export PROJECTS=~/Code
@@ -14,7 +17,7 @@ fi
1417

1518
# all of our zsh files
1619
typeset -U config_files
17-
config_files=($ZSH/**/*.zsh)
20+
config_files=($DOTFILES/**/*.zsh)
1821

1922
# load the path files
2023
for file in ${(M)config_files:#*/path.zsh}
@@ -28,9 +31,20 @@ do
2831
source $file
2932
done
3033

31-
# initialize autocomplete here, otherwise functions won't be loaded
32-
autoload -U compinit
33-
compinit
34+
# Oh My Zsh could be installed somewhere out of dotfiles directory tree, e.g.
35+
# into ~/.oh-my-zsh; the configuration file created by Oh My Zsh installer
36+
# should be moved as follows: {.zshrc => $DOTFILES/zsh/oh-my-zshrc}.
37+
if [[ -f $DOTFILES/zsh/oh-my-zshrc ]]; then
38+
() {
39+
local ZSH="$HOME/.oh-my-zsh"
40+
source $DOTFILES/zsh/oh-my-zshrc
41+
export OHMYZSH="$ZSH"
42+
}
43+
else
44+
# initialize autocomplete here, otherwise functions won't be loaded
45+
autoload -U compinit
46+
compinit
47+
fi
3448

3549
# load every completion after autocomplete loads
3650
for file in ${(M)config_files:#*/completion.zsh}
@@ -39,3 +53,6 @@ do
3953
done
4054

4155
unset config_files
56+
57+
# Notify existing users that they should migrate to another variable.
58+
export ZSH='$ZSH is deprecated, use either $DOTFILES or $OHMYZSH instead.'

0 commit comments

Comments
 (0)