File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -854,9 +854,17 @@ _zsh_highlight_main_highlighter_highlight_list()
854
854
style=commandseparator
855
855
elif [[ $this_word == * ' :start:' * ]] && [[ $arg == $' \n ' ]]; then
856
856
style=commandseparator
857
+ elif [[ $this_word == * ' :start:' * ]] && [[ $arg == ' ;' ]] && (( in_alias )) ; then
858
+ style=commandseparator
857
859
else
858
- # This highlights empty commands (semicolon follows nothing) as an error.
859
- # Zsh accepts them, though.
860
+ # Empty commands (semicolon follows nothing) are valid syntax.
861
+ # However, in interactive use they are likely to be erroneous;
862
+ # therefore, we highlight them as errors.
863
+ #
864
+ # Alias definitions are exempted from this check to allow multiline aliases
865
+ # with explicit (redundant) semicolons: «alias foo=$'bar;\nbaz'» (issue #677).
866
+ #
867
+ # See also #691 about possibly changing the style used here.
860
868
style=unknown-token
861
869
fi
862
870
Original file line number Diff line number Diff line change @@ -33,5 +33,5 @@ alias x=$'# foo\npwd'
33
33
BUFFER=' x'
34
34
35
35
expected_region_highlight=(
36
- ' 1 1 alias "issue #677" ' # x
36
+ ' 1 1 alias' # x
37
37
)
You can’t perform that action at this time.
0 commit comments