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

Re: wish for a colored completion system



Bart Schaefer wrote:

> On Jun 8,  3:39pm, Fletch wrote:
> > 
> >         If I add '=lemur*=01;32' to ':completion:*' list-colors it
> > works fine (ssh l<C-d> produces three highighted lemur* and plain
> > localhost and lp).  
> 
> Aha!  You have host names and user names listed simultaneously.
> 
> Add this:
> 
> zstyle ':completion:*' group-name ''
> 
> That will make two sub-lists, one of host names and one of user names,
> and then you'll get the colors in the host names.
> 
> I'm not sure why ':completion:*:ssh:*' doesn't work for the combined
> listing; perhaps it's a bug.  Sven?

Hm, yes, the description in the docs make it sound as if it should
work. The problem is that without separate groups there is no way for
the completion code to find out that with

  zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
  zstyle ':completion:*:ssh:*:users' list-colors '=b*=32'

hosts starting with `b' should be coloured with `32'. We would need a
per-match colouring for that and that's too expensive.

And to come back to the question, the completion code only looks up
the style with the tag in the context and it can't find out that the
pattern used in the definition doesn't contain the tag. If we wanted
to solve that, we would have to make _setup get the name of the group
(which may be -default-) as an argument (when called from
_description) and use that name in ZLS_COLORS. But then we would be
back to what I said above.

So, we could (quite easily) change it, but that set-for-one-tag-and-
used-for-others-too made me do it in the way we have it now, I would
be willing to write the change if people say that they prefer it,
though (I have group-name == '', so I don't care much about this).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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