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

Re: widget special PREFIX variable and cursor position with complete_in_word



On 02/25/2014 09:41 PM, Oliver Kiddle wrote:
>> which made me disregard it too quickly. Interestingly it fails due to
>> the fact that $MATCH:q is translating ' ' to '\ ' (which should be
>> literal in this context). Same for the quotes.
> 
> I'd really have expected superfluous quoting like that to be ignored.

Me too, actually.

> With your change it seems to work in single quotes but not for backslash
> quotes.

> 
> I think it is perhaps better to explicitly quote characters that are
> special in patterns rather than reverting the quoting for spaces and
> quotes. I've included what I now have in full below to make it easier
> for anyone following this.
> 
> Having used this for a little while now, I've found it is sometimes
> vaguely useful. Is it worth adding to git? I'm inclined to think it
> should be included in _main_complete as a zstyle option rather than as a
> completer.
> 
> This is working for many things that need quoting like | and *. I can't
> work out how to cope with an initial = mainly because I can't get the
> pattern to match it.

I also noticed so far that it fails for = like you said, and # too.
Though I'm not sure how to handle it correctly at this point, since it's
not clear what are the rules anymore. Maybe there is some unquoting
going on in ZLS_COLORS? Because the generated pattern looks legitimate
to me.

I've also tried (with no luck) to expand to ([${MATCH}]|) instead, but
it fails for a different set of characters.

> _show_ambiguity_end() {
>   local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
>   local toquote='[\(\)\|~^?*[\]#]'

What about <>?




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