zsh-syntax-highlighting/highlighters
Manish Tiwari 71b1101166 main: don't honour PATH_DIRS for a precommand's target command
sudo(8) (and env, nice, and other entries in \$precommand_options)
resolve their target command via execvp(3)-style lookup, which never
searches \$path for a name containing a slash -- unlike the shell's
own PATH_DIRS option. So "sudo foo/bar" was highlighted as a valid
command whenever the user had PATH_DIRS set and some \$path element
made "foo/bar" resolvable that way, even though sudo itself would
fail to find it.

:sudo_opt: already marks every word from a recognised precommand up
to and including its actual command word (for any precommand in
\$precommand_options, not just sudo). Key off that existing marker to
shadow PATH_DIRS out of \$options_to_set for just those two
_zsh_highlight_main__type calls, via an anonymous-function scope so
the shadow reverts automatically and normal command-word classification
elsewhere in the line is unaffected.

Fixes #595.
2026-08-24 14:51:48 +05:30
..
brackets brackets: Optimize the character iteration 2020-07-14 20:19:40 +00:00
cursor *: Change highlighters' namespace. 2016-08-16 17:53:01 +00:00
line highlighters: Rename entry points. 2016-08-16 17:51:43 +00:00
main main: don't honour PATH_DIRS for a precommand's target command 2026-08-24 14:51:48 +05:30
pattern Use the new, unreleased zsh 'memo=' feature to remove only our own entries from $region_highlight. 2020-07-14 00:32:36 +00:00
regexp Use the new, unreleased zsh 'memo=' feature to remove only our own entries from $region_highlight. 2020-07-14 00:32:36 +00:00
root highlighters: Rename entry points. 2016-08-16 17:51:43 +00:00
README.md docs: Followup to the recent docs branch: clean up some internal cross-references. 2015-11-27 04:07:02 +00:00

README.md

zsh-syntax-highlighting / highlighters

Navigate into the individual highlighters' documentation to see what styles ($ZSH_HIGHLIGHT_STYLES keys) each highlighter defines.

Refer to the documentation on highlighters for further information.