zsh-syntax-highlighting
zsh-syntax-highlighting copied to clipboard
Add bracket-error-open and bracket-error-close bracket highlighting styles
Rationale:
Typing at the command-line generally proceeds from left to right, and the typist may open many brackets as he goes. Newly-opened brackets usually not errors, but unfinished thoughts. The user may therefore wish to style open-bracket match-failures differently than close-bracket match-failures.
I prefer to color only the close-bracket match-failure as an error:
ZSH_HIGHLIGHT_STYLES[bracket-error-open]=default
ZSH_HIGHLIGHT_STYLES[bracket-error-close]='fg=red'
This code actually could be written to fall through to bracket-error instead of having a distinct bracket-error-close style, but that asymmetry might confuse the user.