44# https://github.com/mattmc3/antidote
55# license: https://unlicense.org
66# usage: plugin-load $myplugins
7- # version: 0.0.1
7+ # version: 0.0.2
88
99# Set variables.
1010: ${ANTIDOTE_LITE_HOME:= ${XDG_CACHE_HOME:- ~/ .cache} / antidote.lite}
@@ -14,7 +14,16 @@ typeset -gHa _alite_zopts=(extended_glob glob_dots no_monitor)
1414function plugin-clone {
1515 emulate -L zsh; setopt local_options $_alite_zopts
1616 local repo plugdir initfile initfiles=()
17- for repo in ${(u)@ } ; do
17+
18+ # Remove bare words ${(M)@:#*/*} and paths with leading slash ${@:#/*}.
19+ # Then split/join to keep the 2-part user/repo form to bulk-clone repos.
20+ local -Ua repos
21+ for repo in ${${(M)@:#*/* } :#/* } ; do
22+ repo=${(@ j:/: )${(@ s:/: )repo} [1,2]}
23+ [[ -e $ANTIDOTE_LITE_HOME /$repo ]] || repos+=$repo
24+ done
25+
26+ for repo in $repos ; do
1827 plugdir=$ANTIDOTE_LITE_HOME /$repo
1928 initfile=$plugdir /${repo: t} .plugin.zsh
2029 if [[ ! -d $plugdir ]]; then
@@ -40,16 +49,6 @@ function plugin-clone {
4049
4150# #? Load zsh plugins.
4251function plugin-load {
43- # Remove bare words ${(M)@:#*/*} and paths with leading slash ${@:#/*}.
44- # Then split/join to keep the 2-part user/repo form to bulk-clone repos.
45- local repo; local -Ua repos
46- for repo in ${${(M)@:#*/* } :#/* } ; do
47- repo=${(@ j:/: )${(@ s:/: )repo} [1,2]}
48- [[ -e $ANTIDOTE_LITE_HOME /$repo ]] || repos+=$repo
49- done
50- (( $# repos )) && plugin-clone $repos >&2
51-
52- # script plugins
5352 source <( plugin-script $@ )
5453}
5554
0 commit comments