about summary refs log tree commit diff
path: root/Completion/Zsh
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-01-17 18:49:32 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-01-17 18:49:32 +0000
commitf879a295e14bb81a94fc52329b28ee523fcd36a7 (patch)
tree89f8ba2ba00570bd7dfa5bb415110498231b06cf /Completion/Zsh
parent3708080538bcb59e9659065be00ad5eb31d2312d (diff)
downloadzsh-f879a295e14bb81a94fc52329b28ee523fcd36a7.tar.gz
zsh-f879a295e14bb81a94fc52329b28ee523fcd36a7.tar.xz
zsh-f879a295e14bb81a94fc52329b28ee523fcd36a7.zip
use pager style instead of $EDITOR and fix bad substitution in exclusion lists
Diffstat (limited to 'Completion/Zsh')
-rw-r--r--Completion/Zsh/Command/_zle60
-rw-r--r--Completion/Zsh/Command/_zstyle5
2 files changed, 31 insertions, 34 deletions
diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle
index 2d707a22c..1e787e54f 100644
--- a/Completion/Zsh/Command/_zle
+++ b/Completion/Zsh/Command/_zle
@@ -1,7 +1,7 @@
 #compdef zle
 
-local expl ret=1 st
-local -a opts compwids state
+local expl ret=1
+local -a opts compwids state line context
 
 compwids=(accept-and-menu-complete
 	  complete-word
@@ -19,59 +19,55 @@ _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" \
-    "(${opts#-l})-L+[with -l, list as commands]:*:-:->listing" \
-    "(${opts#-[La]})-l+[list user-defined widgets]:*:-:->listing" \
-    "(${opts#-l})-a+[with -l, list all widgets]:*:-:->listing" \
+    \(${(j. .)opts:#-l}')-L[with -l, list as commands]' \
+    \(${(j. .)opts:#-[La]}')-l+[list user-defined widgets]:*:-:->listing' \
+    \(${(j. .)opts:#-l}')-a[with -l, list all widgets]' \
     "($opts)-M[display message]:message: " \
     "($opts)-N[define new widget]:widget name:->widget-or-function ::widget shell function:->function" \
-    "(${opts#-c})-R+[redisplay]:*:-:->redisplay" \
-    "(${opts#-R})-c+[with -R, clear listing]:*:-:->redisplay" \
+    \(${(j. .)opts:#-c}')-R+[redisplay]:*:-:->redisplay' \
+    \(${(j. .)opts:#-R}')-c[with -R, clear listing]' \
     "($opts)-U[unget to input stack]:string: " \
-    '(-)::widget name:->call'
+    '(-):widget:->widget' \
+    '(-)*::widget args:->args' && ret=0
 
 [[ $state == listing ]] &&
-  _arguments -s -S \
-    "-l[list user-defined widgets]" \
+  _arguments -s -S '!-l' \
     "(-a)-L[list as commands]" \
     "(-L)-a[list all widgets]" \
-    '(-)*:widget name:->widget'
+    '*:widget name:->widget' && ret=0
 
-for st in $state; do
-  case $st in
-    (call)
-      if ((CURRENT > 2)); then
-	_arguments \
-          '(-N)-n[numeric prefix]:number: ' \
-	  '(-n)-N[reset numeric prefix]' \
-	  ':widget::' '(-)*:widget arguments: ' && ret=0
-	  # :widget:: is a placeholder so we needn't shift words
-	continue
-      fi
-      ;&
+while (( $#state )); do
+  case "$state[1]" in
+    (args)
+      _arguments \
+        '(-N)-n[numeric prefix]:number:' \
+	'(-n)-N[reset numeric prefix]' \
+	'(-)*:widget arguments: ' && ret=0
+      ;;
     (widget*)
-      _wanted widgets expl widget compadd -k widgets && ret=0
+      _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
       [[ $st != *function ]] && continue
       ;&
     (function)
-      _wanted functions expl 'widget shell function' \
+      _wanted -C "$context[1]" functions expl 'widget shell function' \
 	compadd -k functions && ret=0
       ;;
     (comp-widget)
-      _wanted widgets expl 'completion widget' \
+      _wanted -C "$context[1]" widgets expl 'completion widget' \
 	compadd -k "widgets[(R)(*:|)(.|)(${(j(|))compwids})(|:*)]" && ret=0
       ;&
     (builtin-comp-widget)
-      _wanted widgets expl 'builtin completion widget' \
+      _wanted -C "$context[1]" widgets expl 'builtin completion widget' \
 	compadd -k "widgets[(I)(.|)(${(j(|))compwids})]" && ret=0
       ;;
     (redisplay)
-      _arguments -s \
-        "-R[redisplay]" \
-	"(*)-c[clear listing]" \
-	"(-)::status line: " "*:strings to list: " && ret=0
+      _arguments -s -S '!-R' \
+	"-c[clear listing]" \
+	":status line" "*:strings to list" && ret=0
       ;;
-    (*) ret=$?;;
   esac
+  shift 1 state
+  shift 1 context
 done
 
 return ret
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 48a39deed..bec258e1f 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -89,6 +89,7 @@ styles=(
   original		 c:bool
   packageset		 c:packageset
   path			 c:_directories
+  pager			 c:_command_names
   pine-directory         c:_directories
   ports			 c:_ports
   prefix-hidden		 c:bool
@@ -233,8 +234,8 @@ while (( $#state )); do
 
     functions)
       _wanted comp-widget expl 'completion widget' \
-          compadd $suf - all-matches complete-tag correct-word expand-word \
-	  expand-alias-word history-words
+          compadd $suf - all-matches complete-debug complete-tag \
+	  correct-word expand-word expand-alias-word history-words
       ;;
 
     user-host-port)