1
0
Fork 0

Add pattern tweaking to syntax-highlighting

Enable setting patterns in *zpreztorc* like styles are set.
pull/856/head
Ellis Tsung 10 years ago
parent c98da90662
commit f23a1960f8

@ -50,6 +50,16 @@ green, add the following to *zpreztorc*:
'command' 'bg=blue' \ 'command' 'bg=blue' \
'function' 'bg=blue' 'function' 'bg=blue'
### Highlighting Patterns
The pattern highlighter enables highlighting user defined patterns.
For example, to highlight commands starting with `rm -rf` in red, add the
following to *zpreztorc*:
zstyle ':prezto:module:syntax-highlighting' patterns \
'rm -rf *' 'fg=white,bold,bg=red'
Authors Authors
------- -------

@ -26,3 +26,11 @@ for syntax_highlighting_style in "${(k)syntax_highlighting_styles[@]}"; do
ZSH_HIGHLIGHT_STYLES[$syntax_highlighting_style]="$syntax_highlighting_styles[$syntax_highlighting_style]" ZSH_HIGHLIGHT_STYLES[$syntax_highlighting_style]="$syntax_highlighting_styles[$syntax_highlighting_style]"
done done
unset syntax_highlighting_style{s,} unset syntax_highlighting_style{s,}
# Set highlighting patterns
typeset -A syntax_highlighting_patterns
zstyle -a ':prezto:module:syntax-highlighting' patterns 'syntax_highlighting_patterns'
for syntax_highlighting_pattern in "${(k)syntax_highlighting_patterns[@]}"; do
ZSH_HIGHLIGHT_PATTERNS[$syntax_highlighting_pattern]="$syntax_highlighting_patterns[$syntax_highlighting_pattern]"
done
unset syntax_highlighting_pattern{s,}

@ -123,13 +123,17 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# 'pattern' \ # 'pattern' \
# 'cursor' \ # 'cursor' \
# 'root' # 'root'
#
# Set syntax highlighting styles. # Set syntax highlighting styles.
# zstyle ':prezto:module:syntax-highlighting' styles \ # zstyle ':prezto:module:syntax-highlighting' styles \
# 'builtin' 'bg=blue' \ # 'builtin' 'bg=blue' \
# 'command' 'bg=blue' \ # 'command' 'bg=blue' \
# 'function' 'bg=blue' # 'function' 'bg=blue'
# Set syntax highlighting patterns
# zstyle ':prezto:module:syntax-highlighting' patterns \
# 'rm -rf *' 'fg=white,bold,bg=red'
# #
# Terminal # Terminal
# #

Loading…
Cancel
Save