Prevent matching of command prefix if path is written explicitly. This solves issue that prefix '/l' matches '/bin//ls' (with two slashes what is valid syntax for zsh).

This commit is contained in:
jimmijj 2014-10-04 17:12:20 +00:00
parent f728546b74
commit 25b83ca8a9

View File

@ -290,6 +290,7 @@ _zsh_highlight_main_highlighter_check_command()
{
setopt localoptions nonomatch
local -a prefixed_command
[[ $arg != $arg:t ]] && return 1 # don't match anything if explicit path is present
for p in $path; do prefixed_command+=( $p/${arg}*(N) ); done
[[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1
}