mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-02-13 10:05:31 +08:00
handle tilde
Signed-off-by: Takeshi Banse <takebi@laafc.net>
This commit is contained in:
parent
d794de7281
commit
5b3d18ef36
@ -139,11 +139,22 @@ _zsh_highlight_main_highlighter_check_path()
|
|||||||
local arg="$1"
|
local arg="$1"
|
||||||
[[ -z ${(Q)arg} ]] && return 1
|
[[ -z ${(Q)arg} ]] && return 1
|
||||||
[[ -e ${(Q)arg} ]] && return 0
|
[[ -e ${(Q)arg} ]] && return 0
|
||||||
|
[[ "${arg[1]-}" == \~ ]] && { _zsh_highlight_main_highlighter_check_path_tilde "${arg}" ; return $? }
|
||||||
[[ ! -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_zsh_highlight_main_highlighter_check_path_tilde() {
|
||||||
|
local head="${1[2,-1]%%/*}"
|
||||||
|
local tail="${1[((2+1+$#head)),-1]}"
|
||||||
|
local name=
|
||||||
|
eval "name=~$head/" 2>/dev/null || return 1
|
||||||
|
[[ -z "$name" ]] && return 1
|
||||||
|
[[ "$name" == "~$head/" ]] && return 1
|
||||||
|
_zsh_highlight_main_highlighter_check_path "${name}${tail}"; return $?
|
||||||
|
}
|
||||||
|
|
||||||
# Highlight special chars inside double-quoted strings
|
# Highlight special chars inside double-quoted strings
|
||||||
_zsh_highlight_main_highlighter_highlight_string()
|
_zsh_highlight_main_highlighter_highlight_string()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user