about summary refs log tree commit diff
path: root/Completion/Builtins/_compdef
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-25 09:48:08 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-25 09:48:08 +0000
commitd49da606702363f0eb5615a341126c2dbe562849 (patch)
tree7946392a9792bff64a6396868335a85c851690f4 /Completion/Builtins/_compdef
parentfc56c6231290db7b1979b2d6d3a978a5906c67ac (diff)
downloadzsh-d49da606702363f0eb5615a341126c2dbe562849.tar.gz
zsh-d49da606702363f0eb5615a341126c2dbe562849.tar.xz
zsh-d49da606702363f0eb5615a341126c2dbe562849.zip
make _arguments use more than one action when appropriate; add _argument_sets to complete different sets of arguments and options for the same command (10908)
Diffstat (limited to 'Completion/Builtins/_compdef')
-rw-r--r--Completion/Builtins/_compdef18
1 files changed, 13 insertions, 5 deletions
diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef
index 6287810e5..649daa6dc 100644
--- a/Completion/Builtins/_compdef
+++ b/Completion/Builtins/_compdef
@@ -8,11 +8,19 @@ _arguments -C -s \
   '(-a -n -p -P -k -K)-d[delete]:*:completed command:->ccom' \
   '(-n -d -P -k -K)-p[completion for command matching pattern]:completion function:->cfun:pattern' \
   '(-n -d -p -k -K)-P[as -p for commands without own completion]:completion function:->cfun:pattern' \
-  '(-d -p -P -K)-k[define widget and key binding]:completion function:->cfun:widget name::style:->style:*:key' \
-  '(-d -p -P -k)-K[define multiple widgets based on function]:completion function:->cfun:widget name::style:->style:*:key' \
-  '1:completion function:->cfun' \
-  '2:commands:_command_names'
-  
+  '(-d -p -P -K)-k[define widget and key binding]:completion function:->cfun:style:->style:*:key' \
+  '(-d -p -P -k)-K[define multiple widgets based on function]:*::: :->multi' \
+  ':completion function:->cfun' \
+  '*:commands: _command_names' && return 0
+
+if [[ $state = multi ]]; then
+  case $(( CURRENT % 3 )) in
+  0) _message key
+     return 1;;
+  1) state=cfun;;
+  2) state=style;;
+  esac
+fi
 
 case $state in
   ccom)