diff options
Diffstat (limited to 'Completion/Builtins')
-rw-r--r-- | Completion/Builtins/_aliases | 8 | ||||
-rw-r--r-- | Completion/Builtins/_bindkey | 4 | ||||
-rw-r--r-- | Completion/Builtins/_builtin | 12 | ||||
-rw-r--r-- | Completion/Builtins/_cd | 2 | ||||
-rw-r--r-- | Completion/Builtins/_command | 11 | ||||
-rw-r--r-- | Completion/Builtins/_compdef | 6 | ||||
-rw-r--r-- | Completion/Builtins/_functions | 6 | ||||
-rw-r--r-- | Completion/Builtins/_hash | 4 | ||||
-rw-r--r-- | Completion/Builtins/_popd | 2 | ||||
-rw-r--r-- | Completion/Builtins/_unhash | 4 | ||||
-rw-r--r-- | Completion/Builtins/_vars | 2 | ||||
-rw-r--r-- | Completion/Builtins/_which | 10 | ||||
-rw-r--r-- | Completion/Builtins/_zcompile | 2 | ||||
-rw-r--r-- | Completion/Builtins/_zle | 11 | ||||
-rw-r--r-- | Completion/Builtins/_zmodload | 14 | ||||
-rw-r--r-- | Completion/Builtins/_zpty | 4 | ||||
-rw-r--r-- | Completion/Builtins/_zstyle | 4 |
17 files changed, 62 insertions, 44 deletions
diff --git a/Completion/Builtins/_aliases b/Completion/Builtins/_aliases index 1038a726e..07e5dc5cb 100644 --- a/Completion/Builtins/_aliases +++ b/Completion/Builtins/_aliases @@ -1,3 +1,7 @@ -#defcomp unalias +#compdef alias unalias -complist -a +local expl + +_alternative \ + 'aliases:regular alias:compadd -k aliases' \ + 'global-aliases:global alias:compadd -k galiases' diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey index cca4f7e64..048d517f2 100644 --- a/Completion/Builtins/_bindkey +++ b/Completion/Builtins/_bindkey @@ -29,9 +29,9 @@ _arguments -C -s \ case $state in keymap) - _wanted -C -M keymaps expl keymap compadd - "$keymaps[@]" + _wanted -C -M keymaps expl keymap compadd -a keymaps ;; widget) - _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}" + _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets ;; esac diff --git a/Completion/Builtins/_builtin b/Completion/Builtins/_builtin index a967932ee..9fb6acf7b 100644 --- a/Completion/Builtins/_builtin +++ b/Completion/Builtins/_builtin @@ -1,7 +1,11 @@ -#defcomp builtin +#compdef builtin -if [[ -position 2 -1 ]]; then - _normal "$@" +if (( $CURRENT > 2 )); then + shift words + (( CURRENT -- )) + _normal else - complist -eB + local expl + + _wanted commands expl 'builtin command' compadd "$@" -k builtins fi diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd index 803bcbda5..634a62c66 100644 --- a/Completion/Builtins/_cd +++ b/Completion/Builtins/_cd @@ -22,7 +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 $rep + (( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep elif _popd || [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then local tdir tdir2 diff --git a/Completion/Builtins/_command b/Completion/Builtins/_command index b2812de25..b90ec933e 100644 --- a/Completion/Builtins/_command +++ b/Completion/Builtins/_command @@ -1,7 +1,10 @@ -#defcomp command +#compdef command -if [[ -position 2 -1 ]]; then - _normal "$@" +if [[ CURRENT -ge 3 ]]; then + compset -n 2 + _normal else - complist -em + local expl + + _wanted commands expl 'external command' compadd "$@" -k commands fi diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef index 23c6d3a3d..636004af2 100644 --- a/Completion/Builtins/_compdef +++ b/Completion/Builtins/_compdef @@ -30,16 +30,16 @@ fi case $state in ccom) - _wanted commands expl 'completed command' compadd - ${(k)_comps} + _wanted commands expl 'completed command' compadd -k _comps ;; cfun) list=( ${^fpath:/.}/_(|*[^~])(N:t) ) if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then disp=( ${list[@]#_} ) _wanted functions expl 'completion function' \ - compadd -d disp - "$list[@]" + compadd -d disp -a list else - _wanted functions expl 'completion function' compadd - "$list[@]" + _wanted functions expl 'completion function' compadd -a list fi ;; style) diff --git a/Completion/Builtins/_functions b/Completion/Builtins/_functions index 8a352ea08..5a4ecfe59 100644 --- a/Completion/Builtins/_functions +++ b/Completion/Builtins/_functions @@ -1,3 +1,5 @@ -#defcomp unfunction +#compdef functions unfunction -complist -F +local expl + +_wanted functions expl 'shell function' compadd "$@" -k functions diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash index de8c1887c..250e119b9 100644 --- a/Completion/Builtins/_hash +++ b/Completion/Builtins/_hash @@ -28,11 +28,11 @@ if [[ $state = hashval ]]; then _wanted -C value files expl directories _path_files -/ else _wanted -C name named-directories expl 'named directory' \ - compadd -q -S '=' - "${(@k)nameddirs}" + compadd -q -S '=' -k nameddirs fi elif compset -P 1 '*='; then _wanted -C value values expl 'executable file' _files -g '*(-*)' else - _wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}" + _wanted -C name commands expl command compadd -q -S '=' -k commands fi fi diff --git a/Completion/Builtins/_popd b/Completion/Builtins/_popd index 19b773173..ff9ede12e 100644 --- a/Completion/Builtins/_popd +++ b/Completion/Builtins/_popd @@ -38,4 +38,4 @@ else fi _wanted -V directory-stack expl 'directory stack' \ - compadd "$@" "$disp[@]" -Q - "$list[@]" + compadd "$@" "$disp[@]" -Q -a list diff --git a/Completion/Builtins/_unhash b/Completion/Builtins/_unhash index b99c00ad3..a8f366180 100644 --- a/Completion/Builtins/_unhash +++ b/Completion/Builtins/_unhash @@ -7,8 +7,8 @@ _arguments -C -s \ '(-d -f *)-a[remove aliases]:*:aliases:_aliases' \ '(-d -a *)-f[remove functions]:*:functions:_functions' \ '-m[treat arguments as patterns]' \ - '*:commands:_command_names -e' && return 0 + '*:commands: _command_names -e' && return 0 if [[ "$state" = nameddir ]]; then - _wanted nameddir expl 'named directory' compadd - ${(@k)nameddirs} + _wanted nameddir expl 'named directory' compadd -k nameddirs fi diff --git a/Completion/Builtins/_vars b/Completion/Builtins/_vars index 711a0a1f2..6444c68fe 100644 --- a/Completion/Builtins/_vars +++ b/Completion/Builtins/_vars @@ -17,7 +17,7 @@ if [[ $PREFIX = *\[* ]]; then local expl _wanted -C subscript association-keys expl 'association key' \ - compadd $addclose - ${(kP)var} + compadd $addclose -k "$var" fi else _parameters diff --git a/Completion/Builtins/_which b/Completion/Builtins/_which index 3dc785f0f..aceec85a0 100644 --- a/Completion/Builtins/_which +++ b/Completion/Builtins/_which @@ -28,10 +28,10 @@ if [[ "$state" = command ]]; then args=( "$@" ) _alternative -O args \ - 'commands:external command:compadd - ${(k@)commands}' \ - 'builtins:builtin command:compadd - ${(k@)builtins}' \ - 'functions:shell function:compadd - ${(k@)functions}' \ - 'aliases:alias:compadd - ${(k@)aliases}' \ - 'reserved-words:reserved word:compadd - ${(k@)reswords}' + 'commands:external command:compadd -k commands' \ + 'builtins:builtin command:compadd -k builtins' \ + 'functions:shell function:compadd -k functions' \ + 'aliases:alias:compadd -k aliases' \ + 'reserved-words:reserved word:compadd -k reswords' fi diff --git a/Completion/Builtins/_zcompile b/Completion/Builtins/_zcompile index b4428e019..e9b9c60eb 100644 --- a/Completion/Builtins/_zcompile +++ b/Completion/Builtins/_zcompile @@ -17,7 +17,7 @@ _arguments -C -s \ '*:function:->function' && return 0 if (( $+opt_args[-c] )); then - _wanted functions expl 'function to write' compadd - ${(k)functions} + _wanted functions expl 'function to write' compadd -k functions else _description files expl 'zsh source file' _files "$expl[@]" diff --git a/Completion/Builtins/_zle b/Completion/Builtins/_zle index bb1102e74..e390382d4 100644 --- a/Completion/Builtins/_zle +++ b/Completion/Builtins/_zle @@ -1,7 +1,10 @@ -#defcomp zle +#compdef zle -if [[ -word 1 -N && -position 3 ]]; then - complist -F +local expl + +if [[ "$words[2]" = -N && CURRENT -eq 3 ]]; then + _wanted -C -N functions expl 'widget shell function' \ + compadd "$@" -k functions else - complist -b + _wanted widgets expl widget compadd -k widgets fi diff --git a/Completion/Builtins/_zmodload b/Completion/Builtins/_zmodload index 112acb57c..5ca167152 100644 --- a/Completion/Builtins/_zmodload +++ b/Completion/Builtins/_zmodload @@ -1,9 +1,11 @@ -#defcomp zmodload +#compdef zmodload -if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then - complist -B -elif [[ -mword 1 -*u* ]]; then - complist -s '$(zmodload)' +local fl="$words[2]" expl + +if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then + _wanted builtins expl 'builtin command' compadd "$@" -k builtins +elif [[ "$fl" = -*u* ]]; then + _wanted modules expl module compadd -k modules else - complist -s '${^module_path}/*(N:t: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 dd551ab97..f1de3d11d 100644 --- a/Completion/Builtins/_zpty +++ b/Completion/Builtins/_zpty @@ -49,9 +49,9 @@ if [[ $state = name ]]; then names=( ${list%%:*} ) if zstyle -T ":completion:${curcontext}" verbose; then zformat -a list ' --' ${${(f)"$(zpty)"}#*\) } - _wanted names expl 'zpty command name' compadd -d list - "$names[@]" + _wanted names expl 'zpty command name' compadd -d list -a names else - _wanted names expl 'zpty command name' compadd - "$names[@]" + _wanted names expl 'zpty command name' compadd -a names fi else return 1 diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 5ce45c795..db86829ec 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -151,7 +151,7 @@ while [[ -n $state ]]; do completer) _wanted values expl completer \ compadd _complete _approximate _correct _match \ - _expand _list _menu _oldlist _next_tags + _expand _list _menu _oldlist _ignored _prefix _history ;; fsort) @@ -212,7 +212,7 @@ while [[ -n $state ]]; do elif compset -P '*:'; then _message 'tag alias' else - _wanted tags expl tag compadd - $taglist + _wanted tags expl tag compadd -a taglist fi ;; |