Added more styles used in zle_highlight. Updated main README.md and highlighters/main/README.md.

This commit is contained in:
jimmijj 2015-09-07 02:55:02 +02:00
parent 103aecc52e
commit ad75e32f98
4 changed files with 12 additions and 1 deletions

View File

@ -1,7 +1,7 @@
zsh-syntax-highlighting
=======================
Syntax highlighting for [Zsh](http://www.zsh.org).**
Enhanced highlighting of the [Zsh](http://www.zsh.org) command-line, including syntax, paths, files, selected regions, searched patterns and much more.
![](misc/screenshot.png)

View File

@ -47,6 +47,10 @@ This highlighter defines the following styles:
* `dollar-double-quoted-argument` - dollar double quoted arguments
* `back-double-quoted-argument` - back double quoted arguments
* `assign` - variable assignments
* `isearch` - matched string in history-incremental-search* widgets
* `region` - selected region (between the point and the mark)
* `special` - unprintable characters
* `suffix` - suffix characters used in the completion system
* `default` - parts of the buffer that do not match anything
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`:

View File

@ -56,6 +56,10 @@
: ${ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]:=fg=cyan}
: ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:=fg=cyan}
: ${ZSH_HIGHLIGHT_STYLES[assign]:=none}
: ${ZSH_HIGHLIGHT_STYLES[isearch]:=fg=yellow,bg=red,bold}
: ${ZSH_HIGHLIGHT_STYLES[region]:=bg=blue}
: ${ZSH_HIGHLIGHT_STYLES[special]:=none}
: ${ZSH_HIGHLIGHT_STYLES[suffix]:=none}
# Whether the highlighter should be called or not.
_zsh_highlight_main_highlighter_predicate()

View File

@ -93,6 +93,9 @@ _zsh_highlight()
done
# Set zle_highlight according to user definition on this package level
zle_highlight=(default:$ZSH_HIGHLIGHT_STYLES[default] isearch:$ZSH_HIGHLIGHT_STYLES[isearch] region:$ZSH_HIGHLIGHT_STYLES[region] special:$ZSH_HIGHLIGHT_STYLES[special] suffix:$ZSH_HIGHLIGHT_STYLES[suffix])
# Bring back region higlighting from zle_highlight array (was overwriten by region_highlight)
((REGION_ACTIVE)) && region_highlight+=("$((CURSOR < MARK ? CURSOR : MARK)) $((CURSOR > MARK ? CURSOR : MARK)) ${${(M)zle_highlight[@]:#region*}#region:}")