diff --git a/highlighters/main/README.md b/highlighters/main/README.md index df0c195..4de2c15 100644 --- a/highlighters/main/README.md +++ b/highlighters/main/README.md @@ -25,6 +25,7 @@ This highlighter defines the following styles: * `unknown-token` - unknown tokens / errors * `reserved-word` - shell reserved words * `alias` - aliases +* `suffix-alias` - suffix aliases (requires zsh 5.1.1 or newer) * `builtin` - shell builtin commands * `function` - functions * `command` - commands diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 0841989..6e7cbe5 100755 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -34,6 +34,7 @@ : ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold} : ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow} : ${ZSH_HIGHLIGHT_STYLES[alias]:=fg=green} +: ${ZSH_HIGHLIGHT_STYLES[suffix-alias]:=fg=green} : ${ZSH_HIGHLIGHT_STYLES[builtin]:=fg=green} : ${ZSH_HIGHLIGHT_STYLES[function]:=fg=green} : ${ZSH_HIGHLIGHT_STYLES[command]:=fg=green} @@ -150,6 +151,9 @@ _zsh_highlight_main_highlighter() local res="$(LC_ALL=C builtin type -w $arg 2>/dev/null)" case $res in *': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; + *': suffix alias') + style=$ZSH_HIGHLIGHT_STYLES[suffix-alias] + ;; *': alias') style=$ZSH_HIGHLIGHT_STYLES[alias] local aliased_command="${"$(alias -- $arg)"#*=}" [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg)