From be718873864a3a4427332832493ed154d09308c3 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 26 Dec 2010 16:48:58 -0800 Subject: [PATCH 1/2] Fix highlighting of external commands & simplify matching. --- zsh-syntax-highlighting.zsh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 160302f..62a2ba0 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -43,17 +43,20 @@ colorize-zle-buffer() { ((end_pos=$start_pos+${#arg})) if $colorize; then colorize=false - res=$(LC_ALL=C builtin type $arg 2>/dev/null) + res=$(LC_ALL=C builtin type -w $arg 2>/dev/null) case $res in - *'reserved word'*) style=$ZLE_RESERVED_WORD_STYLE;; - *'an alias'*) style=$ZLE_ALIAS_STYLE;; - *'shell builtin'*) style=$ZLE_BUILTIN_STYLE;; - *'shell function'*) style=$ZLE_FUNCTION_STYLE;; - *"${cmd:-no-command-specified} is"*) style=$ZLE_COMMAND_STYLE;; - *) - style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE - _check_path && style=$ZLE_PATH_STYLE - ;; + *': reserved') style=$ZLE_RESERVED_WORD_STYLE;; + *': alias') style=$ZLE_ALIAS_STYLE;; + *': builtin') style=$ZLE_BUILTIN_STYLE;; + *': function') style=$ZLE_FUNCTION_STYLE;; + *': command') style=$ZLE_COMMAND_STYLE;; + *) + if _check_path; then + style=$ZLE_PATH_STYLE + else + style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE + fi + ;; esac else case $arg in From d35af746030a09411e6061924af76f47396bca84 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 26 Dec 2010 17:08:46 -0800 Subject: [PATCH 2/2] More ZLE_TOKENS_FOLLOWED_BY_COMMANDS entries. --- zsh-syntax-highlighting.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 62a2ba0..04c8d29 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -22,7 +22,7 @@ ZLE_GLOBING='fg=blue,bold' ZLE_DEFAULT='fg=white,bold' -ZLE_TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'start' 'time' 'strace') +ZLE_TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'start' 'time' 'strace' 'noglob' 'command' 'builtin') _check_path() { [[ -z $arg ]] && return 1