File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,18 @@ _zsh_highlight_main__resolve_alias() {
273273 fi
274274}
275275
276+ # Return true iff $1 is a global alias
277+ _zsh_highlight_main__is_global_alias () {
278+ if zmodload -e zsh/parameter; then
279+ (( ${+galiases[$arg]} ))
280+ elif [[ $arg == ' =' * ]]; then
281+ # avoid running into «alias -L '=foo'» erroring out with 'bad assignment'
282+ return 1
283+ else
284+ alias -L -g -- " $1 " > /dev/null
285+ fi
286+ }
287+
276288# Check that the top of $braces_stack has the expected value. If it does, set
277289# the style according to $2; otherwise, set style=unknown-token.
278290#
@@ -1061,7 +1073,7 @@ _zsh_highlight_main_highlighter_highlight_list()
10611073 if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:# " $arg " } ]]; then
10621074 next_word=' :start::start_of_pipeline:'
10631075 fi
1064- elif _zsh_highlight_main__type " $arg " ; [[ $REPLY == ' global alias ' ]] ; then # $arg is a global alias that isn't in command position
1076+ elif _zsh_highlight_main__is_global_alias " $arg " ; then # $arg is a global alias that isn't in command position
10651077 style=global-alias
10661078 else # $arg is a non-command word
10671079 case $arg in
You can’t perform that action at this time.
0 commit comments