Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: pws-21: _vars



Peter Stephenson wrote:

> This extends the _vars completion, used after things like read and vared,
> to allow completion of the keys of associative arrays.

  % typeset -A foo
  % foo=(-bar baz)
  % vared 'foo[<TAB>
  compadd: bad option -b

I often forget to add the `-' before the words in compadd, too.

This also had a problem when there were characters after the `['.

Bye
 Sven

--- oc/Base/_vars	Thu Jun 10 13:00:40 1999
+++ Completion/Base/_vars	Thu Jun 10 13:03:38 1999
@@ -4,7 +4,7 @@
 # `vared compconfig[<TAB>'.  However, in this version the [ must be
 # added by hand.
 
-if [[ $PREFIX = *\[ ]]; then
+if [[ $PREFIX = *\[* ]]; then
   local var=${PREFIX%%\[*}
   local elt="${PREFIX#*\]}${SUFFIX%\]}"
   local addclose
@@ -13,7 +13,7 @@
     addclose=(-S ']')
   fi
   if [[ ${(tP)var} = assoc* ]]; then
-    compadd $addclose ${(kP)var}
+    compadd $addclose - ${(kP)var}
   fi
 else
   compgen -v

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author