forked from zplug/zplug
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.zsh
49 lines (44 loc) · 1015 Bytes
/
init.zsh
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
__zplug::base()
{
local load_file arg
local -aU load_files
while (( $# > 0 ))
do
arg="$1"
case "$arg" in
-*|--*)
return 1
;;
*/'*')
# e.g. 'base/*'
load_files+=( "$ZPLUG_ROOT/base/${arg:h}"/*.zsh(N-.) )
;;
*/*)
# e.g. 'core/add'
load_files+=( "$ZPLUG_ROOT/base/${arg}.zsh"(N-.) )
;;
*)
return 1
;;
esac
shift
done
# invalid format
if (( $#load_files == 0 )); then
return 1
fi
fpath=(
"${load_files[@]:h}"
"${fpath[@]}"
)
for load_file in "${load_files[@]}"
do
if (( $+functions[$load_file] )); then
# already defined
continue
fi
autoload -Uz "${load_file:t}" &&
eval "${load_file:t}" &&
unfunction "${load_file:t}"
done
}