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

Re: wish for a colored completion system

Matthias Kopfermann wrote:

> Okay, after having heard the answer that there is the possibility
> to have colored completion, has anybody used it to create useful
> completions with colors in them to share with us all?
> There is not one example but the very easy to handle 
> ZLS_COLOURS case for completing different kinds of files.
> To me it still seems to be quite complex to say the least.
> Okay, I try to be not so polite: :)
> Should'nt there be an easier way than that approach?

It's the normal way of configuring things for the new completion
system and I definitely think colouring should be done like all other
setup for it. The `=pat=col' syntax was partly chosen because we
(well, some people here) wanted the possibility to use their $LS_COLOR
for zsh, too. That left us not too many syntax extensions to use.

Hm, how should we supply good examples for something depending so much 
on personal preference. One thing you can try is using similarities in 
the completion lists, like the ` -- ' thing used for descriptions:

  zstyle ':completion:*:(jobs|directory-stack|indexes|option|values)' list-colors \
      '=(#b)(*) -- (*)=35;1=31=33'

More examples? These show another problem: the patterns often depend
on the output format of certain system commands like ps(1) and lpq(1):

  zstyle ':completion:*:processes' list-colors \
      '=(#b)( #[0-9]#) ??????[^0-9]##([0-9]##:[0-9][0-9][.:][0-9][0-9])(*)=35=31;1=32=33'
  zstyle ':completion:*::lp*:jobs' list-colors \
      '=(#b)* [0-9] ##([^ 	]##) ##([^ 	]##) ##([^ 	]##) ##(*)=35=32=31;1=33=32'

And we can't do anything about that...

Other things one might want to highlight are the descriptions (see the 
`format' style) and probably `special' types of matches, like
`warnings', `all-expansions', `original' etc. Oh, and, of course, the
`ma' capability when using menu-selection.


P.S.: You'll certainly get other colours because I don't use a

Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

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