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

@ -1258,6 +1258,16 @@ _zsh_highlight_main_highlighter_check_path()
fi
else
if [[ -L $expanded_path || -e $expanded_path ]]; then
for key in ${(k)ZSH_HIGHLIGHT_STYLES}; do
case $key in
"*."*) ;;
*) continue ;;
esac
case $arg in
*.$key[3,-1]) REPLY=$key ;;
esac
done
return 0
fi
fi