This commit is contained in:
m0vie 2016-05-13 18:35:30 +00:00
commit 33b3f42a3c
2 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,10 @@ _zsh_highlight_main_add_region_highlight() {
#
# The result will be stored in REPLY.
_zsh_highlight_main__type() {
REPLY=$_zsh_highlight_command_type_cache[(e)$1]
if [[ -n "$REPLY" ]]; then
return
fi
if (( $#options_to_set )); then
setopt localoptions $options_to_set;
fi
@ -113,6 +117,7 @@ _zsh_highlight_main__type() {
if ! (( $+REPLY )); then
REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)#*: }"
fi
_zsh_highlight_command_type_cache[(e)$1]=$REPLY
}
# Check whether the first argument is a redirection operator token.

View File

@ -322,6 +322,7 @@ _zsh_highlight_preexec_hook()
{
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=
_zsh_highlight_command_type_cache=()
}
autoload -U add-zsh-hook
add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
@ -333,3 +334,6 @@ zmodload zsh/parameter 2>/dev/null || true
# Initialize the array of active highlighters if needed.
[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) || true
# Initialize command type cache
typeset -A _zsh_highlight_command_type_cache