You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.2 KiB

3 years ago
  1. zsh-syntax-highlighting / highlighters / regexp
  2. ------------------------------------------------
  3. This is the `regexp` highlighter, that highlights user-defined regular
  4. expressions. It's similar to the `pattern` highlighter, but allows more complex
  5. patterns.
  6. ### How to tweak it
  7. To use this highlighter, associate regular expressions with styles in the
  8. `ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`:
  9. ```zsh
  10. typeset -A ZSH_HIGHLIGHT_REGEXP
  11. ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold)
  12. ```
  13. This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not
  14. "sudoedit"
  15. The syntax for values is the same as the syntax of "types of highlighting" of
  16. the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
  17. manual page][zshzle-Character-Highlighting].
  18. See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~`
  19. in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions]
  20. [zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
  21. [perlretut]: http://perldoc.perl.org/perlretut.html
  22. [zshmisc-Conditional-Expressions]: http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html#Conditional-Expressions