summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/_default10
-rw-r--r--Completion/Base/_value30
-rw-r--r--Completion/Builtins/_vars_eq8
-rw-r--r--Completion/Builtins/_zstyle10
-rw-r--r--Doc/Zsh/compsys.yo12
6 files changed, 63 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 04c32a92a..1ec380381 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-04-17  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
+	* 10780: Completion/Base/_default, Completion/Base/_value,
+ 	Completion/Builtins/_vars_eq, Completion/Builtins/_zstyle,
+ 	Doc/Zsh/compsys.yo: better completion after `=', everywhere
+	
 	* 10775: Completion/Core/_description, Completion/Core/_path_files,
  	Completion/Core/_tags, Src/Zle/computil.c: make _tags use C-code
  	for braces in tag-order values; and misc. stuff
diff --git a/Completion/Base/_default b/Completion/Base/_default
index e5091a544..8176f392c 100644
--- a/Completion/Base/_default
+++ b/Completion/Base/_default
@@ -12,10 +12,16 @@ if { zstyle -s ":completion:${curcontext}:" use-compctl ctl ||
   compcall "$opt[@]" || return 0
 fi
 
-_files && return 0
+_files "$@" && return 0
 
 # magicequalsubst allows arguments like <any-old-stuff>=~/foo to do
 # file name expansion after the =.  In that case, it's natural to
 # allow completion to handle file names after any equals sign.
 
-[[ -o magicequalsubst ]] && compset -P 1 '*=' && _files
+if [[ -o magicequalsubst && "$PREFIX" = *\=* ]]; then
+  compstate[parameter]="${words[1]:t}-${PREFIX%%\=*}"
+  compset -P 1 '*='
+  _value "$@"
+else
+  return 1
+fi
diff --git a/Completion/Base/_value b/Completion/Base/_value
index e29c90e79..723285233 100644
--- a/Completion/Base/_value
+++ b/Completion/Base/_value
@@ -1,11 +1,32 @@
-#compdef -value-
+#compdef -value- -array-value-
 
 _value () {
-  #_view_completion_parameters
+  # You can customize completion for different parameters by writing a
+  # function `_value:<name>'.
+
   if (( $+functions[_value:$compstate[parameter]] )); then
     "_value:$compstate[parameter]" "$@"
+  elif [[ "$compstate[parameter]" != *-* &&
+          "${(Pt)${compstate[parameter]}}" = assoc* ]]; then
+    if (( CURRENT & 1 )); then
+      _wanted association-keys expl 'association key' \
+          compadd - "${(@kP)${compstate[parameter]}}"
+    else
+      compstate[parameter]="${compstate[parameter]}-${words[CURRENT-1]}"
+      _value "$@"
+    fi
   else
-    _default
+    local pats
+
+    if { zstyle -a ":completion:${curcontext}:" assign-list pats &&
+         [[ "$compstate[parameter]" = (${(j:|:)~pats}) ]] } ||
+       [[ "$PREFIX$SUFFIX" = *:* ]]; then
+      compset -P '*:'
+      compset -S ':*'
+      _default -qS: "$@"
+    else
+      _default "$@"
+    fi
   fi
 }
 
@@ -24,8 +45,11 @@ _value:LDFLAGS () {
     _files -/ "$@"
   elif compset -P '-R'; then
     compset -P '*:'
+    compset -S ':*'
     _files -/ -S/ -r ' :' "$@"
   else
     _default "$@"
   fi
 }
+
+_value "$@"
diff --git a/Completion/Builtins/_vars_eq b/Completion/Builtins/_vars_eq
index 9d7863ae6..1e8fa6d2b 100644
--- a/Completion/Builtins/_vars_eq
+++ b/Completion/Builtins/_vars_eq
@@ -1,9 +1,9 @@
 #compdef declare export integer local readonly typeset
 
-if compset -P '*=*:'; then
-  _default
-elif compset -P '*='; then
-  _default
+if [[ "$PREFIX" = *\=* ]]; then
+  compstate[parameter]="${PREFIX%%\=*}"
+  compset -P 1 '*='
+  _value
 else
   _parameters -q -S '='
 fi
diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle
index b19303300..5f078fddb 100644
--- a/Completion/Builtins/_zstyle
+++ b/Completion/Builtins/_zstyle
@@ -12,9 +12,10 @@ styles=(
   accept-exact		 c:bool
   add-space		 c:bool
   ambiguous              c:bool
-  arguments		 c:
+  assign-list            c:
   auto-description	 c:
   break-keys             c:
+  command                c:command
   completer		 c:completer
   completions		 c:
   condition		 c:
@@ -38,7 +39,6 @@ styles=(
   insert-unambiguous	 c:bool
   last-prompt		 c:bool
   list			 c:listwhen
-  list-arguments	 c:
   list-colors		 c:
   list-packed		 c:bool
   list-rows-first	 c:bool
@@ -235,6 +235,12 @@ while [[ -n $state ]]; do
           compadd - show menu
       ;;
 
+    command)
+      shift 3 words
+      (( CURRENT -= 3 ))
+      _normal
+      ;;
+
     _*)
       ${=ostate}
       ;;
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 91e5c78e8..5e698a9ae 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -771,6 +771,18 @@ generating filenames as matches to find out if the cursor should be left
 after the first ambiguous pathname component even when menucompletion
 is used.
 )
+kindex(assign-list, completion style)
+item(tt(assign-list))(
+When completing after an equal sign, the completion system normally
+completes only one filename.  But when completing the value for some
+parameters or after other strings separated by an equal sign from a
+value, a colon-separated list of filenames is needed. This style
+can be set to a list of patterns matching the names of parameters for
+which such a colon-separated list of filenames should be completed.
+
+The default is to complete lists when the word on the line already
+contains a colon.
+)
 kindex(auto-description, completion style)
 item(tt(auto-description))(
 If set, this style's value will be used as the description for options which