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

Re: wish for a colored completion system

On Jun 7,  5:20pm, Matthias Kopfermann wrote:
} Subject: wish for a colored completion system
} (I love colored completion when i hit ls<tab>.
}  i want it with other completions , too , not only
}  when i try to complete filenames .

Check out the `list-colors' style, which can be used to override the
ZLS_COLORS parameter on a per-completion basis.

The doc for ZLS_COLORS (actually, for the complist module, there is no
independent entry for the parameter) in 3.1.9 says:

    Apart from these strings, the NAME may also be an asterisk (`*')
    followed by any string. The VALUE given for such a string will be
    used for all files whose name ends with the string. The NAME may
    also be a equal sign (`=') followed by a pattern. The VALUE given
    for this pattern will be used for all matches (not just filenames)
    whose display string are matched by the pattern. Definitions for
    both of these take precedence over the values defined for file types
    and the form with the leading asterisk takes precedence over the
    form with the leading equal sign.

So for example one can do

zstyle ':completion:*:zsh-options' \
	list-colors '=csh*=31:=*hist*=32:=list*=34:=*glob*=35'

to have csh options in red, history options in green, completion listing
options in blue, and globbing options in magenta.  The patterns are tried
left to right, so "cshnullglob" is in red, not magenta.  Unfortunately,
you can't specify that csh gets a red foreground and globs get a yellow
background and have them overlap; oh, well.

The tricky bit is figuring out what string goes at the tail of the style
pattern, e.g. `zsh-options' in this case.  The place to look is the
"Standard Tags" subsection in the "Completion System Configuration"

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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