summary refs log tree commit diff
path: root/Completion/Zsh/Context
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:23:29 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:23:29 +0000
commita0ad55d34f94402f08582e303d043bf5400198b7 (patch)
tree60de53f98a9214d427c145fcf373fc08cd2b99a8 /Completion/Zsh/Context
parent1bb11adee91f6d2fadb3120e1a3cd98440e535db (diff)
downloadzsh-a0ad55d34f94402f08582e303d043bf5400198b7.tar.gz
zsh-a0ad55d34f94402f08582e303d043bf5400198b7.tar.xz
zsh-a0ad55d34f94402f08582e303d043bf5400198b7.zip
moved from Completion/Base/_in_vared
Diffstat (limited to 'Completion/Zsh/Context')
-rw-r--r--Completion/Zsh/Context/_in_vared35
1 files changed, 35 insertions, 0 deletions
diff --git a/Completion/Zsh/Context/_in_vared b/Completion/Zsh/Context/_in_vared
new file mode 100644
index 000000000..abd24dd95
--- /dev/null
+++ b/Completion/Zsh/Context/_in_vared
@@ -0,0 +1,35 @@
+#compdef -vared-
+
+local also
+
+# Completion inside vared.
+
+if [[ $compstate[vared] = *\[* ]]; then
+  if [[ $compstate[vared] = *\]* ]]; then
+    # vared on an array-element
+    compstate[parameter]=${${compstate[vared]%%\]*}//\[/-}
+    compstate[context]=value
+    also=-value-
+  else
+    # vared on an array-value
+    compstate[parameter]=${compstate[vared]%%\[*}
+    compstate[context]=value
+    also=-value-
+  fi
+else
+  # vared on a parameter, let's see if it is an array
+  compstate[parameter]=$compstate[vared]
+  if [[ ${(tP)compstate[vared]} = *(array|assoc)* ]]; then
+    compstate[context]=array_value
+    also=-array-value-
+  else
+    compstate[context]=value
+    also=-value-
+  fi
+fi
+
+# Don't insert TAB in first column. Never.
+
+compstate[insert]="${compstate[insert]//tab /}"
+
+_contexts "$also"