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/18/2014 07:07 PM, Oliver Kiddle wrote:
> I intentionally prevented it from highlighting the first (or only)
> character. As I said in the first message, it seems fairly pointless.
> The underlining doesn't make the completion list easier to read quickly
> so it needs to be useful. It also isn't ideal when you get an underlined
> space as that looks like an underscore.

Sorry, now the expression clicked for me.
It was failing for the following:

touch 'file a'
touch 'file b'
ls file\ <TAB>

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'm not sure whether it would be more feasible to manually escape a
selected set of characters, or do something like the following:

local lit=' \''"'
ZLS_COLORS+=":=${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${${MATCH:q}//\\[$lit]/$MATCH}|)}${${prefix[-1]:q}//\\[$lit]/$prefix[-1]}(#b)(?|)*==4"

which will simply unescape what's needed.

The choice of underscore is arbitrary. I was using bold before, but the
font I'm currently using has almost the same weight, which was difficult
to distinguish. Underline/underscore are different enough for me.




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