about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Builtins/_vars16
-rw-r--r--Completion/Builtins/_zstyle5
-rw-r--r--Completion/Core/_parameters21
3 files changed, 27 insertions, 15 deletions
diff --git a/Completion/Builtins/_vars b/Completion/Builtins/_vars
index 501e37b4f..dece0fecb 100644
--- a/Completion/Builtins/_vars
+++ b/Completion/Builtins/_vars
@@ -6,20 +6,12 @@
 local ret=1
 
 if [[ $PREFIX = *\[* ]]; then
-  local var=${PREFIX%%\[*}
-  local elt="${PREFIX#*\]}${SUFFIX%\]}"
-  local addclose
+  compstate[parameter]=${PREFIX%%(|\\)\[*}
 
-  compset -p $(( ${#var} + 1 ))
-  if ! compset -S \]; then
-    addclose=(-S "${${QIPREFIX:+]}:-\]}")
-  fi
-  if [[ ${(tP)var} = assoc* ]]; then
-    local expl
+  IPREFIX=${PREFIX%%\[*}\[
+  PREFIX=${PREFIX#*\[}
 
-    _wanted -C subscript association-keys expl 'association key' \
-        compadd $addclose -k "$var"
-  fi
+  _subscript -q
 else
   _parameters -g '^a*' "$@" && ret=0
   
diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle
index 3a485f0da..62e5369e4 100644
--- a/Completion/Builtins/_zstyle
+++ b/Completion/Builtins/_zstyle
@@ -25,6 +25,7 @@ styles=(
   domains                c:
   expand		 c:
   fake			 c:fake
+  fake-parameters	 c:fake-params
   file-patterns		 c:filepat
   file-sort              c:fsort
   force-list             c:
@@ -269,6 +270,10 @@ while [[ -n $state ]]; do
       _message 'prefix and names'
       ;;
 
+    fake-params)
+      _message 'name and optional type'
+      ;;
+
     ignline) 
       _wanted values expl boolean compadd true false current current-shown other
       ;;
diff --git a/Completion/Core/_parameters b/Completion/Core/_parameters
index b49d60dda..097a96760 100644
--- a/Completion/Core/_parameters
+++ b/Completion/Core/_parameters
@@ -6,10 +6,25 @@
 # If you specify a -g option with a pattern, the pattern will be used to
 # restrict the type of parameters matched.
 
-local expl pattern
+local expl pattern fakes faked tmp
 
 pattern=(-g \*)
 zparseopts -D -K -E g:=pattern
 
-_wanted parameters expl parameter compadd "$@" \
-   -Q -k "parameters[(R)${pattern[2]}~*local*]"
+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]}}%%:*}"