Skip to content

Commit 630b416

Browse files
committed
'main': When AUTO_CD is set, highlight directories in command position as commands.
1 parent e4088bc commit 630b416

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

highlighters/main/main-highlighter.zsh

+5-1
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,11 @@ _zsh_highlight_main_highlighter_check_path()
968968
local expanded_path="$REPLY" tmp_path
969969
integer in_command_position=$2
970970

971-
REPLY=path
971+
if (( in_command_position )); then
972+
REPLY=command
973+
else
974+
REPLY=path
975+
fi
972976

973977
[[ -z $expanded_path ]] && return 1
974978

highlighters/main/test-data/abspath-in-command-position3.zsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ setopt autocd
3232
BUFFER=$'/bin; /bin'
3333

3434
expected_region_highlight=(
35-
'1 4 path' # /bin (in middle)
35+
'1 4 command' # /bin (in middle)
3636
'5 5 commandseparator' # ;
37-
'7 10 path' # /bin (at end)
37+
'7 10 command' # /bin (at end)
3838
)

0 commit comments

Comments
 (0)