From 2ff771eaa933f8b36e67f66feeb1a097a7f5b66a Mon Sep 17 00:00:00 2001 From: Andreas Jaggi Date: Sat, 25 Dec 2010 20:51:55 +0100 Subject: [PATCH] Underline existing paths --- README.md | 1 + zsh-syntax-highlighting.zsh | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f7bcfa..136704c 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,4 @@ Just source the script from your `~/.zshrc`. * [Mounier Florian](http://github.com/paradoxxxzero) * [Jonathan Dahan](http://github.com/jedahan) * James Ahlborn + * [Andreas Jaggi](http://github.com/x-way) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index f0ae62a..1d21e88 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -10,6 +10,7 @@ ZLE_ALIAS_STYLE='fg=magenta,bold' ZLE_BUILTIN_STYLE='fg=cyan,bold' ZLE_FUNCTION_STYLE='fg=blue,bold' ZLE_COMMAND_STYLE='fg=green,bold' +ZLE_PATH_STYLE='fg=white,underline' ZLE_COMMAND_UNKNOWN_TOKEN_STYLE='fg=red,bold' ZLE_HYPHEN_CLI_OPTION='fg=yellow,bold' @@ -40,7 +41,10 @@ colorize-zle-buffer() { *'shell builtin'*) style=$ZLE_BUILTIN_STYLE;; *'shell function'*) style=$ZLE_FUNCTION_STYLE;; *"$cmd is"*) style=$ZLE_COMMAND_STYLE;; - *) style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE;; + *) + style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE + [ -e "$arg" ] && style=$ZLE_PATH_STYLE + ;; esac else case $arg in @@ -50,7 +54,10 @@ colorize-zle-buffer() { '"'*'"') style=$ZLE_DOUBLE_QUOTED;; '`'*'`') style=$ZLE_BACK_QUOTED;; *"*"*) style=$ZLE_GLOBING;; - *) style=$ZLE_DEFAULT;; + *) + style=$ZLE_DEFAULT + [ -e "$arg" ] && style=$ZLE_PATH_STYLE + ;; esac fi region_highlight+=("$start_pos $end_pos $style")