about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:19:13 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:19:13 +0000
commit01fa693061d3cb414758767925a1540a3adf7668 (patch)
treed87e35348f749e427abd1045e987ce23f1cf0651
parent321a050f36b8037220af343326f71e026e7ef45e (diff)
downloadzsh-01fa693061d3cb414758767925a1540a3adf7668.tar.gz
zsh-01fa693061d3cb414758767925a1540a3adf7668.tar.xz
zsh-01fa693061d3cb414758767925a1540a3adf7668.zip
moved from Completion/Builtins/_vars
-rw-r--r--Completion/Zsh/Type/_vars25
1 files changed, 25 insertions, 0 deletions
diff --git a/Completion/Zsh/Type/_vars b/Completion/Zsh/Type/_vars
new file mode 100644
index 000000000..dece0fecb
--- /dev/null
+++ b/Completion/Zsh/Type/_vars
@@ -0,0 +1,25 @@
+#compdef getopts unset vared
+
+# This will handle completion of keys of associative arrays, e.g. at
+# `vared foo[<TAB>'.
+
+local ret=1
+
+if [[ $PREFIX = *\[* ]]; then
+  compstate[parameter]=${PREFIX%%(|\\)\[*}
+
+  IPREFIX=${PREFIX%%\[*}\[
+  PREFIX=${PREFIX#*\[}
+
+  _subscript -q
+else
+  _parameters -g '^a*' "$@" && ret=0
+  
+  if compset -S '\[*'; then
+    set - -S "" "$@"
+  else
+    set - -qS"${${QIPREFIX:+[}:-\[}" "$@"
+  fi
+  _parameters -g 'a*' "$@" && ret=0
+  return ret
+fi