cdd7f899cb
Test case: See the first comment of issue #295. Before: num calls time self name ----------------------------------------------------------------------------------- 1) 14 284.67 20.33 82.84% 284.67 20.33 82.84% _zsh_highlight_highlighter_brackets_paint 2) 15 313.72 20.91 91.30% 26.62 1.77 7.75% _zsh_highlight 3) 14 318.68 22.76 92.74% 7.41 0.53 2.16% _zsh_highlight_call_widget After: num calls time self name ----------------------------------------------------------------------------------- 1) 15 57.25 3.82 45.33% 28.30 1.89 22.41% _zsh_highlight 2) 14 81.96 5.85 64.90% 27.02 1.93 21.40% _zsh_highlight_call_widget 3) 14 26.31 1.88 20.84% 26.31 1.88 20.84% _zsh_highlight_highlighter_brackets_paint 4) 2 10.66 5.33 8.44% 8.97 4.49 7.10% VCS_INFO_formats 5) 2 25.92 12.96 20.52% 7.72 3.86 6.11% VCS_INFO_get_data_git (That's not in my everyday configuration but in my minimal testing setup, which runs vcs_info with the default settings.) |
||
---|---|---|
.. | ||
test-data | ||
README.md | ||
brackets-highlighter.zsh |
README.md
zsh-syntax-highlighting / highlighters / brackets
This is the brackets
highlighter, that highlights brackets and parentheses, and
matches them.
How to tweak it
This highlighter defines the following styles:
bracket-error
- unmatched bracketsbracket-level-N
- brackets with nest level Ncursor-matchingbracket
- the matching bracket, if cursor is on a bracket
To override one of those styles, change its entry in ZSH_HIGHLIGHT_STYLES
,
for example in ~/.zshrc
:
# To define styles for nested brackets up to level 4
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin $zle_highlight
array, which is documented in the zshzle(1)
manual page.