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

Closing quotes in completion



I wrote the following completer called _closequotes to stick before
_complete; if it finds the completion is in quotes, it adds the appropriate
closing quote as an ignored suffix.  It works fine for simple cases, but
for anything more complicated (such as file paths with a slash) the closing
quote appears too far back in the string (and in that case you want to get
rid of it anyway).  Any ideas?  I suppose using a `compctl -M' doesn't work
because it doesn't match against $ISUFFIX anyway.


#autoload

# If the current completion is in quotes, add the closing quote.
# It's a bit brutal, since when completing in segments like file paths
# the quotes go in too early.  We really need some way of getting
# this removed automatically when there's other stuff to come.

if [[ -n $compstate[quote] ]]; then
  compstate[restore]=''
  ISUFFIX="$ISUFFIX$compstate[quote]"
fi

return 1

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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