diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index e97b8b8..2f4c925 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -986,10 +986,12 @@ _zsh_highlight_main_highlighter_check_path() [[ -e $expanded_path ]] && return 0 # Search the path in CDPATH - local cdpath_dir - for cdpath_dir in $cdpath ; do - [[ -e "$cdpath_dir/$expanded_path" ]] && return 0 - done + if [[ $expanded_path != /* ]]; then + local cdpath_dir + for cdpath_dir in $cdpath ; do + [[ -e "$cdpath_dir/$expanded_path" ]] && return 0 + done + fi # If dirname($1) doesn't exist, neither does $1. [[ ! -d ${expanded_path:h} ]] && return 1 diff --git a/highlighters/main/test-data/cdpath-abspath.zsh b/highlighters/main/test-data/cdpath-abspath.zsh index 1913e46..64707b2 100644 --- a/highlighters/main/test-data/cdpath-abspath.zsh +++ b/highlighters/main/test-data/cdpath-abspath.zsh @@ -34,5 +34,5 @@ mkdir foo foo/bar BUFFER="/foo" expected_region_highlight=( - '1 4 unknown-token "fixed in the next commit"' # x (/) + '1 4 unknown-token' # x (/) )