Skip to content

Commit a1e8144

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 a1e8144

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-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

+21-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,18 @@ do
2831
source $file
2932
done
3033

31-
# initialize autocomplete here, otherwise functions won't be loaded
32-
autoload -U compinit
33-
compinit
34+
# You can install Oh My Zsh into ~/.oh-my-zsh, out of dotfiles directory tree;
35+
# you should move its configuration file {.zshrc => $DOTFILES/zsh/oh-my-zshrc}.
36+
if [[ -f $DOTFILES/zsh/oh-my-zshrc ]]; then
37+
() {
38+
local ZSH=""
39+
source $DOTFILES/zsh/oh-my-zshrc
40+
}
41+
else
42+
# initialize autocomplete here, otherwise functions won't be loaded
43+
autoload -U compinit
44+
compinit
45+
fi
3446

3547
# load every completion after autocomplete loads
3648
for file in ${(M)config_files:#*/completion.zsh}
@@ -39,3 +51,6 @@ do
3951
done
4052

4153
unset config_files
54+
55+
# Notify existing users that they should migrate to $DOTFILES variable.
56+
export ZSH='$ZSH variable is deprecated, use $DOTFILES instead'

0 commit comments

Comments
 (0)