Fix #21: No highlighting when using tilde
This commit is contained in:
parent
d8fe211aed
commit
a6d105131c
|
@ -85,10 +85,10 @@ _zsh_highlight_main_highlighter()
|
||||||
*': function') style=$ZSH_HIGHLIGHT_STYLES[function];;
|
*': function') style=$ZSH_HIGHLIGHT_STYLES[function];;
|
||||||
*': command') style=$ZSH_HIGHLIGHT_STYLES[command];;
|
*': command') style=$ZSH_HIGHLIGHT_STYLES[command];;
|
||||||
*': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];;
|
*': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];;
|
||||||
*) if _zsh_highlight_main_highlighter_check_assign "$arg"; then
|
*) if _zsh_highlight_main_highlighter_check_assign; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[assign]
|
style=$ZSH_HIGHLIGHT_STYLES[assign]
|
||||||
new_expression=true
|
new_expression=true
|
||||||
elif _zsh_highlight_main_highlighter_check_path "$arg"; then
|
elif _zsh_highlight_main_highlighter_check_path; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[path]
|
style=$ZSH_HIGHLIGHT_STYLES[path]
|
||||||
elif [[ $arg[0,1] = $histchars[0,1] ]]; then
|
elif [[ $arg[0,1] = $histchars[0,1] ]]; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
|
style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
|
||||||
|
@ -109,7 +109,7 @@ _zsh_highlight_main_highlighter()
|
||||||
;;
|
;;
|
||||||
'`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];;
|
'`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];;
|
||||||
*"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];;
|
*"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];;
|
||||||
*) if _zsh_highlight_main_highlighter_check_path "$arg"; then
|
*) if _zsh_highlight_main_highlighter_check_path; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[path]
|
style=$ZSH_HIGHLIGHT_STYLES[path]
|
||||||
elif [[ $arg[0,1] = $histchars[0,1] ]]; then
|
elif [[ $arg[0,1] = $histchars[0,1] ]]; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
|
style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
|
||||||
|
@ -128,7 +128,6 @@ _zsh_highlight_main_highlighter()
|
||||||
# Check if the argument is variable assignment
|
# Check if the argument is variable assignment
|
||||||
_zsh_highlight_main_highlighter_check_assign()
|
_zsh_highlight_main_highlighter_check_assign()
|
||||||
{
|
{
|
||||||
local arg="$1"
|
|
||||||
setopt localoptions extended_glob
|
setopt localoptions extended_glob
|
||||||
[[ ${(Q)arg} == [[:alpha:]_]([[:alnum:]_])#=* ]]
|
[[ ${(Q)arg} == [[:alpha:]_]([[:alnum:]_])#=* ]]
|
||||||
}
|
}
|
||||||
|
@ -136,11 +135,10 @@ _zsh_highlight_main_highlighter_check_assign()
|
||||||
# Check if the argument is a path.
|
# Check if the argument is a path.
|
||||||
_zsh_highlight_main_highlighter_check_path()
|
_zsh_highlight_main_highlighter_check_path()
|
||||||
{
|
{
|
||||||
local arg="$1"
|
[[ -z ${(Q)~arg} ]] && return 1
|
||||||
[[ -z ${(Q)arg} ]] && return 1
|
[[ -e ${(Q)~arg} ]] && return 0
|
||||||
[[ -e ${(Q)arg} ]] && return 0
|
[[ ! -e ${(Q)~arg:h} ]] && return 1
|
||||||
[[ ! -e ${(Q)arg:h} ]] && return 1
|
[[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos && -n $(print ${(Q)~arg}*(N)) ]] && return 0
|
||||||
[[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos && -n $(print ${(Q)arg}*(N)) ]] && return 0
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue