parent
a0b5bc6c71
commit
9310d8ae71
|
@ -25,6 +25,7 @@ This highlighter defines the following styles:
|
||||||
* `unknown-token` - unknown tokens / errors
|
* `unknown-token` - unknown tokens / errors
|
||||||
* `reserved-word` - shell reserved words
|
* `reserved-word` - shell reserved words
|
||||||
* `alias` - aliases
|
* `alias` - aliases
|
||||||
|
* `suffix-alias` - suffix aliases (requires zsh 5.1.1 or newer)
|
||||||
* `builtin` - shell builtin commands
|
* `builtin` - shell builtin commands
|
||||||
* `function` - functions
|
* `function` - functions
|
||||||
* `command` - commands
|
* `command` - commands
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold}
|
: ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold}
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow}
|
: ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow}
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[alias]:=fg=green}
|
: ${ZSH_HIGHLIGHT_STYLES[alias]:=fg=green}
|
||||||
|
: ${ZSH_HIGHLIGHT_STYLES[suffix-alias]:=fg=green}
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[builtin]:=fg=green}
|
: ${ZSH_HIGHLIGHT_STYLES[builtin]:=fg=green}
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[function]:=fg=green}
|
: ${ZSH_HIGHLIGHT_STYLES[function]:=fg=green}
|
||||||
: ${ZSH_HIGHLIGHT_STYLES[command]:=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)"
|
local res="$(LC_ALL=C builtin type -w $arg 2>/dev/null)"
|
||||||
case $res in
|
case $res in
|
||||||
*': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
|
*': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
|
||||||
|
*': suffix alias')
|
||||||
|
style=$ZSH_HIGHLIGHT_STYLES[suffix-alias]
|
||||||
|
;;
|
||||||
*': alias') style=$ZSH_HIGHLIGHT_STYLES[alias]
|
*': alias') style=$ZSH_HIGHLIGHT_STYLES[alias]
|
||||||
local aliased_command="${"$(alias -- $arg)"#*=}"
|
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)
|
[[ -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)
|
||||||
|
|
Loading…
Reference in New Issue