Issue 15: History expansion is highlighted as unknown token (partial fix, only covers common cases)
This commit is contained in:
parent
9f9e6c24c6
commit
d4a9baa4ae
|
@ -19,6 +19,7 @@ ZSH_SYNTAX_HIGHLIGHTING_STYLES=(
|
||||||
command 'fg=green'
|
command 'fg=green'
|
||||||
path 'underline'
|
path 'underline'
|
||||||
globbing 'fg=blue'
|
globbing 'fg=blue'
|
||||||
|
history-expansion 'fg=blue'
|
||||||
single-hyphen-option 'none'
|
single-hyphen-option 'none'
|
||||||
double-hyphen-option 'none'
|
double-hyphen-option 'none'
|
||||||
back-quoted-argument 'none'
|
back-quoted-argument 'none'
|
||||||
|
@ -166,7 +167,13 @@ _zsh_highlight-zle-buffer() {
|
||||||
*': builtin') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[builtin];;
|
*': builtin') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[builtin];;
|
||||||
*': function') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[function];;
|
*': function') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[function];;
|
||||||
*': command') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[command];;
|
*': command') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[command];;
|
||||||
*) _zsh_check-path && style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[path] || style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[unknown-token];;
|
*) if _zsh_check-path; then
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[path]
|
||||||
|
elif [[ ${arg:0:1} = ${histchars:0:1} ]]; then
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[history-expansion]
|
||||||
|
else
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[unknown-token]
|
||||||
|
fi;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
case $arg in
|
case $arg in
|
||||||
|
@ -180,7 +187,13 @@ _zsh_highlight-zle-buffer() {
|
||||||
;;
|
;;
|
||||||
'`'*'`') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[back-quoted-argument];;
|
'`'*'`') style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[back-quoted-argument];;
|
||||||
*"*"*) $highlight_glob && style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[globbing] || style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[default];;
|
*"*"*) $highlight_glob && style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[globbing] || style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[default];;
|
||||||
*) _zsh_check-path && style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[path] || style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[default];;
|
*) if _zsh_check-path; then
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[path]
|
||||||
|
elif [[ ${arg:0:1} = ${histchars:0:1} ]]; then
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[history-expansion]
|
||||||
|
else
|
||||||
|
style=$ZSH_SYNTAX_HIGHLIGHTING_STYLES[default]
|
||||||
|
fi;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
[[ $substr_color = 0 ]] && region_highlight+=("$start_pos $end_pos $style")
|
[[ $substr_color = 0 ]] && region_highlight+=("$start_pos $end_pos $style")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user