summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_chown2
-rw-r--r--Completion/Unix/Command/_ln2
-rw-r--r--Completion/Unix/Type/_directories2
-rw-r--r--Completion/Zsh/Command/_command15
-rw-r--r--Completion/Zsh/Command/_fc86
-rw-r--r--Completion/Zsh/Command/_typeset2
-rw-r--r--Completion/Zsh/Command/_unhash11
-rw-r--r--Completion/Zsh/Command/_which3
-rw-r--r--Completion/Zsh/Command/_zle8
-rw-r--r--Completion/Zsh/Command/_zstyle2
-rw-r--r--Completion/Zsh/Context/_brace_parameter110
-rw-r--r--Completion/Zsh/Context/_subscript2
-rw-r--r--Completion/Zsh/Type/_globflags11
-rw-r--r--Completion/Zsh/Type/_history_modifiers1
14 files changed, 165 insertions, 92 deletions
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index b4539315d..7a7e5911c 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -1,4 +1,4 @@
-#compdef chown chgrp
+#compdef chown chgrp zf_chown=chown zf_chgrp=chgrp
 
 local curcontext="$curcontext" state line expl ret=1
 local suf usr grp req deref args
diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln
index 12baf76a9..c903fee02 100644
--- a/Completion/Unix/Command/_ln
+++ b/Completion/Unix/Command/_ln
@@ -1,4 +1,4 @@
-#compdef ln gln
+#compdef ln gln zf_ln
 
 local curcontext="$curcontext" state line ret=1
 local -A opt_args
diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories
index 702d31dc4..2125645fe 100644
--- a/Completion/Unix/Type/_directories
+++ b/Completion/Unix/Type/_directories
@@ -1,4 +1,4 @@
-#compdef rmdir dircmp -P -value-,*path,-default-
+#compdef rmdir zf_rmdir dircmp -P -value-,*path,-default-
 
 local expl
 
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/_fc b/Completion/Zsh/Command/_fc
index 2af5980c2..133145670 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/_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/_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/_zstyle b/Completion/Zsh/Command/_zstyle
index 2ebae7132..8f6c412cc 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -322,7 +322,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-)'
      ;;
 
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/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/_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"