From 44b89f330755342658abf1ad68c2efb3983dd214 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 23 Oct 2018 16:36:14 +0000 Subject: [PATCH] main: Fold '!' handling in to the 'case'. No functional change. --- highlighters/main/main-highlighter.zsh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 26d8759..f553dbb 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -689,11 +689,7 @@ _zsh_highlight_main_highlighter_highlight_list() case $res in reserved) # reserved word style=reserved-word - if [[ $arg == '!' && $this_word != *':start_of_pipeline:'* ]]; then - style=unknown-token - fi - # - # Match braces. + # Match braces and handle special cases. case $arg in ($'\x7b') braces_stack='Y'"$braces_stack" @@ -754,6 +750,14 @@ _zsh_highlight_main_highlighter_highlight_list() # # The repeat-count word will be handled like a redirection target. this_word=':start::regular:' + ;; + ('!') + if [[ $this_word != *':start_of_pipeline:'* ]]; then + style=unknown-token + else + # '!' reserved word at start of pipeline; style already set above + fi + ;; esac ;; 'suffix alias') style=suffix-alias;;