From 3dc74b5c2c71583a4523037113d644f780fb4e07 Mon Sep 17 00:00:00 2001 From: Tobias Sette Date: Wed, 12 Dec 2018 03:56:56 -0200 Subject: [PATCH] pattern, regexp: Declare the variable in the documentation example Fixes #590. --- docs/highlighters/pattern.md | 3 +++ docs/highlighters/regexp.md | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/highlighters/pattern.md b/docs/highlighters/pattern.md index 3ad5f24..8853db0 100644 --- a/docs/highlighters/pattern.md +++ b/docs/highlighters/pattern.md @@ -9,6 +9,9 @@ This is the `pattern` highlighter, that highlights user-defined patterns. To use this highlighter, associate patterns with styles in the `ZSH_HIGHLIGHT_PATTERNS` associative array, for example in `~/.zshrc`: + # Declare the variable + typeset -A ZSH_HIGHLIGHT_PATTERNS + # To have commands starting with `rm -rf` in red: ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') diff --git a/docs/highlighters/regexp.md b/docs/highlighters/regexp.md index 25f1b6c..2078525 100644 --- a/docs/highlighters/regexp.md +++ b/docs/highlighters/regexp.md @@ -10,6 +10,7 @@ patterns. To use this highlighter, associate regular expressions with styles in the `ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`: + typeset -A ZSH_HIGHLIGHT_PATTERNS ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold) This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not