*highlight,*plugin.zsh: Highlight variables when 256 color terminal

This commit is contained in:
Sebastian Gniazdowski 2016-11-03 11:49:07 +01:00
parent 2bf4e674ba
commit 64f47cec06
2 changed files with 9 additions and 1 deletions

View file

@ -15,5 +15,9 @@ zle -N history-search-multi-word
zle -N history-search-multi-word-backwards history-search-multi-word
zle -N history-search-multi-word-pbackwards history-search-multi-word
zle -N history-search-multi-word-pforwards history-search-multi-word
[[ "${+termcap[Co]}" = 1 && "${termcap[Co]}" = "256" ]] && zstyle ":history-search-multi-word" highlight-color "bg=17"
[[ "${+termcap[Co]}" = 1 && "${termcap[Co]}" = "256" ]] && {
zstyle ":history-search-multi-word" highlight-color "bg=17"
typeset -gA HSMW_HIGHLIGHT_STYLES
HSMW_HIGHLIGHT_STYLES[variable]="fg=112"
}
bindkey "^R" history-search-multi-word

View file

@ -59,6 +59,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
: ${HSMW_HIGHLIGHT_STYLES[redirection]:=none}
: ${HSMW_HIGHLIGHT_STYLES[comment]:=fg=black,bold}
: ${HSMW_HIGHLIGHT_STYLES[newline]:=fg=black,bold} # '\n' strings
: ${HSMW_HIGHLIGHT_STYLES[variable]:=none}
typeset -gA __HSMW_HIGHLIGHT_TOKENS_TYPES
@ -527,6 +528,9 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
-hsmw-highlight-dollar-string
already_added=1
;;
\$[^\(]*)
style=variable
;;
'`'*) style=back-quoted-argument;;
[*?]*|*[^\\][*?]*)
(( highlight_glob )) && style=globbing || style=default;;