main: support highlighting paths with specific styles

If there are styles starting with `*.`, consider these "glob matchers"
and style according to the matching glob. This allows users to color
paths matching patterns in any way desired.

Fixes: #605
This commit is contained in:
Ben Boeckel 2026-06-13 01:11:03 -04:00
commit f39e4bbdfb
3 changed files with 19 additions and 0 deletions

View file

@ -67,6 +67,11 @@ This highlighter defines the following styles:
* `arg0` - a command word other than one of those enumerated above (other than a command, precommand, alias, function, or shell builtin command).
* `default` - everything else
Additionally, styles starting with `*.` may be used to style `path` and
`redirection` argument matches with a more specific style. For example,
defining the `*.png` style will apply to any `path` or `redirection` target
ending with `.png`.
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
for example in `~/.zshrc`: