From 12ffa71c17333c40d4dcfb7ed24f0d63c4e50e31 Mon Sep 17 00:00:00 2001 From: Andreas Jaggi Date: Sun, 26 Dec 2010 03:51:55 +0800 Subject: [PATCH 1/3] 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") From 5ba105efdbb3257be7adb9424a14d6f46d72a465 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 25 Dec 2010 22:03:27 +0100 Subject: [PATCH 2/3] Issue 2: Fix for those using option NO_UNSET (thanks to WayneD) --- README.md | 2 ++ zsh-syntax-highlighting.zsh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 136704c..9e626cb 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,5 @@ Just source the script from your `~/.zshrc`. * [Jonathan Dahan](http://github.com/jedahan) * James Ahlborn * [Andreas Jaggi](http://github.com/x-way) + * [Wayne Davison](http://github.com/WayneD) + diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 1d21e88..478c4e1 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -61,7 +61,7 @@ colorize-zle-buffer() { esac fi region_highlight+=("$start_pos $end_pos $style") - [[ ${${ZLE_TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]}:+yes} = 'yes' ]] && colorize=true + [[ ${${ZLE_TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]:-}:+yes} = 'yes' ]] && colorize=true start_pos=$end_pos done } From aafa7eaedb9acbb1ef91e68830714300954586c5 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 25 Dec 2010 22:10:50 +0100 Subject: [PATCH 3/3] Add "copy-pastable" installation instructions --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e626cb..b94aff5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,18 @@ An attempt at providing [Fish shell](http://www.fishshell.org) like syntax highl ## Usage -Just source the script from your `~/.zshrc`. +Download the script or clone this repository: + + git clone git://github.com/nicoulaj/zsh-syntax-highlighting.git + +Update your `~/.zshrc` so that the script is sourced: + + source /path/to/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +Re-open your terminal, or just reload it to take changes into account: + + source ~/.zshrc + ## References @@ -22,4 +33,3 @@ Just source the script from your `~/.zshrc`. * James Ahlborn * [Andreas Jaggi](http://github.com/x-way) * [Wayne Davison](http://github.com/WayneD) -