-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
70 lines (62 loc) · 1.5 KB
/
zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
zmodload zsh/zprof
if [ -e "${HOME}/.zplug/init.zsh" ]; then
source ~/.zplug/init.zsh
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
if [ -f "${HOME}/.zplugins" ]; then
source "${HOME}/.zplugins"
fi
if ! zplug check; then
printf "Install missing zplug plugins? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
zplug load
else
printf 'WARNING! %s\n' "Could not find \`~/.zplug/init.zsh'. No zplug plugins will be active" 1>&2
fi
# load custom executable functions
fpath=(
"${HOME}/.zsh/functions"
$fpath
)
for function in ~/.zsh/functions/*; do
func="$(basename -- "$function")"
autoload -Uz "$func"
done
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
local _dir="$1"
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*(N-.); do
source $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/pre/*)
:
;;
"$_dir"/post/*)
:
;;
*)
if [ -f $config ]; then
source $config
fi
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*(N-.); do
source $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local || true
unset -f _load_settings