diff options
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r-- | Completion/Zsh/Command/_bindkey | 2 | ||||
-rw-r--r-- | Completion/Zsh/Command/_compadd | 121 | ||||
-rw-r--r-- | Completion/Zsh/Command/_disable | 10 | ||||
-rw-r--r-- | Completion/Zsh/Command/_enable | 10 | ||||
-rw-r--r-- | Completion/Zsh/Command/_fc | 3 | ||||
-rw-r--r-- | Completion/Zsh/Command/_sched | 2 | ||||
-rw-r--r-- | Completion/Zsh/Command/_strftime | 12 | ||||
-rw-r--r-- | Completion/Zsh/Command/_typeset | 35 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zed | 16 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zle | 8 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zmodload | 4 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zstyle | 34 |
12 files changed, 162 insertions, 95 deletions
diff --git a/Completion/Zsh/Command/_bindkey b/Completion/Zsh/Command/_bindkey index 81ae69974..df9c8f225 100644 --- a/Completion/Zsh/Command/_bindkey +++ b/Completion/Zsh/Command/_bindkey @@ -27,7 +27,7 @@ _arguments -C -s -S \ '(-l -L -d -D -A -N -m -p -r *)-s[bind each in-string to each out-string]:*:key string' \ '(-e -v -a -M -l -L -d -D -A -N -m -p)-R[interpret in-strings as ranges]' \ '(-l -L -d -A -N -m -p -r -s):in-string' \ - '(-l -L -d -A -N -m -p -r -s)*::widgets:_widgets' && ret=0 + '(-l -L -d -A -N -m -p -r -s)*::widget:_widgets' && ret=0 case $state in keymap) diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd index 781fa2af8..4456cf71e 100644 --- a/Completion/Zsh/Command/_compadd +++ b/Completion/Zsh/Command/_compadd @@ -1,47 +1,94 @@ -#compdef compadd +#compdef compadd -P _* -local curcontext="$curcontext" state line ret=1 +local curcontext="$curcontext" ret=1 +local -a state line args typeset -A opt_args -_arguments -C -s -S -A "-*" \ - '-P+[specify prefix]:prefix' \ - '-S+[specify suffix]:suffix' \ - '-p+[specify hidden prefix]:hidden prefix' \ - '-s+[specify hidden suffix]:hidden suffix' \ - '-i+[specify ignored prefix]:ignored prefix' \ - '-I+[specify ignored suffix]:ignored suffix' \ - '(-k)-a[matches are elements of specified arrays]' \ - '(-a)-k[matches are keys of specified associative arrays]' \ - '-d+[specify display strings]:array:_parameters -g "*array*"' \ - '-l[list display strings one per line, not in columns]' \ +args=( + '-P+[specify prefix]:prefix' + '-S+[specify suffix]:suffix' + '-p+[specify hidden prefix]:hidden prefix' + '-s+[specify hidden suffix]:hidden suffix' + '-i+[specify ignored prefix]:ignored prefix' + '-I+[specify ignored suffix]:ignored suffix' '-o[specify order for matches by match string not by display string]:: : _values -s , order "match[order by match not by display string]" "nosort[matches are pre-ordered]" "numeric[order numerically]" - "reverse[order backwards]"' \ - '(-1 -E)-J+[specify match group]:group' \ - '!-V+:group' \ - '(-J -E)-1[remove only consecutive duplicates from group]' \ - '-2[preserve all duplicates]' \ - '(-x)-X[specify explanation]:explanation' \ - '(-X)-x[specify unconditional explanation]:explanation' \ - '-q[make suffix autoremovable]' \ - '-r+[specify character class for suffix autoremoval]:character class' \ - '-R+[specify function for suffix autoremoval]:function:_functions' \ - '-f[mark matches as being files]' \ - '-e[mark matches as being parameters]' \ - '-W[specify location for matches marked as files]' \ - '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' \ - '-Q[disable quoting of possible completions]' \ - '*-M[specify matching specifications]' \ - '-n[hide matches in completion listing]' \ - '-U[disable internal matching of completion candidates]' \ - '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' \ - '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' \ - '-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' \ - '-C[add special match that expands to all other matches]' \ - '(-1 -J)-E+[add specified number of display only matches]:number' \ - '*:candidate:->candidates' && ret=0 + "reverse[order backwards]"' + '(-1 -E)-J+[specify match group]:group' + '!-V+:group' + '(-J -E)-1[remove only consecutive duplicates from group]' + '-2[preserve all duplicates]' + '(-x)-X[specify explanation]:explanation' + '(-X)-x[specify unconditional explanation]:explanation' + '-q[make suffix autoremovable]' + '-r+[specify character class for suffix autoremoval]:character class' + '-R+[specify function for suffix autoremoval]:function:_functions' + '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' + '-Q[disable quoting of possible completions]' + '*-M[specify matching specifications]' + '-n[hide matches in completion listing]' + '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' + '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' + '*-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' +) + +case $service in + compadd|_(path_|)files) + args+=( + '-W[specify location for matches marked as files]' + ) + ;| + compadd) + args+=( + '(-k)-a[matches are elements of specified arrays]' + '(-a)-k[matches are keys of specified associative arrays]' + '-d+[specify display strings]:array:_parameters -g "*array*"' + '-l[list display strings one per line, not in columns]' + '-f[mark matches as being files]' + '-e[mark matches as being parameters]' + '-C[add special match that expands to all other matches]' + '(-1 -J)-E+[add specified number of display only matches]:number' + '-U[disable internal matching of completion candidates]' + '*:candidate:->candidates' + ) + ;; + _dates) + args=( ${args:#([(][^)]##\)|)-[12noOAD]*} + '-f[specify format for matches]:format:_date_formats' + '-F[select a future rather than past date]' + ) + ;; + _(path_|)files) + args=( ${args:#([(][^)]##\)|)-[OAD]*} + '-g+[specify file glob pattern]:glob pattern' + '-/[complete only directories]' + ) + ;; + _parameters) + args+=( + '-g+[specify pattern to filter parameter type by]:pattern' + ) + ;; + _pids) + args+=( '-m+[pattern to filter process command line by]:pattern' ) + ;; + _process_names) + args+=( + '-a[include all processes]' + '-t[use truncated process names]' + ) + ;; + _sys_calls) + args+=( + '-a[add "all" as an additional match]' + '-n[add "none" as an additional match]' + ) + ;; +esac + +_arguments -C -s -S -A "-*" $args && ret=0 if [[ -n $state ]]; then if (( $+opt_args[-a] )); then diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable index 52b82a6e9..da3803039 100644 --- a/Completion/Zsh/Command/_disable +++ b/Completion/Zsh/Command/_disable @@ -7,10 +7,10 @@ sali_arr=(${(k)saliases}) func_arr=(${(k)functions}) _arguments -C -s -A "-*" -S \ - "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \ - "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \ - "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \ - "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \ - "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \ + "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global alias:compadd -k ali_arr" \ + "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \ + "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k reswords" \ + "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \ + "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k patchars" \ '-m[treat arguments as patterns]' \ "*:builtin command:(${(k)builtins})" diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable index 9410651b7..b62619d89 100644 --- a/Completion/Zsh/Command/_enable +++ b/Completion/Zsh/Command/_enable @@ -7,10 +7,10 @@ sali_arr=(${(k)dis_saliases}) func_arr=(${(k)dis_functions}) _arguments -C -s -A "-*" -S \ - "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \ - "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \ - "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \ - "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \ - "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \ + "(-f -r -s -p)-a[act on regular or global aliases]:*:alias:compadd -k ali_arr" \ + "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \ + "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k dis_reswords" \ + "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \ + "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k dis_patchars" \ '-m[treat arguments as patterns]' \ "*:builtin command:(${(k)dis_builtins})" diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index dd014e7d7..80e570c5d 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -59,7 +59,8 @@ case $service in ;; *) _arguments "$fc_common[@]" "$fc_hist[@]" "$fc_r" \ - '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -s)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -e)-s[re-execute command without invoking editor (like -e-)]' \ '(-a -l -L -m -e -r -n -d -f -t -E -i -R -D -A -W -p -P *)-'{\ 'R[read history from file]',\ 'A[append history to file]',\ diff --git a/Completion/Zsh/Command/_sched b/Completion/Zsh/Command/_sched index e8ff5ab87..888708684 100644 --- a/Completion/Zsh/Command/_sched +++ b/Completion/Zsh/Command/_sched @@ -10,7 +10,7 @@ if [[ CURRENT -eq 2 ]]; then else disp=() fi - [[ -z $lines ]] || _wanted jobs expl 'scheduled jobs' \ + [[ -z $lines ]] || _wanted jobs expl 'scheduled job' \ compadd "$disp[@]" - {1..$#lines} return else diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime index 0849f1c85..a57a76ce4 100644 --- a/Completion/Zsh/Command/_strftime +++ b/Completion/Zsh/Command/_strftime @@ -1,14 +1,16 @@ #compdef strftime -local ret=1 expl +local expl two='epoch time' + +if (( words[(I)-r] )); then + two='date string' +fi _arguments -S -A '-*' -s \ + '-n[omit trailing newline]' \ '-q[run quietly]' \ '(3)-r[reverse lookup using strptime]' \ '-s+[assign result to parameter]:param:_parameters' \ '1:format: _date_formats zsh' \ - '2:epoch time (or date string with -r)' \ + "2:$two" \ '3:nanoseconds' \ -&& ret=0 - -return ret diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset index ae33ae539..058842378 100644 --- a/Completion/Zsh/Command/_typeset +++ b/Completion/Zsh/Command/_typeset @@ -1,6 +1,6 @@ #compdef autoload declare export functions integer float local readonly typeset -local expl state line func i use curcontext="$curcontext" +local expl state state_descr line func i use curcontext="$curcontext" ret=1 local fopts="-f -k -z +k +z" local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x" local -A allargs opt_args @@ -69,8 +69,8 @@ case ${service} in allargs[i]='-i+[specify arithmetic base for output]:: :_guard "[0-9]#" base' \ ;; readonly) use="${use/r/}" ;; - local) use="${use/[fkz]/}" ;& - export) use="${${use//[gkz]/}/x/}" ;; + local) use="${use//[fgkz]/}" ;; + export) use="${use//[fgkxz]/}" ;; esac [[ -z "${words[(r)-*[aA]*]}" ]] || func=p @@ -79,38 +79,38 @@ esac # This function uses whacky features of _arguments which means we # need to look for options to the command beforehand. local onopts offopts -onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}} +onopts=${(j..)${${words[1,CURRENT-1]:#^-[^-]*}##-}} offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}} for ((i=1;i<=$#use;++i)); do args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} ) done -_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' +_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' && ret=0 if [[ "$state" = vars_eq ]]; then if [[ $func = f ]]; then if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); then _wanted functions expl 'math function' compadd -F line - \ - ${${${(f)"$(functions -M)"}##*-M }%% *} + ${${${(f)"$(functions -M)"}##*-M }%% *} && ret=0 elif (( $+opt_args[-M] )); then _arguments ':new math function:_functions' \ ":minimum arguments${(k)opt_args[-s]:+:(1)}" \ ":maximum arguments${(k)opt_args[-s]:+:(1)}" \ - ':shell function:_functions' + ':shell function:_functions' && ret=0 elif (( $+opt_args[-w] )); then - _wanted files expl 'zwc file' _files -g '*.zwc(-.)' + _wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=0 elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then - if [[ $PREFIX[1] = [/~] ]]; then + if [[ ${"${(e)PREFIX}"[1]} = [/~] ]] && _files; then # Autoload by absolute path - _files + ret=0 else args=(${^fpath}/*(-.:t)) # Filter out functions already loaded or marked for autoload. local -a funckeys funckeys=(${(k)functions}) args=(${args:|funckeys}) - _wanted functions expl 'shell function' compadd -a args + _wanted functions expl 'shell function' compadd -a args && ret=0 fi elif [[ -n $onopts$offopts ]]; then if [[ -n $offopts ]]; then @@ -127,22 +127,23 @@ if [[ "$state" = vars_eq ]]; then [[ $PREFIX != [_.]* ]]; then args=(${args:#_*}) fi - _wanted functions expl 'shell functions' compadd -a args + _wanted functions expl 'shell function' compadd -a args && ret=0 else - _functions + _functions && ret=0 fi elif [[ "$PREFIX" = *\=* ]]; then compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' - _value + _value && ret=0 elif (( $+opt_args[-a] || $+opt_args[-A] )); then - _parameters -q + _parameters -q && ret=0 elif (( $+opt_args[-T] )); then _arguments \ ':scalar parameter:_parameters -g "*scalar*" -q -S "="' \ ':array parameter:_parameters -g "*array*"' \ - ':separator character' + ':separator character' && ret=0 else - _parameters -q -S '=' + _parameters -q -S '=' && ret=0 fi fi +return ret diff --git a/Completion/Zsh/Command/_zed b/Completion/Zsh/Command/_zed index 6b68fadf0..f84993d73 100644 --- a/Completion/Zsh/Command/_zed +++ b/Completion/Zsh/Command/_zed @@ -1,10 +1,16 @@ -#compdef zed fned +#compdef zed fned histed case $service in (fned) _arguments -S : ':shell function:_functions';; +(histed) _arguments -S : \ + '1:history file:_files' \ + '2:history size: ';; (zed) _arguments -S : \ - '(- 2):file:_files' \ - '(1):shell function:_functions' \ - '(1)-x+[specify spaces to use for indentation in function expansion]:spaces' \ - '(1)-f[edit function]';; + '(-h 1 3 4)-f[edit function]' \ + '(-h 1 3 4)-x+[specify spaces to use for indentation in function expansion]:spaces' \ + '(-f -x 1 2)-h[edit history]' \ + '(- 2 3 4)1:file:_files' \ + '(3 4)2:shell function:_functions' \ + '3:history file:_files -g "*(D)"' \ + '4:history size';; esac diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle index e01d0a943..0b8ef7a15 100644 --- a/Completion/Zsh/Command/_zle +++ b/Completion/Zsh/Command/_zle @@ -51,11 +51,11 @@ case "$state[1]" in ;; (widget*) _wanted -C "$context[1]" widgets expl "${state_descr[1]:-widget}" _widgets && ret=0 - ;& - (function) - [[ $state[1] != *function ]] || # Handle fall-through + ;| + (*function) _wanted -C "$context[1]" functions expl 'widget shell function' \ - compadd -M 'r:|-=* r:|=*' -k functions && ret=0 + compadd -M 'r:|-=* r:|=*' -k functions && + ret=0 ;; (comp-widget) _wanted -C "$context[1]" widgets expl 'completion widget' \ diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index 3416d50c6..f3e38c0f6 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -23,7 +23,7 @@ _arguments -n -C -S -s \ '(-e -u)-L[output in the form of calls to zmodload]' \ '(-b -c -d -I -f -F -P -l -m -A -R)-p[autoload module for parameters]' \ '(-u -b -c -d -p -f -A -R)-P[array param for features]:array name:_parameters' \ - '(-)*:params:->params' && ret=0 + '(-)*:param:->params' && ret=0 [[ $state = params ]] || return ret @@ -66,7 +66,7 @@ else while _tags; do _requested builtins expl 'builtin command' \ compadd "$@" -k builtins && ret=0 - _requested loadedmodules expl 'loaded modules' \ + _requested loadedmodules expl 'loaded module' \ compadd -k 'modules[(R)loaded]' && ret=0 _requested files expl 'module file' \ _files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0 diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index 7db73c0c0..0c81c2f2e 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -5,9 +5,6 @@ local nm=$compstate[nmatches] taglist patterns contexts MATCH integer MBEGIN MEND typeset -A opt_args styles -_vcs_info_hooks() { - compadd - ${functions[(I)+vi-*]#+vi-} -} # Assoc array of styles; the values give the possible top-level # contexts: # c completion @@ -65,6 +62,7 @@ styles=( ignore-parents c:ignorepar ignored-patterns c: insert-ids c:insert-ids + insert-sections c:insert-sections insert-tab c:bool insert-unambiguous c:insunambig keep-prefix c:keep-prefix @@ -103,6 +101,7 @@ styles=( preserve-prefix c:preserve-prefix range c: recent-dirs-insert c:recent-dirs-insert + recursive-files c: regular c:bool rehash c:bool remote-access c:bool @@ -113,7 +112,7 @@ styles=( show-ambiguity c: show-completer c:bool single-ignored c:single-ignored - sort c:bool + sort c:sort-order special-dirs c:sdirs squeeze-slashes c:bool stop c:stop @@ -145,6 +144,7 @@ styles=( cursor e: edit-buffer e:bool edit-previous e:bool + editor e: insert-kept e: leave-cursor e:bool match e: @@ -218,7 +218,7 @@ taglist=( ) # Be careful with the context arguments here. They like to masquerade. -_arguments -C \ +_arguments -C -A '-*' \ '(: -)-L[output in form of zstyle commands]:pattern for context patterns:->metapatterns:style:->metastyles' \ '(: -)-d[delete style definitions]:verbatim context pattern:->patterns:*:styles:->pstyles' \ '(: -)-e[value is evaluated when style is looked up]:context pattern:->contexts:style:->styles:*:command:_cmdstring' \ @@ -229,7 +229,7 @@ _arguments -C \ '(: -)-t[test a style, returning false if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \ '(: -)-T[test a style, returning true if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \ '(: -)-m[pattern-match values of a style]:context name:->contexts:style:->styles:pattern: ' \ - '(-):context pattern:->contexts' '(-):style:->styles' '(-)*:argument:->style-arg' + ':context pattern:->contexts' ':style:->styles' '*:argument:->style-arg' while (( $#state )); do case "$state[1]" in @@ -412,14 +412,15 @@ while (( $#state )); do ;; (function) - _wanted control-function expl 'control function' \ + _wanted control-functions expl 'control function' \ compadd predict-on all-matches ;; (functions) - _wanted comp-widget expl 'completion widget' \ - compadd $suf - all-matches complete-debug complete-tag \ - correct-word expand-word expand-alias-word history-words + _wanted comp-widgets expl 'completion widget' \ + compadd $suf -M 'r:|-=* r:|=*' - all-matches complete-debug complete-tag \ + correct-word expand-word expand-alias-word history-words \ + ${${${(M)${(f)"$(_call_program comp-widgets zle -l)"}:#*-C*}:#_*}/ -C*} ;; (user-host-port) @@ -490,7 +491,7 @@ while (( $#state )); do elif compset -P '*:'; then _message -e tags tag else - _message -e patterns 'glob patterns' + _message -e patterns 'glob pattern' fi ;; @@ -524,6 +525,11 @@ while (( $#state )); do compadd - menu single longer ;; + (insert-sections) + _wanted values expl 'where to insert man page section' \ + compadd - true false prepend suffix + ;; + (fake-files) _message -e fakes 'prefix and names' ;; @@ -571,6 +577,10 @@ while (( $#state )); do _message -e separators 'separator string' ;; + (sort-order) + _wanted sort-orders expl 'sort order' compadd -F line - true false match nosort numeric reverse + ;; + (max-matches-width) _message -e numbers 'maximum display width for matches' ;; @@ -659,7 +669,7 @@ while (( $#state )); do 'p[name of top-most patch (applied-string)]' \ 'u[number of unapplied patches (unapplied-string)]' \ 'n[number of applied patches]' \ - 'c[number of unapplied patches.]' \ + 'c[number of unapplied patches]' \ 'a[number of all patches]' \ 'g[names of active mq guards (hg backend)]' \ 'G[number of active mq guards (hg backend)]' |