summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:20:15 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:20:15 +0000
commitfd4859bccb984c1fa8248706276838d07b1e5693 (patch)
tree45970d684e2a1b21dedc989952f5ad7f5993b2a0 /Completion
parent9dff5d2d9bda56c793aedacd4f0090c08e4d1d53 (diff)
downloadzsh-fd4859bccb984c1fa8248706276838d07b1e5693.tar.gz
zsh-fd4859bccb984c1fa8248706276838d07b1e5693.tar.xz
zsh-fd4859bccb984c1fa8248706276838d07b1e5693.zip
moved from Completion/Core/_parameters
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Zsh/Type/_parameters30
1 files changed, 30 insertions, 0 deletions
diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_parameters
new file mode 100644
index 000000000..097a96760
--- /dev/null
+++ b/Completion/Zsh/Type/_parameters
@@ -0,0 +1,30 @@
+#autoload
+
+# This should be used to complete parameter names if you need some of the
+# extra options of compadd. It completes only non-local parameters.
+
+# If you specify a -g option with a pattern, the pattern will be used to
+# restrict the type of parameters matched.
+
+local expl pattern fakes faked tmp
+
+pattern=(-g \*)
+zparseopts -D -K -E g:=pattern
+
+fakes=()
+faked=()
+if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then
+  for i in "$tmp[@]"; do
+    if [[ "$i" = *:* ]]; then
+      faked=( "$faked[@]" "$i" )
+    else
+      fakes=( "$fakes[@]" "$i" )
+    fi
+  done
+fi
+
+_wanted parameters expl parameter \
+    compadd "$@" -Q - \
+        "${(@k)parameters[(R)${pattern[2]}~*local*]}" \
+        "$fakes[@]" \
+        "${(@)${(@M)faked:#${~pattern[2]}}%%:*}"