Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: highlight matching part
- X-seq: zsh-users 13085
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: completion: highlight matching part
- Date: Sat, 02 Aug 2008 14:35:56 -0700
- In-reply-to: <20080801163301.GA3589@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080801163301.GA3589@xxxxxxxxxxxxxxxx>
On Aug 1, 6:33pm, Tomasz Pala wrote:
}
} is it possible for zsh to highlight (bold, change color etc.) of
} matching part of available completions?
This is possible with a combination of tricks. You have to use the
"list-colors" zstyle rather than setting the ZLS_COLORS variable, and
you have to use "zstyle -e" to set an evaluated style.
The really hard part is deciphering the documentation for list-colors,
which doesn't have much in the way of examples.
Here's an example that makes the prefix green and puts a green
background behind each of the characters that you can type next:
autoload -U colors
colors
zstyle -e ':completion:*' list-colors \
'reply=( "=(#b)(*$PREFIX)(?)*=00=$color[green]=$color[bg-green]" )'
The first =00 gives the default color (none) for any part of the
listing that does not match one of the sub-patterns that is enclosed
in parens.
The above doesn't work when completing files in subdirectories, and
something is forcing e.g. executable files to be colored bold green,
directories red, etc., if there is ANY value at all for list-colors or
ZLS_COLORS; this must be a bug in the complist module, because the doc
says any value with a leading equal sign should take precedence.
} $ ls abcd[tab]
} abcd123 abcd456 abcd789
} abcdefg abcdhij abcdklm
}
} and I'd like the 'abcd' to be lightgreen.
You'll have to work out for yourself what to replace $color[green]
with, in the example above. "light green" is not a standard ANSI
color and the code for it may vary. Just find the number that your
terminal uses and insert that above.
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author