diff options
Diffstat (limited to 'Completion/Builtins')
-rw-r--r-- | Completion/Builtins/_arrays | 3 | ||||
-rw-r--r-- | Completion/Builtins/_autoload | 3 | ||||
-rw-r--r-- | Completion/Builtins/_bindkey | 6 | ||||
-rw-r--r-- | Completion/Builtins/_builtin | 3 | ||||
-rw-r--r-- | Completion/Builtins/_cd | 3 | ||||
-rw-r--r-- | Completion/Builtins/_command | 3 | ||||
-rw-r--r-- | Completion/Builtins/_compdef | 20 | ||||
-rw-r--r-- | Completion/Builtins/_echotc | 5 | ||||
-rw-r--r-- | Completion/Builtins/_functions | 3 | ||||
-rw-r--r-- | Completion/Builtins/_hash | 9 | ||||
-rw-r--r-- | Completion/Builtins/_limits | 3 | ||||
-rw-r--r-- | Completion/Builtins/_pids | 7 | ||||
-rw-r--r-- | Completion/Builtins/_popd | 5 | ||||
-rw-r--r-- | Completion/Builtins/_sched | 6 | ||||
-rw-r--r-- | Completion/Builtins/_signals | 7 | ||||
-rw-r--r-- | Completion/Builtins/_stat | 8 | ||||
-rw-r--r-- | Completion/Builtins/_vars | 6 | ||||
-rw-r--r-- | Completion/Builtins/_zftp | 29 | ||||
-rw-r--r-- | Completion/Builtins/_zle | 6 | ||||
-rw-r--r-- | Completion/Builtins/_zmodload | 8 | ||||
-rw-r--r-- | Completion/Builtins/_zpty | 6 | ||||
-rw-r--r-- | Completion/Builtins/_zstyle | 61 |
22 files changed, 100 insertions, 110 deletions
diff --git a/Completion/Builtins/_arrays b/Completion/Builtins/_arrays index 4f67ff08d..138b14091 100644 --- a/Completion/Builtins/_arrays +++ b/Completion/Builtins/_arrays @@ -2,5 +2,4 @@ local expl -_wanted arrays expl array && - compadd "$expl[@]" - "${(@k)parameters[(R)*array*]}" +_wanted arrays expl array compadd - "${(@k)parameters[(R)*array*]}" diff --git a/Completion/Builtins/_autoload b/Completion/Builtins/_autoload index de5a6045d..f1d49c3e3 100644 --- a/Completion/Builtins/_autoload +++ b/Completion/Builtins/_autoload @@ -2,5 +2,4 @@ local expl -_wanted functions expl 'shell function' && - compadd "$expl[@]" - ${^fpath}/*(N:t) +_wanted functions expl 'shell function' compadd - ${^fpath}/*(N:t) diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey index 98459916b..d96c2289b 100644 --- a/Completion/Builtins/_bindkey +++ b/Completion/Builtins/_bindkey @@ -10,9 +10,7 @@ local expl if [[ "$words[2]" = -*[DAN]* || "$words[CURRENT-1]" = -*M ]]; then - _wanted -C -M keymaps expl keymap && - compadd "$expl[@]" - "$keymaps[@]" + _wanted -C -M keymaps expl keymap compadd - "$keymaps[@]" else - _wanted widgets expl widget && - compadd "$expl[@]" -M 'r:|-=* r:|=*' - "${(@k)widgets}" + _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}" fi diff --git a/Completion/Builtins/_builtin b/Completion/Builtins/_builtin index 8d682420a..1ca5e346c 100644 --- a/Completion/Builtins/_builtin +++ b/Completion/Builtins/_builtin @@ -7,6 +7,5 @@ if (( $CURRENT > 2 )); then else local expl - _wanted commands expl 'builtin command' && - compadd "$expl[@]" "$@" - "${(k@)builtins}" + _wanted commands expl 'builtin command' compadd "$@" - "${(k@)builtins}" fi diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd index 4cb070811..bea6ffbc6 100644 --- a/Completion/Builtins/_cd +++ b/Completion/Builtins/_cd @@ -22,8 +22,7 @@ if [[ CURRENT -eq 3 ]]; then rep=(${~PWD/$words[2]/*}~$PWD(-/N)) # Now remove all the common parts of $PWD and the completions from this rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}}) - (( $#rep )) && _wanted -C replacement strings expl replacement && - compadd "$expl[@]" $rep + (( $#rep )) && _wanted -C replacement strings expl replacement compadd $rep elif _popd || [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then local tdir tdir2 diff --git a/Completion/Builtins/_command b/Completion/Builtins/_command index 1cfa6add9..6631b9b6b 100644 --- a/Completion/Builtins/_command +++ b/Completion/Builtins/_command @@ -6,6 +6,5 @@ if [[ CURRENT -ge 3 ]]; then else local expl - _wanted commands expl 'external command' && - compadd "$expl[@]" "$@" - "${(k@)commands}" + _wanted commands expl 'external command' compadd "$@" - "${(k@)commands}" fi diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef index 772c6b90d..13711e865 100644 --- a/Completion/Builtins/_compdef +++ b/Completion/Builtins/_compdef @@ -16,24 +16,24 @@ _arguments -C -s \ case $state in ccom) - _wanted commands expl 'completed command' && - compadd "$expl[@]" - ${(k)_comps} + _wanted commands expl 'completed command' compadd - ${(k)_comps} ;; cfun) - if _wanted functions expl 'completion function'; then + if _wanted functions; then list=( ${^fpath:/.}/_(|*[^~])(N:t) ) - if zstyle -T ":completion:${curcontext}" prefix-hidden; then + if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then disp=( ${list[@]#_} ) - compadd "$expl[@]" -d disp - "$list[@]" + _loop functions expl 'completion function' compadd -d disp - "$list[@]" else - compadd "$expl[@]" - "$list[@]" + _loop functions expl 'completion function' compadd - "$list[@]" fi fi ;; style) - _wanted widgetstyle expl 'widget style' && - compadd complete-word delete-char-or-list expand-or-complete \ - expand-or-complete-prefix list-choices menu-complete \ - menu-expand-or-complete reverse-menu-complete + _wanted widgetstyle expl 'widget style' \ + compadd -M 'r:|-=* r:|=*' \ + complete-word delete-char-or-list expand-or-complete \ + expand-or-complete-prefix list-choices menu-complete \ + menu-expand-or-complete reverse-menu-complete ;; esac diff --git a/Completion/Builtins/_echotc b/Completion/Builtins/_echotc index 4051c1945..cc07b9cd0 100644 --- a/Completion/Builtins/_echotc +++ b/Completion/Builtins/_echotc @@ -2,7 +2,6 @@ local expl -_wanted arguments expl 'terminal capability' && - compadd "$expl[@]" \ - al dc dl do le up al bl cd ce cl cr \ +_wanted arguments expl 'terminal capability' \ + compadd al dc dl do le up al bl cd ce cl cr \ dc dl do ho is le ma nd nl se so up diff --git a/Completion/Builtins/_functions b/Completion/Builtins/_functions index 98b21da68..de49d96ed 100644 --- a/Completion/Builtins/_functions +++ b/Completion/Builtins/_functions @@ -2,5 +2,4 @@ local expl -_wanted functions expl 'shell function' && - compadd "$expl[@]" "$@" - "${(k@)functions}" +_wanted functions expl 'shell function' compadd "$@" - "${(k@)functions}" diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash index c8a51a38a..b7e777a05 100644 --- a/Completion/Builtins/_hash +++ b/Completion/Builtins/_hash @@ -4,15 +4,14 @@ local expl if [[ "$words[2]" = -*d* ]]; then if compset -P 1 '*='; then - _wanted -C -d-value files && _path_files -g '*(-/)' + _wanted -C -d-value files expl directories _path_files -/ else - _wanted -C -d named-directories expl 'named directory' && - compadd "$expl[@]" -q -S '=' - "${(@k)nameddirs}" + _wanted -C -d named-directories expl 'named directory' \ + compadd -q -S '=' - "${(@k)nameddirs}" fi elif compset -P 1 '*='; then _wanted -C value values expl 'executable file' && _files "$expl[@]" -g '*(-*)' else - _wanted -C name commands expl command && - compadd "$expl[@]" -q -S '=' - "${(@k)commands}" + _wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}" fi diff --git a/Completion/Builtins/_limits b/Completion/Builtins/_limits index dae573e03..5dd2bffe5 100644 --- a/Completion/Builtins/_limits +++ b/Completion/Builtins/_limits @@ -2,5 +2,4 @@ local expl -_wanted limits expl 'process limits' && - compadd "$expl[@]" ${${(f)"$(limit)"}%% *} +_wanted limits expl 'process limits' compadd ${${(f)"$(limit)"}%% *} diff --git a/Completion/Builtins/_pids b/Completion/Builtins/_pids index 92fc9bac7..ff65cef31 100644 --- a/Completion/Builtins/_pids +++ b/Completion/Builtins/_pids @@ -5,7 +5,7 @@ local out list expl match desc listargs args -_wanted processes expl 'process ID' || return 1 +_wanted processes || return 1 if [[ "$1" = -m ]]; then match="${2}*" @@ -29,5 +29,6 @@ else desc=() fi -compadd "$expl[@]" "$@" "$desc[@]" - \ - ${${${(M)${(f)"${out}"}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]#*${~match}}## #}%% *} +_loop processes expl 'process ID' \ + compadd "$@" "$desc[@]" - \ + ${${${(M)${(f)"${out}"}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]#*${~match}}## #}%% *} diff --git a/Completion/Builtins/_popd b/Completion/Builtins/_popd index b79121139..ba12bb3f3 100644 --- a/Completion/Builtins/_popd +++ b/Completion/Builtins/_popd @@ -12,7 +12,7 @@ local expl list lines revlines disp ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed || [[ $PREFIX = [-+]* ]] || return 1 -_wanted -V directory-stack expl 'directory stack' || return 1 +_wanted directory-stack || return 1 if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then # get the list of directories with their canonical number @@ -39,4 +39,5 @@ else disp=() fi -compadd "$expl[@]" "$@" "$disp[@]" -Q - "$list[@]" +_loop -V directory-stack expl 'directory stack' \ + compadd "$@" "$disp[@]" -Q - "$list[@]" diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched index 783113c45..97d8830b8 100644 --- a/Completion/Builtins/_sched +++ b/Completion/Builtins/_sched @@ -4,7 +4,7 @@ local expl lines disp if [[ CURRENT -eq 2 ]]; then if compset -P -; then - _wanted -C - jobs expl 'scheduled jobs' || return 1 + _wanted -C - jobs || return 1 lines=(${(f)"$(sched)"}) if zstyle -T ":completion:${curcontext}:jobs" verbose; then @@ -12,7 +12,9 @@ if [[ CURRENT -eq 2 ]]; then else disp=() fi - [[ -z $lines ]] || compadd "$expl[@]" "$disp[@]" - {1..$#lines} + [[ -z $lines ]] || _loop jobs expl 'scheduled jobs' \ + compadd "$disp[@]" - {1..$#lines} + return else _message 'time specification' return 1 diff --git a/Completion/Builtins/_signals b/Completion/Builtins/_signals index 910502165..041b6eb6b 100644 --- a/Completion/Builtins/_signals +++ b/Completion/Builtins/_signals @@ -20,7 +20,7 @@ done [[ "$1" = -(|-) ]] && shift -if _wanted signals expl signal && +if _wanted signals && { [[ -z "$minus" ]] || ! zstyle -T ":completion:${curcontext}:signals" prefix-needed || [[ "$PREFIX" = -* ]] } ; then @@ -32,6 +32,7 @@ if _wanted signals expl signal && else disp=() fi - compadd "$@" "$expl[@]" "$disp[@]" -M 'm:{a-z}=${A-Z}' - \ - "${minus}${(@)^signals[1,last]}" + _loop signals expl signal \ + compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \ + "${minus}${(@)^signals[1,last]}" fi diff --git a/Completion/Builtins/_stat b/Completion/Builtins/_stat index c03b1590c..5f291d49b 100644 --- a/Completion/Builtins/_stat +++ b/Completion/Builtins/_stat @@ -9,10 +9,12 @@ else while _tags; do _requested files && _files && ret=0 - _requested options expl 'inode element' && + _requested options && { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX[1]" = + || ret -eq 1 ]] } && - compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \ - +size +atime +mtime +ctime +blksize +block +link + _loop options expl 'inode element' \ + compadd - +device +inode +mode +nlink +uid +gid +rdev \ + +size +atime +mtime +ctime +blksize +block +link + (( ret )) || return 0 done fi diff --git a/Completion/Builtins/_vars b/Completion/Builtins/_vars index 2758f3de2..7d8c20f52 100644 --- a/Completion/Builtins/_vars +++ b/Completion/Builtins/_vars @@ -16,9 +16,9 @@ if [[ $PREFIX = *\[* ]]; then if [[ ${(tP)var} = assoc* ]]; then local expl - _wanted -C subscript association-keys expl 'association key' && - compadd "$expl[@]" $addclose - ${(kP)var} + _wanted -C subscript association-keys expl 'association key' \ + compadd $addclose - ${(kP)var} fi else - _tags parameters && _parameters + _wanted parameters && _parameters fi diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp index 6246015ec..c0b19a796 100644 --- a/Completion/Builtins/_zftp +++ b/Completion/Builtins/_zftp @@ -13,8 +13,8 @@ local subcom expl curcontext="${curcontext}" if [[ $words[1] = zftp ]]; then if [[ $CURRENT -eq 2 ]]; then - _wanted commands expl sub-command && - compadd "$expl[@]" open params user login type ascii binary mode put \ + _wanted commands expl sub-command \ + compadd open params user login type ascii binary mode put \ putat get getat append appendat ls dir local remote mkdir rmdir \ session rmsession return @@ -28,49 +28,51 @@ fi case $subcom in *(cd|ls|dir)) # complete remote directories - _tags directories && zfcd_match $PREFIX $SUFFIX + _wanted directories && zfcd_match $PREFIX $SUFFIX ;; *(get(|at)|gcp|delete|remote)) # complete remote files - _tags files && zfget_match $PREFIX $SUFFIX + _wanted files && zfget_match $PREFIX $SUFFIX ;; *(put(|at)|pcp)) # complete local files - _tags files && _files + _wanted files && _files ;; *(open|anon|params)) # complete hosts: should do cleverer stuff with user names - _tags hosts && _hosts + _wanted hosts && _hosts ;; *(goto|mark)) # complete bookmarks. First decide if ncftp mode is go. - _wanted bookmarks expl bookmark || return 1 + _wanted bookmarks || return 1 if [[ $words[2] = -*n* ]]; then if [[ -f ~/.ncftp/bookmarks ]]; then - compadd "$expl[@]" - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks) + _loop bookmarks expl bookmark \ + compadd - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks) fi else if [[ -f ${ZFTP_BMFILE:=${ZDOTDIR:-$HOME}/.zfbkmarks} ]]; then - compadd "$expl[@]" - $(awk '{print $1}' $ZFTP_BMFILE) + _loop bookmarks expl bookmark \ + compadd - $(awk '{print $1}' $ZFTP_BMFILE) fi fi ;; *session) # complete sessions, excluding the current one. - _wanted sessions expl 'another FTP session' && - compadd "$expl[@]" - ${$(zftp session):#$ZFTP_SESSION} + _wanted sessions expl 'another FTP session' \ + compadd - ${$(zftp session):#$ZFTP_SESSION} ;; *transfer) # complete arguments like sess1:file1 sess2:file2 if [[ $PREFIX = *:* ]]; then # complete file in the given session - _tags files || return 1 + _wanted files || return 1 local sess=${PREFIX%%:*} oldsess=$ZFTP_SESSION compset -p $(( $#sess + 1 )) [[ -n $sess ]] && zftp session $sess @@ -78,8 +80,7 @@ case $subcom in [[ -n $sess && -n $oldsess ]] && zftp session $oldsess else # note here we can complete the current session - _wanted sessions expl 'FTP session' && - compadd "$expl[@]" -S : - $(zftp session) + _wanted sessions expl 'FTP session' compadd -S : - $(zftp session) fi ;; diff --git a/Completion/Builtins/_zle b/Completion/Builtins/_zle index 8e8017817..46765bc5e 100644 --- a/Completion/Builtins/_zle +++ b/Completion/Builtins/_zle @@ -3,8 +3,8 @@ local expl if [[ "$words[2]" = -N && CURRENT -eq 3 ]]; then - _wanted -C -N functions expl 'widget shell function' && - compadd "$expl[@]" "$@" - "${(k@)functions}" && ret=0 + _wanted -C -N functions expl 'widget shell function' \ + compadd "$@" - "${(k@)functions}" else - _wanted widgets expl widget && compadd "$expl[@]" - "${(@k)widgets}" + _wanted widgets expl widget compadd - "${(@k)widgets}" fi diff --git a/Completion/Builtins/_zmodload b/Completion/Builtins/_zmodload index c167df445..7e893c860 100644 --- a/Completion/Builtins/_zmodload +++ b/Completion/Builtins/_zmodload @@ -3,11 +3,9 @@ local fl="$words[2]" expl if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then - _wanted builtins expl 'builtin command' && - compadd "$expl[@]" "$@" - "${(k@)builtins}" + _wanted builtins expl 'builtin command' compadd "$@" - "${(k@)builtins}" elif [[ "$fl" = -*u* ]]; then - _wanted modules expl module && compadd "$expl[@]" - "${(@k)modules}" + _wanted modules expl module compadd - "${(@k)modules}" else - _wanted files expl 'module file' && - _files "$expl[@]" -W module_path -/g '*.s[ol](:r)' + _wanted files expl 'module file' _files -W module_path -/g '*.s[ol](:r)' fi diff --git a/Completion/Builtins/_zpty b/Completion/Builtins/_zpty index b197b4128..4090bde69 100644 --- a/Completion/Builtins/_zpty +++ b/Completion/Builtins/_zpty @@ -11,13 +11,13 @@ _arguments -C -s \ '(-e -b -d -w -r)-L[list defined commands as calls]' \ '*::args:_normal' -if [[ $state = name ]] && _wanted zptynames expl 'zpty command names'; then +if [[ $state = name ]] && _wanted names; then list=( ${${(f)"$(zpty)"}#*\) } ) names=( ${list%%:*} ) if zstyle -T ":completion:${curcontext}" verbose; then zformat -a list ' --' ${${(f)"$(zpty)"}#*\) } - compadd "$expl[@]" -d list - "$names[@]" + _loop names expl 'zpty command names' compadd -d list - "$names[@]" else - compadd "$expl[@]" - "$names[@]" + _loop names expl 'zpty command names' compadd - "$names[@]" fi fi diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 328e2d7d2..6cb369cfd 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -41,7 +41,6 @@ styles=( list-packed c:bool list-rows-first c:bool local c: - matcher c: matcher-list c: max-errors c: menu c:boolauto @@ -94,9 +93,9 @@ while [[ -n $state ]]; do case "$ostate" in contexts) - if _wanted contexts expl context; then + if _wanted contexts; then if [[ $PREFIX != :*: ]]; then - compadd -P : -S : "$expl[@]" completion zftp + _loop contexts expl context compadd -P : -S : completion zftp elif [[ $PREFIX = :completion:* ]]; then mesg='' case "$PREFIX" in @@ -118,8 +117,8 @@ while [[ -n $state ]]; do else ctop=cz fi - _wanted styles expl style && - compadd "$expl[@]" -M 'r:|-=* r:|=*' - ${(k)styles[(R)[^:]#[$ctop][^:]#:*]} + _wanted styles expl style \ + compadd -M 'r:|-=* r:|=*' - ${(k)styles[(R)[^:]#[$ctop][^:]#:*]} ;; style-arg) @@ -127,32 +126,28 @@ while [[ -n $state ]]; do ;; bool) - _wanted values expl boolean && - compadd "$expl[@]" true false + _wanted values expl boolean compadd true false ;; boolauto) - _wanted values expl boolean && - compadd "$expl[@]" true false auto select + _wanted values expl boolean compadd true false auto select ;; cursor) if [[ "$words[2]" = *:completion:inc* ]]; then - _wanted values expl 'cursor positioning' && - compadd "$expl[@]" complete key default + _wanted values expl 'cursor positioning' compadd complete key default elif [[ "$words[2]" = *:completion::* ]]; then - _wanted values expl 'cursor positioning' && - compadd "$expl[@]" true false + _wanted values expl 'cursor positioning' compadd true false else - _wanted values expl 'cursor positioning' && - compadd "$expl[@]" complete key default true false + _wanted values expl 'cursor positioning' \ + compadd complete key default true false fi ;; completer) - _wanted values expl completer && - compadd "$expl[@]" _complete _approximate _correct _match \ - _expand _list _menu _oldlist + _wanted values expl completer \ + compadd _complete _approximate _correct _match \ + _expand _list _menu _oldlist _next_tags ;; user-host-port) @@ -177,32 +172,32 @@ while [[ -n $state ]]; do ;; listwhen) - _wanted values expl 'when to list completions' && - compadd "$expl[@]" always never sometimes + _wanted values expl 'when to list completions' \ + compadd always never sometimes ;; packageset) - _wanted values expl 'default package set' && - compadd "$expl[@]" available installed uninstalled + _wanted values expl 'default package set' \ + compadd available installed uninstalled ;; progress) - _wanted values expl 'progress meter style' && - compadd "$expl[@]" none bar percent + _wanted values expl 'progress meter style' \ + compadd none bar percent ;; sdirs) - _wanted values expl 'whether to complete . or ..' && - compadd "$expl[@]" true false .. + _wanted values expl 'whether to complete . or ..' \ + compadd true false .. ;; stop) - _wanted values expl 'when to insert matches' && - compadd "$expl[@]" true false verbose + _wanted values expl 'when to insert matches' \ + compadd true false verbose ;; tag) - _wanted tags expl tag && compadd "$expl[@]" - $taglist + _wanted tags expl tag compadd - $taglist ;; user-host) @@ -215,13 +210,13 @@ while [[ -n $state ]]; do ;; ignorepar) - _wanted values expl 'which parents to ignore' && - compadd "$expl[@]" parent pwd .. directory + _wanted values expl 'which parents to ignore' \ + compadd parent pwd .. directory ;; single-ignored) - _wanted values expl 'how to handle single alternate match' && - compadd "$expl[@]" - show menu + _wanted values expl 'how to handle single alternate match' \ + compadd - show menu ;; _*) |