This commit is contained in:
Daniel Shahaf 2016-03-30 08:16:41 +00:00
commit 4d2b311b4c
3 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ This highlighter defines the following styles:
* `precommand` - precommand modifiers (e.g., `noglob`, `builtin`)
* `commandseparator` - command separation tokens (`;`, `&&`)
* `hashed-command` - hashed commands
* `command-being-typed` - prefix of a command/function/alias that isn't one itself (e.g., `sourc`, `ifconfi`)
* `path` - existing filenames
* `path_prefix` - prefixes of existing filenames
* `globbing` - globbing expressions (`*.txt`)

View File

@ -40,6 +40,7 @@
: ${ZSH_HIGHLIGHT_STYLES[precommand]:=fg=green,underline}
: ${ZSH_HIGHLIGHT_STYLES[commandseparator]:=none}
: ${ZSH_HIGHLIGHT_STYLES[hashed-command]:=fg=green}
: ${ZSH_HIGHLIGHT_STYLES[command-being-typed]:=fg=yellow,underline}
: ${ZSH_HIGHLIGHT_STYLES[path]:=underline}
: ${ZSH_HIGHLIGHT_STYLES[path_prefix]:=underline}
: ${ZSH_HIGHLIGHT_STYLES[globbing]:=fg=blue}
@ -380,6 +381,8 @@ _zsh_highlight_main_highlighter()
else
if _zsh_highlight_main_highlighter_check_path; then
style=$ZSH_HIGHLIGHT_STYLES[path]
elif (( ${#BUFFER} == $end_pos )); then
style=$ZSH_HIGHLIGHT_STYLES[command-being-typed]
else
style=$ZSH_HIGHLIGHT_STYLES[unknown-token]
fi

View File

@ -27,8 +27,10 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
BUFFER='azertyuiop'
# Do not append to the BUFFER; the second instance tests an "at end of BUFFER" feature.
BUFFER='azertyuiop; azertyuiop'
expected_region_highlight=(
"1 10 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # azertyuiop
"13 22 $ZSH_HIGHLIGHT_STYLES[command-being-typed]" # azertyuiop, at end of buffer
)