summaryrefslogtreecommitdiff
path: root/.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md
diff options
context:
space:
mode:
Diffstat (limited to '.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md')
-rw-r--r--.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md b/.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md
new file mode 100644
index 0000000..5c8a89e
--- /dev/null
+++ b/.config/shells/zsh/plugins/zsh-syntax-highlighting/docs/highlighters/regexp.md
@@ -0,0 +1,30 @@
+zsh-syntax-highlighting / highlighters / regexp
+------------------------------------------------
+
+This is the `regexp` highlighter, that highlights user-defined regular
+expressions. It's similar to the `pattern` highlighter, but allows more complex
+patterns.
+
+### How to tweak it
+
+To use this highlighter, associate regular expressions with styles in the
+`ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`:
+
+```zsh
+typeset -A ZSH_HIGHLIGHT_REGEXP
+ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold)
+```
+
+This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not
+"sudoedit"
+
+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][zshzle-Character-Highlighting].
+
+See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~`
+in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions]
+
+[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
+[perlretut]: http://perldoc.perl.org/perlretut.html
+[zshmisc-Conditional-Expressions]: http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html#Conditional-Expressions