-
Notifications
You must be signed in to change notification settings - Fork 7
/
_zinit_recache
53 lines (46 loc) · 1.46 KB
/
_zinit_recache
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
# Copyright 2021-2023 Nicholas Serrano
# License: MIT
# Zinit recache subcommand tab completion
typeset -a commands
commands=(recache:'Regenerate eval cache')
_arguments -C \
'1: :->command'\
'*: :->argument' && ret=0
case $state in
command)
_describe -t commands "z-a-eval subcommand" commands && ret=0
;;
argument)
case $words[2] in
recache)
# Plugins
typeset -a plugins
plugins=( "${ZINIT[PLUGINS_DIR]}"/**/evalcache.zsh(N:h:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zinit}" )
plugins=( "${plugins[@]:#custom}" )
# Snippets
local -a snippets snippets_alreadyld
local sni
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/evalcache.zsh(N:h) )
snippets=( ${snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
snippets=( ${snippets[@]/--//} )
for sni ( ${snippets[@]} ) {
if [[ -n ${ZINIT_SNIPPETS[$sni]} ]]; then
snippets_alreadyld+=( $sni )
snippets=( ${snippets[@]:#$sni} )
fi
}
_alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \
'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \
'plugins:-- Plugin --:compadd -a - plugins' && \
ret=0
ret=1
;;
*)
ret=1
;;
esac
esac
return $ret