mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
'main': Implement simple command type cache
This commit is contained in:
parent
12b879caf7
commit
957a8b4a44
2 changed files with 9 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue