diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 5d4637b..45d13e2 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -1287,8 +1287,12 @@ _zsh_highlight_main_highlighter_highlight_argument() done if (( path_eligible )); then - if (( in_redirection )) && [[ $last_arg == *['<>']['&'] && $arg[$1,-1] == <0-> ]]; then - base_style=numeric-fd + if (( in_redirection )) && [[ $last_arg == *['<>']['&'] && $arg[$1,-1] == (<0->|p|-) ]]; then + if [[ $arg[$1,-1] == (p|-) ]]; then + base_style=redirection + else + base_style=numeric-fd + fi elif _zsh_highlight_main_highlighter_check_path $arg[$1,-1]; then base_style=$REPLY _zsh_highlight_main_highlighter_highlight_path_separators $base_style diff --git a/highlighters/main/test-data/redirection-special-cases.zsh b/highlighters/main/test-data/redirection-special-cases.zsh index d1348d5..733cf6b 100644 --- a/highlighters/main/test-data/redirection-special-cases.zsh +++ b/highlighters/main/test-data/redirection-special-cases.zsh @@ -35,10 +35,10 @@ BUFFER=$'cat <&p; exec {myfd}>&-' expected_region_highlight=( '1 3 command' # cat '5 6 redirection' # <& - '7 7 redirection "issue #645 (in part)"' # p + '7 7 redirection' # p '8 8 commandseparator' # ; '10 13 precommand' # exec '15 20 named-fd' # {myfd} '21 22 redirection' # >& - '23 23 redirection "issue #645 (in part)"' # - + '23 23 redirection' # - )