zsh-syntax-highlighting.zsh, is generally defensive when invoking builtins. For example, alias is called using builtin alias. However, later aliases are restored without the builtin modifier.
This seems slightly inconsistent. In an environment where alias has been overridden, this might clear aliases and then fail to restore them.
Although alias -L is currently is exactly one alias command per line, this is not guaranteed by zsh. But if we can assume this output format (and it seems unlikely to ever change) then one could prepend builtin to each line. Example:
typeset zsh_highlight__aliases=(${(f)"$(builtin alias -Lm '[^+]*')"})
...
for __line in zsh_highlight__aliases; do
eval builtin "$__line"
done
builtin unset zsh_highlight__aliases __line
zsh-syntax-highlighting.zsh, is generally defensive when invoking builtins. For example,
aliasis called usingbuiltin alias. However, later aliases are restored without the builtin modifier.This seems slightly inconsistent. In an environment where
aliashas been overridden, this might clear aliases and then fail to restore them.Although
alias -Lis currently is exactly one alias command per line, this is not guaranteed by zsh. But if we can assume this output format (and it seems unlikely to ever change) then one could prependbuiltinto each line. Example: