diff options
Diffstat (limited to 'Completion/Zsh/Command')
-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 |
12 files changed, 170 insertions, 78 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 ;; |