diff options
Diffstat (limited to 'Completion/Zsh')
-rw-r--r-- | Completion/Zsh/Command/_bindkey | 1 | ||||
-rw-r--r-- | Completion/Zsh/Command/_command | 15 | ||||
-rw-r--r-- | Completion/Zsh/Command/_emulate | 6 | ||||
-rw-r--r-- | Completion/Zsh/Command/_fc | 86 | ||||
-rw-r--r-- | Completion/Zsh/Command/_tcpsys | 18 | ||||
-rw-r--r-- | Completion/Zsh/Command/_typeset | 2 | ||||
-rw-r--r-- | Completion/Zsh/Command/_unhash | 11 | ||||
-rw-r--r-- | Completion/Zsh/Command/_which | 3 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zattr | 9 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zle | 8 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zmodload | 42 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zstyle | 47 | ||||
-rw-r--r-- | Completion/Zsh/Context/_brace_parameter | 110 | ||||
-rw-r--r-- | Completion/Zsh/Context/_subscript | 2 | ||||
-rw-r--r-- | Completion/Zsh/Function/_add-zsh-hook | 24 | ||||
-rw-r--r-- | Completion/Zsh/Function/_zcalc | 7 | ||||
-rw-r--r-- | Completion/Zsh/Type/_globflags | 11 | ||||
-rw-r--r-- | Completion/Zsh/Type/_globquals | 2 | ||||
-rw-r--r-- | Completion/Zsh/Type/_history_modifiers | 1 |
19 files changed, 277 insertions, 128 deletions
diff --git a/Completion/Zsh/Command/_bindkey b/Completion/Zsh/Command/_bindkey index 045cba960..4c4aeda9d 100644 --- a/Completion/Zsh/Command/_bindkey +++ b/Completion/Zsh/Command/_bindkey @@ -26,6 +26,7 @@ _arguments -C -s -S \ '(-l -L -d -D -A -N -m -s *)-r[unbind specified in-strings]:*:in-string' \ '(-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:->widget' && ret=0 case $state in diff --git a/Completion/Zsh/Command/_command b/Completion/Zsh/Command/_command index 7cfb52c2f..4e2858676 100644 --- a/Completion/Zsh/Command/_command +++ b/Completion/Zsh/Command/_command @@ -1,14 +1,11 @@ #compdef command -local ret - # indicate if this is a precommand modifier [[ $service = command ]] && precommands+=(command) -if [[ CURRENT -ge 3 ]]; then - compset -n 2 - _normal && ret=0 -else - _path_commands "$@" && ret=0 -fi -return ret +_arguments \ + '-v[indicate result of command search]:*:command:_path_commands' \ + '-V[show result of command search in verbose form]:*:command:_path_commands' \ + '(-)-p[use default PATH to find command]' \ + ':command:_path_commands' \ + '*::arguments: _normal' diff --git a/Completion/Zsh/Command/_emulate b/Completion/Zsh/Command/_emulate index e562d6834..d6fb0c3d9 100644 --- a/Completion/Zsh/Command/_emulate +++ b/Completion/Zsh/Command/_emulate @@ -1,6 +1,8 @@ #compdef emulate -_arguments -C -s -A "-*" \ +_arguments -C -s \ '-L[set local_options and local_traps as well]' \ '-R[reset all options instead of only those needed for script portability]' \ - '::shell to emulate:(zsh sh ksh csh)' + '1:shell to emulate:(zsh sh ksh csh)' \ + '2:specify optional command:(-c)' \ + '3:command:_cmdstring' diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index 2af5980c2..c2987211e 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -1,21 +1,47 @@ #compdef fc history r +local curcontext="$curcontext" state state_descr line ret=1 +local list events num cmd +typeset -A opt_args local fc_common fc_hist fc_r +# hide any replacements from _arguments +local cur=${(M)#words[1,CURRENT-1]:#*=*} +words=( "${(@)words[1,CURRENT-1]:#*=*}" "${(@)words[CURRENT,-1]}" ) +(( CURRENT -= cur )) + fc_common=( + -s -S '(-A -R -W -I -p -P)-r[reverse order of the commands]' '(-A -R -W -I -e -p -P)-n[suppress line numbers]' - '(-A -R -W -I -p -P)*::commands:_command_names -e' ) +) + +if [[ -n ${words[(r)-[pa](|[ap])]} ]]; then + fc_common+=( + ':history file:_files' + ':history size:' + ':saved history size:' + ) + [[ -n ${words[(r)-(|a)p(|a)]} ]] || fc_common+='!-a:option:(-p)' +elif [[ -n ${words[(r)-*[ARWI]*]} ]]; then + fc_common+=( ':history file:_files' ) +else + fc_common=( -C "$fc_common[@]" + '(-)1:first event:->events' '2:last event:->events' + ) +fi fc_hist=( - '(-A -R -W -I -p -p)-m[treat first argument as a pattern]' - '(-A -R -W -I -e -f -E -i -t -p -P)-d[print time-stamps]' - '(-A -R -W -I -e -d -E -i -t -p -P)-f[mm/dd/yyyy format time-stamps]' - '(-A -R -W -I -e -d -f -i -t -p -P)-E[dd.mm.yyyy format time-stamps]' - '(-A -R -W -I -e -d -f -E -t -p -P)-i[yyyy-mm-dd format time-stamps]' - '(-A -R -W -I -e -d -f -E -i -p -P)-t[print time-stamps in specified format]:date format' - '(-A -R -W -I -e -p -P)-D[print elapsed times]' - '(- *)-p[push current history to stack]:history file:_files:history size: :saved history size' + '(-A -R -W -I -a -p -P 2)-m[treat argument as a pattern]' + '(-A -R -W -I -e -f -E -i -t -a -p -P)-d[print time-stamps]' + '(-A -R -W -I -e -d -E -i -t -a -p -P)-f[mm/dd/yyyy format time-stamps]' + '(-A -R -W -I -e -d -f -i -t -a -p -P)-E[dd.mm.yyyy format time-stamps]' + '(-A -R -W -I -e -d -f -E -t -a -p -P)-i[yyyy-mm-dd format time-stamps]' + '(-A -R -W -I -e -d -f -E -i -a -p -P)-t[print time-stamps in specified format]:date format' + '(-A -R -W -I -e -a -p -P)-D[print elapsed times]' + + '(-A -R -W -I -e -d -f -i -l -m -n -r -D -E -t -P)-a[with -p, automatically pop history on function return]' + '(-A -R -W -I -e -d -f -i -l -m -n -r -D -E -t -P)-p[push current history to stack]' '(- *)-P[pop history from stack]' ) @@ -23,18 +49,42 @@ fc_r='(-A -R -W -I -e)-l[list resulting commands on stdout]' case $service in history) - _arguments -s -S "$fc_common[@]" "$fc_hist[@]" && return 0 + _arguments "$fc_common[@]" "$fc_hist[@]" && ret=0 ;; r) - _arguments -s -S "$fc_common[@]" "$fc_r" && return 0 + _arguments "$fc_common[@]" "$fc_r" && ret=0 ;; *) - _arguments -s -S \ - '(-A -R -W -I -l -n -d -f -E -i -D -p -P)-e[specify editor to invoke]:editor to invoke:_command_names -e' \ - '(-l -m -e -r -n -d -f -E -i -D -A -W -p -P *)-R[read history from file]:history file:_files' \ - '(-l -m -e -r -n -d -f -E -i -D -R -W -p -P *)-A[append history to file]:history file:_files' \ - '(-l -m -e -r -n -d -f -E -i -D -R -A -p -P *)-W[write history to file]:history file:_files' \ - '(-l -m -e -r -n -d -f -E -i -D -A -W -p -P *)-I[read/write new events only]:history file:_files' \ - "$fc_common[@]" "$fc_hist[@]" "$fc_r" && return 0 + _arguments "$fc_common[@]" "$fc_hist[@]" "$fc_r" \ + '(-A -R -W -I -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-a -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]',\ +'W[write history to file]',\ +'I[read/write new events only]'} && ret=0 ;; esac + +if [[ -n $state ]]; then + if [[ -z ${line:#*=*} ]] && compset -P '*='; then + _message -e replacements 'replacement' + elif [[ -prefix [0-9] ]]; then + events=( ${(ps.\0.)"$(printf '%s:%s\0' ${(kv)history})"} ) + zformat -a list " -- " "$events[@]" + _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \ + "${events[@]%%:*}" + elif [[ -prefix - ]]; then + for num cmd in ${(kv)history}; do + (( num=num - HISTNO )) + events+=( $num:$cmd ) + done + zformat -a list " -- " "$events[@]" + _wanted -2V events expl "$state_descr" compadd -ld list - \ + "${events[@]%%:*}" + else + _wanted events expl "$state_descr" compadd -S '' - \ + ${${history%%[=[:IFS:]]*}:#[0-9-]*} || _guard "[0-9]#" event + fi +fi && ret=0 + +return ret diff --git a/Completion/Zsh/Command/_tcpsys b/Completion/Zsh/Command/_tcpsys index dcc6f6cc8..1240ffbf8 100644 --- a/Completion/Zsh/Command/_tcpsys +++ b/Completion/Zsh/Command/_tcpsys @@ -1,16 +1,16 @@ #compdef tcp_open -local context line expl nm=$compstate[nmatches] -local -a state argargs sesslist +local curcontext="$curcontext" state line expl local -A opt_args +local -a argargs sesslist case $service in (tcp_open) argargs=( '(-a -f -l)-s[open session(s)]' '(-a -f -s)-l[open list of sessions]' - '(-f -s -l)-a[open session for accept on fd]:fd:->fd' - '(-a -s -l)-f[open session for accept on fd]:fd:->fd' + '(-f -s -l)-a[open session for accept on fd]:fd' + '(-a -s -l)-f[open session for accept on fd]:fd' '-q[quiet mode]' '-z[no zle handler]' ) @@ -19,7 +19,7 @@ case $service in elif [[ -n $words[(R)-(l|s)*] ]]; then argargs+=('*:session:->session') else - argargs+=(':host:->host' ':port:->port' '*:session:->session') + argargs+=(':host:_hosts' ':port:_ports' '*:session:->session') fi _arguments -C $argargs ;; @@ -27,14 +27,6 @@ esac while (( $#state )); do case "$state[1]" in - (host) - _hosts - ;; - - (port) - _ports - ;; - (sessionlist) compset -P '*,' ;& diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset index 367dbfc23..4e29c23e7 100644 --- a/Completion/Zsh/Command/_typeset +++ b/Completion/Zsh/Command/_typeset @@ -46,7 +46,7 @@ use="AEFHLRTUZafghiklmprtuxz" case ${service} in autoload) - use="UXktwz" + use="UTXktwz" func=f ;; float) use="EFHghlprtux";; diff --git a/Completion/Zsh/Command/_unhash b/Completion/Zsh/Command/_unhash index c05c27ea3..ff0c03f49 100644 --- a/Completion/Zsh/Command/_unhash +++ b/Completion/Zsh/Command/_unhash @@ -1,14 +1,9 @@ #compdef unhash -local expl state line curcontext="$curcontext" - -_arguments -C -s -S \ - '(-a -f -s *)-d[remove named directories]:*:named directory:->nameddir' \ +_arguments -s -S \ + '(-a -f -s *)-d[remove named directories]:*:named directory:compadd -k nameddirs' \ '(-d -f -s *)-a[remove aliases]:*:alias:_aliases' \ '(-a -d -f *)-s[remove suffix aliases]:*:suffix alias:_aliases -s s' \ '(-d -a -s *)-f[remove functions]:*:shell function:_functions' \ '-m[treat arguments as patterns]' \ - '(-a -d -f -m)*:command: _command_names -e' && return 0 - -[[ "$state" = nameddir ]] && - _wanted named-directories expl 'named directory' compadd -k nameddirs + '(-a -d -f -m)*:command: _command_names -e' diff --git a/Completion/Zsh/Command/_which b/Completion/Zsh/Command/_which index 07ede39fd..c43704ae8 100644 --- a/Completion/Zsh/Command/_which +++ b/Completion/Zsh/Command/_which @@ -6,7 +6,8 @@ cargs=( \ '(-v -c)-w[print command type]' \ '-p[always do a path search]' \ '-m[treat the arguments as patterns]' \ - '-s[print symlink free path as well]' \ + '(-S)-s[print symlink free path as well]' \ + '(-s)-S[show steps in the resolution of symlinks]' \ '*:commands:->command' ) farg='-f[output contents of functions]' aarg='-a[print all occurrences in path]' diff --git a/Completion/Zsh/Command/_zattr b/Completion/Zsh/Command/_zattr index 1924bb28d..e48047f6c 100644 --- a/Completion/Zsh/Command/_zattr +++ b/Completion/Zsh/Command/_zattr @@ -1,7 +1,6 @@ #compdef zgetattr zsetattr zdelattr zlistattr -local state line expl ret=1 REPLY -local -a args privs +local context state line expl ret=1 REPLY case $service in zgetattr) @@ -29,6 +28,8 @@ _arguments \ esac && ret=0 if [[ $state = attrs ]]; then - zlistattr ${~${(Q)line[1]}} REPLY 2> /dev/null - _wanted attrs expl 'attribute' compadd $REPLY + zlistattr ${(Q)${~line[1]}} REPLY 2> /dev/null + _wanted -C "$context[1]" attrs expl 'attribute' compadd -a REPLY && ret=0 fi + +return ret diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle index 2bfc708e5..3ed373348 100644 --- a/Completion/Zsh/Command/_zle +++ b/Completion/Zsh/Command/_zle @@ -13,20 +13,24 @@ compwids=(accept-and-menu-complete menu-expand-or-complete reverse-menu-complete) -opts=(-A -C -D -L -M -N -R -U -a -c -l \* :) +opts=(-A -C -D -F -L -M -N -R -T -U -a -c -l -r \* :) _arguments -s -S \ "($opts)-A[define widget alias]:old widget:->widget :new widget:->widget" \ "($opts)-C[define completion widget]:new widget name:->comp-widget :completion widget:->builtin-comp-widget :widget shell function:->function" \ "($opts)-D[delete widget]:*:widget:->widget" \ - \(${(j. .)opts:#-l}')-L[with -l, list as commands]' \ + \(${(j. .)opts:#-[lFT]}')-L[with -l, list as commands]' \ \(${(j. .)opts:#-[La]}')-l+[list user-defined widgets]:*:-:->listing' \ \(${(j. .)opts:#-l}')-a[with -l, list all widgets]' \ + "(: * ${(j. .)opts:#-[Lw]})-F[install file descriptor handler]:file descriptor:_file_descriptors::handler:_functions" \ + "!($opts)-K:keymap:compadd -a keymaps" \ "($opts)-M[display message]:message: " \ "($opts)-N[define new widget]:widget name:->widget-or-function ::widget shell function:->function" \ \(${(j. .)opts:#-c}')-R+[redisplay]:*:-:->redisplay' \ \(${(j. .)opts:#-R}')-c[with -R, clear listing]' \ "($opts)-U[unget to input stack]:string: " \ + '(: *)-T[manipulate transformations]:transformation:(tc):function:_functions' \ + \(${(j. .)opts:#-T}')-r[remove transformations]' \ '(-):widget:->widget' \ '(-)*::widget args:->args' && ret=0 diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index ffcab28dd..e144b981e 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -4,35 +4,38 @@ local suf comp state line expl curcontext="$curcontext" ret=1 NORMARG typeset -A opt_args suf=() -_arguments -n -C -A "-*" -s \ - '(-i -u -d -a -b -c -I -p -f -e)-A[create module aliases]' \ - '-u[unload module]' \ - '(-e)-a[autoload module]' \ - '(-c -I -p -f)-b[autoload module for builtins]' \ - '(-b -I -p -f)-c[autoload module for condition codes]' \ - '(-i)-d[list or specify module dependencies]' \ - '(-i -u -d -a -b -c -p -f -L -A)-e[test if modules are loaded]' \ - '(-b -c -I -p)-f[autoload module for math functions]' \ - '(-u -b -c -p -f -A)-F[handle features]' \ +_arguments -n -C -S -s \ + '(-R -P -i -u -d -a -b -c -I -p -f -e -F -m)-A[create module aliases]' \ + '(-)-R[remove module aliases]' \ + '(-A -R -F -L -m -P -l -e)-u[unload module]' \ + '(-d -e -l)-a[autoload module]' \ + '(-c -d -I -p -f -F -P -l -m -A -R)-b[autoload module for builtins]' \ + '(-b -d -I -p -f -F -P -l -m -A -R)-c[autoload module for condition codes]' \ + '(-A -R -F -I -P -a -b -c -e -f -i -l -m -p)-d[list or specify module dependencies]' \ + '(-i -u -d -a -b -c -p -f -L -R)-e[test if modules are loaded]' \ + '(-b -c -d -I -p -F -P -l -m -A -R)-f[autoload module for math functions]' \ + '(-u -b -c -d -p -f -A -R -I)-F[handle features]' \ + '(-u -b -c -d -p -f -A -R -I)-m[treat feature arguments as patterns]' \ '(-d -e)-i[suppress error if command would do nothing]' \ - '(-b -c -p -f)-I[define infix condition names]' \ - '(-u -b -c -p -f -A)-l[list features]' \ + '(-b -c -d -p -f -F -P -m)-I[define infix condition names]' \ + '(-u -b -c -d -p -f -A -R)-l[list features]' \ '(-e -u)-L[output in the form of calls to zmodload]' \ - '(-b -c -I -f)-p[autoload module for parameters]' \ - '(-u -b -c -p -f -A)-P[array param for features]:array name:_parameters' \ - '*:params:->params' && ret=0 + '(-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 [[ $state = params ]] || return ret -(( $+opt_args[-A] )) && compset -P '*=' || suf=( -S '=' ) - +if (( $+opt_args[-A] )); then + compset -S '=*' || compset -P '*=' || suf=( -S '=' ) +fi if (( $+opt_args[-F] && CURRENT > NORMARG )); then local module=$words[NORMARG] local -a features if [[ $modules[$module] != loaded ]]; then - _message "features for unloaded module" + _message -e features "feature for unloaded module" else zmodload -lFP features $module if compset -P -; then @@ -41,6 +44,9 @@ if (( $+opt_args[-F] && CURRENT > NORMARG )); then elif compset -P +; then # only disabled features needed features=(${${features:#+*}##?}) + else + # complete opposite of current feature state, + is default + features=(${${features#-}/(#s)+/-}) fi _wanted features expl feature compadd -a features fi diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index eb27117b2..9a6d61891 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -20,6 +20,9 @@ _completers() { compadd "$@" "$disp[@]" - "$us${^list[@]}" } +_vcs_info_hooks() { + compadd - ${functions[(I)+vi-*]#+vi-} +} # Assoc array of styles; the values give the possible top-level # contexts: # c completion @@ -122,6 +125,7 @@ styles=( select-prompt c: select-scroll c: separate-sections c:bool + show-ambiguity c: show-completer c:bool single-ignored c:single-ignored sort c:bool @@ -176,7 +180,10 @@ styles=( actionformats v:vcs-format branchformat v:branch-format nvcsformats v: + hgrevformat v:hgrev-format stgitformat v:stg-format + patch-format v:patch-format + nopatch-format v:patch-format max-exports v: enable v:vcs disable v:vcs @@ -190,7 +197,16 @@ styles=( use-server v:bool use-simple v:bool get-revision v:bool + get-mq v:bool + get-bookmarks v:bool + get-unapplied v:bool + debug v:bool + hooks v:_vcs_info_hooks use-prompt-escapes v:bool + use-quilt v:bool + quilt-standalone v:bool + quilt-patch-dir v:_directories + quiltcommand v:_command_names chpwd z:bool progress z:progress @@ -307,7 +323,7 @@ while (( $#state )); do (cmdorcont) _alternative -O suf \ - 'commands:command:_command ' \ + 'commands:command:_path_commands' \ 'contexts:context:(-array-value- -brace-parameter- -command- -condition- -math- -parameter- -redirect- -subscript- -value-)' ;; @@ -549,7 +565,18 @@ while (( $#state )); do compset -P '*%' _values -s '' 'format replacement' \ 'b[the current branch]' \ - 'r[current revision number]' \ + 'r[current revision number]' + else + _message -e formats 'vcs format' + fi + ;; + + (hgrev-format) + if [[ $PREFIX = *% ]]; then + compset -P '*%' + _values -s '' 'format replacement' \ + 'h[current revision hash (global)]' \ + 'r[current revision number (local)]' else _message -e formats 'vcs format' fi @@ -566,6 +593,22 @@ while (( $#state )); do fi ;; + (patch-format) + if [[ $PREFIX = *% ]]; then + compset -P '*%' + _values -s '' 'format replacement' \ + '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.]' \ + 'a[number of all patches]' \ + 'g[names of active mq guards (hg backend)]' \ + 'G[number of active mq guards (hg backend)]' + else + _message -e formats 'vcs format' + fi + ;; + (_*) ${=state[1]} $suf ;; diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter index 2aeb12bf4..fcca4bf84 100644 --- a/Completion/Zsh/Context/_brace_parameter +++ b/Completion/Zsh/Context/_brace_parameter @@ -104,9 +104,9 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then done if [[ -z $found_percent ]]; then - flags=("%:Expand prompt sequences") + flags=("%:expand prompt sequences") else - flags=("%:Expand prompts respecting options") + flags=("%:expand prompts respecting options") fi case $q_last in (0) @@ -134,58 +134,74 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then flags+=("Q:remove one level of quoting") fi if [[ -z $found_m ]]; then - flags+=("m:Count multibyte width in padding calculation") + flags+=("m:count multibyte width in padding calculation") else - flags+=("m:Count number of character code points in padding calculation") + flags+=("m:count number of character code points in padding calculation") fi flags+=( - "#:Evaluate as numeric expression" - "@:Double-quoted splitting of scalars" - "A:Create array parameter" - "a:Sort in array index order (with O to reverse)" - "c:Count characters in an array (with \${(c)#...})" - "C:Capitalize words" - "D:Perform directory name abbreviation" - "e:Perform single-word shell expansions" - "f:Split the result on newlines" - "F:Join arrays with newlines" - "g:Process echo array sequences (needs options)" - "i:Sort case-insensitively" - "k:Subsitute keys of associative arrays" - "L:Lower case all letters" - "n:Sort decimal integers numerically" - "o:Sort in ascending order (lexically if no other sort option)" - "O:Sort in descending order (lexically if no other sort option)" - "P:Use parameter value as name of parameter for redirected lookup" - "t:Substitute type of parameter" - "u:Substitute first occurrence of each unique word" - "U:Upper case all letters" - "v:Substitute values of associative arrays (with (k))" - "V:Visibility enhancements for special characters" - "w:Count words in array or string (with \${(w)#...})" - "W:Count words including empty words (with \${(W)#...})" - "X:Report parsing errors and eXit substitution" - "z:Split words as if zsh command line" - "0:Split words on null bytes" - "p:Handle print escapes in parameter flag arguments" - "~:Treat strings in parameter flag arguments as patterns" - "j:Join arrays with specified string" - "l:Left-pad resulting words" - "r:Right-pad resulting words" - "s:Split words on specified string" - "Z:Split words as if zsh command line (with options)" - # "_:Extended flags, for future expansion" - "S:Search substrings in #, %, / expressions" - "I:Search <argument>th match in #, %, / expressions" - "B:Include index of beginning of match in #, %, / expressions" - "E:Include index of end of match in #, %, / expressions" - "M:Include matched portion in #, %, / expressions" - "N:Include length of match in #, %, expressions" - "R:Include rest (unmatched portion) in #, %, / expressions" + "#:evaluate as numeric expression" + "@:double-quoted splitting of scalars" + "A:create array parameter" + "a:sort in array index order (with O to reverse)" + "c:count characters in an array (with \${(c)#...})" + "C:capitalize words" + "D:perform directory name abbreviation" + "e:perform single-word shell expansions" + "f:split the result on newlines" + "F:join arrays with newlines" + "g:process echo array sequences (needs options)" + "i:sort case-insensitively" + "k:subsitute keys of associative arrays" + "L:lower case all letters" + "n:sort decimal integers numerically" + "o:sort in ascending order (lexically if no other sort option)" + "O:sort in descending order (lexically if no other sort option)" + "P:use parameter value as name of parameter for redirected lookup" + "t:substitute type of parameter" + "u:substitute first occurrence of each unique word" + "U:upper case all letters" + "v:substitute values of associative arrays (with (k))" + "V:visibility enhancements for special characters" + "w:count words in array or string (with \${(w)#...})" + "W:count words including empty words (with \${(W)#...})" + "X:report parsing errors and eXit substitution" + "z:split words as if zsh command line" + "0:split words on null bytes" + "p:handle print escapes or variables in parameter flag arguments" + "~:treat strings in parameter flag arguments as patterns" + "j:join arrays with specified string" + "l:left-pad resulting words" + "r:right-pad resulting words" + "s:split words on specified string" + "Z:split words as if zsh command line (with options)" + # "_:extended flags, for future expansion" + "S:search substrings in #, %, / expressions" + "I:search <argument>th match in #, %, / expressions" + "B:include index of beginning of match in #, %, / expressions" + "E:include index of end of match in #, %, / expressions" + "M:include matched portion in #, %, / expressions" + "N:include length of match in #, % expressions" + "R:include rest (unmatched portion) in #, %, / expressions" ) _describe -t flags "parameter flag" flags -Q -S '' return +elif compset -P '*:([\|\*\^]|\^\^)'; then + _arrays + return elif compset -P '*:'; then + flags=( + '-:substitute alternate value if parameter is null' + '+:susbtitute alternate value if parameter is non-null' + '=:substitute and assign alternate value if parameter is null' + '\:=:unconditionally assign value to parameter' + '?:print error if parameter is set and non-null' + '#:filter value matching pattern' + '|:set difference' + '*:set intersection' + '^:zip arrays' + '^^:zip arrays reusing values from shorter array' + ) + _describe -t flags "operator" flags -Q -S '' _history_modifiers p return fi diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index cf1ec49a4..0ccc0c4ef 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -23,7 +23,7 @@ if [[ $BUFFER[1,pos-1] = (|*[[:space:]:=]##)\~\[ ]]; then elif [[ "$PREFIX" = :* ]]; then _wanted characters expl 'character class' \ compadd -p: -S ':]' alnum alpha ascii blank cntrl digit graph \ - lower print punct space upper xdigit + lower print punct space upper xdigit IFS IDENT IFSSPACE WORD elif compset -P '\('; then local match compset -S '\)*' diff --git a/Completion/Zsh/Function/_add-zsh-hook b/Completion/Zsh/Function/_add-zsh-hook new file mode 100644 index 000000000..c70a4976f --- /dev/null +++ b/Completion/Zsh/Function/_add-zsh-hook @@ -0,0 +1,24 @@ +#compdef add-zsh-hook + +local context state state_descr line +typeset -A opt_args + +_add-zsh-hook_hooks() { + if (( $+opt_args[-d] )); then + _wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0 + else + _functions && return 0 + fi + return 1 +} + +_add-zsh-hook() { + _arguments -s -w -S : \ + '(-D)-d[remove HOOK from the array]' \ + '(-d)-D[interpret HOOK as pattern to remove from the array]' \ + {-U,-z,-k}"[passed to 'autoload']" \ + ':hook class:(chpwd precmd preexec periodic zshaddhistory zshexit zsh_directory_name)' \ + ':hook function:_add-zsh-hook_hooks' +} + +_add-zsh-hook "$@" diff --git a/Completion/Zsh/Function/_zcalc b/Completion/Zsh/Function/_zcalc new file mode 100644 index 000000000..093a7a91d --- /dev/null +++ b/Completion/Zsh/Function/_zcalc @@ -0,0 +1,7 @@ +#compdef zcalc + +_arguments -s -w -S : \ + '-#[specify default base]:base: ' \ + '-f[force floating point for all expressions]' \ + '-e[treat command line as expressions to be output immediately]' \ + '*:expression: ' diff --git a/Completion/Zsh/Type/_globflags b/Completion/Zsh/Type/_globflags index ca665466b..5833dc8f1 100644 --- a/Completion/Zsh/Type/_globflags +++ b/Completion/Zsh/Type/_globflags @@ -4,11 +4,17 @@ local ret=1 local -a flags if compset -P a; then - _message -e numbers 'errors' + _message -e number 'errors' return elif compset -P q; then _globquals return +elif compset -P 'c[0-9]##,'; then + _message -e number 'max repetitions' + return +elif compset -P c; then + _message -e number 'repetitions (min or exact)' + return fi flags=( @@ -17,6 +23,8 @@ flags=( 'I:case sensitive matching' 's:match start of string' 'e:match end of string' + 'U:consider all characters to be one byte' + 'u:support multibyte characters in pattern' ) [[ $compstate[context] = condition ]] && flags+=( 'b:activate backreferences' @@ -29,6 +37,7 @@ _describe -t globflags "glob flag" flags -Q -S ')' && ret=0 flags=( 'a:approximate matching' 'q:introduce glob qualifier' + 'c:match repetitions of preceding pattern' ) _describe -t globflags "glob flag" flags -Q -S '' && ret=0 diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index 37db161d0..042b27400 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -213,7 +213,7 @@ case $state in ".:plain files" "@:symbolic links" "=:sockets" - "p:name pipes (FIFOS)" + "p:named pipes (FIFOs)" "*:executable plain files" "%:device files" "r:owner-readable" diff --git a/Completion/Zsh/Type/_history_modifiers b/Completion/Zsh/Type/_history_modifiers index f8dcd45ae..658f9f346 100644 --- a/Completion/Zsh/Type/_history_modifiers +++ b/Completion/Zsh/Type/_history_modifiers @@ -66,6 +66,7 @@ while true; do list+=( "a:absolute path" "A:absolute path resolving symbolic links" + "c:PATH search for command" "g:globally apply s or &" "h:head - strip trailing path element" "t:tail - strip directories" |