@@ -58,6 +58,7 @@
|
||||
: ${ZSH_HIGHLIGHT_STYLES[assign]:=none}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[redirection]:=none}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[comment]:=fg=black,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[named-fd]:=none}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[arg0]:=fg=green}
|
||||
|
||||
# Whether the highlighter should be called or not.
|
||||
@@ -552,13 +553,19 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
|
||||
# Analyse the current word.
|
||||
if _zsh_highlight_main__is_redirection $arg ; then
|
||||
if (( in_redirection )); then
|
||||
if (( in_redirection && in_redirection != 2 )); then
|
||||
# The condition excludes the case that BUFFER='{foo}>&2' and we're on the '>&'.
|
||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token
|
||||
else
|
||||
in_redirection=2
|
||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos redirection
|
||||
fi
|
||||
continue
|
||||
elif [[ $arg == '{'*'}' ]] && _zsh_highlight_main__is_redirection $args[1]; then
|
||||
# named file descriptor: {foo}>&2
|
||||
in_redirection=3
|
||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos named-fd
|
||||
continue
|
||||
fi
|
||||
|
||||
# Expand parameters.
|
||||
@@ -864,7 +871,7 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
elif [[ $arg == $'\x5d' ]] && _zsh_highlight_main__stack_pop 'Q' builtin; then
|
||||
:
|
||||
else
|
||||
_zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 - in_redirection ))
|
||||
_zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 != in_redirection ))
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user