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 @@ -750,9 +750,17 @@ _zsh_highlight_main_highlighter_highlight_list()
750
750
style=commandseparator
751
751
elif [[ $this_word == * ' :start:' * ]] && [[ $arg == $' \n ' ]]; then
752
752
style=commandseparator
753
+ elif [[ $this_word == * ' :start:' * ]] && [[ $arg == ' ;' ]] && (( in_alias )) ; then
754
+ style=commandseparator
753
755
else
754
- # This highlights empty commands (semicolon follows nothing) as an error.
755
- # Zsh accepts them, though.
756
+ # Empty commands (semicolon follows nothing) are valid syntax.
757
+ # However, in interactive use they are likely to be erroneous;
758
+ # therefore, we highlight them as errors.
759
+ #
760
+ # Alias definitions are exempted from this check to allow multiline aliases
761
+ # with explicit (redundant) semicolons: «alias foo=$'bar;\nbaz'» (issue #677).
762
+ #
763
+ # See also #691 about possibly changing the style used here.
756
764
style=unknown-token
757
765
fi
758
766
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