Skip to content

Commit

Permalink
[sorin-ionescu#52] Add zstyles to configure syntax-highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
sorin-ionescu authored and fanf committed May 15, 2014
1 parent 58780a0 commit 0c9f4e8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/history-substring-search/external
12 changes: 12 additions & 0 deletions modules/syntax-highlighting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ To enable all highlighters, add the following to *zpreztorc*:
'cursor' \
'root'

### Highlighting Styles

Each syntax highlighter defines styles used to highlight tokens.

To highlight, for example, builtins, commands, and functions in blue instead of
green, add the following to *zpreztorc*:

zstyle ':prezto:module:syntax-highlighting' styles \
'builtin' 'bg=blue' \
'command' 'bg=blue' \
'function' 'bg=blue'

Authors
-------

Expand Down
2 changes: 1 addition & 1 deletion modules/syntax-highlighting/external
11 changes: 10 additions & 1 deletion modules/syntax-highlighting/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ fi
# Source module files.
source "${0:h}/external/zsh-syntax-highlighting.zsh"

# Set the highlighters.
# Set highlighters.
zstyle -a ':prezto:module:syntax-highlighting' highlighters 'ZSH_HIGHLIGHT_HIGHLIGHTERS'
if (( ${#ZSH_HIGHLIGHT_HIGHLIGHTERS[@]} == 0 )); then
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
fi

# Set highlighting styles.
typeset -A syntax_highlighting_styles
zstyle -a ':prezto:module:syntax-highlighting' styles 'syntax_highlighting_styles'
for syntax_highlighting_style in "${(k)syntax_highlighting_styles[@]}"; do
ZSH_HIGHLIGHT_STYLES[$syntax_highlighting_style]=\
"$syntax_highlighting_styles[$syntax_highlighting_style]"
done
unset syntax_highlighting_style{s,}

0 comments on commit 0c9f4e8

Please sign in to comment.