mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
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:
parent
f728546b74
commit
25b83ca8a9
1 changed files with 2 additions and 1 deletions
|
|
@ -290,6 +290,7 @@ _zsh_highlight_main_highlighter_check_command()
|
||||||
{
|
{
|
||||||
setopt localoptions nonomatch
|
setopt localoptions nonomatch
|
||||||
local -a prefixed_command
|
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
|
for p in $path; do prefixed_command+=( $p/${arg}*(N) ); done
|
||||||
[[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1
|
[[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue