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

Re: show-ambiguity style

On 04/11/2015 10:02 PM, Bart Schaefer wrote:
> Completion gets screwed up if show-ambiguity is not an ANSI term color
> attribute or one of the "true" strings (which by the way means you can't
> use boldface because "1" means "true" and is therefore replaced with "4"
> for underlining, but you can use e.g. "1;7" for "bold reverse video").

I mentioned it in the page (and now that I look again, you actually
responded to my first implementation ;)).

show_ambiguity is bolted on list-colors. I started approaching it just
as completer widget.

Since it just accepts a pattern to be fed to list colors, my setting is
actually more interesting(tm):

zstyle ':completion:*' show-ambiguity "1;4:=*=0"

I use bold-underline (not shown in the video), and the extra =*=0
pattern is used as a fallback match to clear any coloring. That is, if
there is no match, I don't want any color.

> Anyway, the point is there could be more internal sanity checking that
> the string that is output is going to make sense, but there currently is
> not, so use caution.

The way the match is constructed (a nested glob expression - a great
idea of Oliver Kiddle) is the neatest and weakest part IMHO. It makes
the highlight work even with complete_in_word, but surely is not as
efficient as post-processing the result *after* list coloring.

It would make sense to decouple show-ambiguity from file coloring. This
would enable to have both on, and avoid keeping extra state.

But again, show_ambiguity is not very well known. After seeing it in
emacs, I *had* to have it on zsh.

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