about summary refs log tree commit diff
path: root/Completion/Base/_value
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 08:22:44 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 08:22:44 +0000
commit1fb481b8c28f555c4f9b787cc92498a3821541ec (patch)
tree49e3978fdb7a2b1d65f3ce13d1faa82305d09bc9 /Completion/Base/_value
parentcd45aa331dc206b1b40c5be5e222d46148bf42ac (diff)
downloadzsh-1fb481b8c28f555c4f9b787cc92498a3821541ec.tar.gz
zsh-1fb481b8c28f555c4f9b787cc92498a3821541ec.tar.xz
zsh-1fb481b8c28f555c4f9b787cc92498a3821541ec.zip
better completion after `=', everywhere (10780)
Diffstat (limited to 'Completion/Base/_value')
-rw-r--r--Completion/Base/_value30
1 files changed, 27 insertions, 3 deletions
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 "$@"