From f713934f6c9d98a789def0346f2b575c985d84d0 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 1 Jan 2011 19:17:02 +0100 Subject: [PATCH] Fix issue with substrings extraction --- README.md | 6 +++--- zsh-syntax-highlighting.zsh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c764857..8f6970d 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Here is a one-liner to try it without installing or modifying anything: cd zsh-syntax-highlighting ln -s zsh-syntax-highlighting.zsh zsh-syntax-highlighting.plugin.zsh -* Activate the plugin in `~/.zshrc` +* Activate the plugin in `~/.zshrc`: plugins=(zsh-syntax-highlighting) @@ -49,9 +49,9 @@ Here is a one-liner to try it without installing or modifying anything: ## Tweak it -Optionally, you can override the default styles used for highlighting. The styles are declared in the [`ZSH_HIGHLIGHT_STYLES` array](https://github.com/nicoulaj/zsh-syntax-highlighting/blob/master/zsh-syntax-highlighting.zsh#L9). You can override styles this way: +Optionally, you can override the default styles used for highlighting. The styles are declared in the [`ZSH_HIGHLIGHT_STYLES`](https://github.com/nicoulaj/zsh-syntax-highlighting/blob/master/zsh-syntax-highlighting.zsh#L9) array. You can override styles this way: - # To differenciate aliases from other command types + # To differentiate aliases from other command types ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold' # To have paths colored instead of underlined diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 1f44fa9..4697f26 100755 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -168,7 +168,7 @@ _zsh_highlight-zle-buffer() { *': command') style=$ZSH_HIGHLIGHT_STYLES[command];; *) if _zsh_check-path; then style=$ZSH_HIGHLIGHT_STYLES[path] - elif [[ ${arg:0:1} = ${histchars:0:1} ]]; then + elif [[ $arg[0,1] = $histchars[0,1] ]]; then style=$ZSH_HIGHLIGHT_STYLES[history-expansion] else style=$ZSH_HIGHLIGHT_STYLES[unknown-token] @@ -188,7 +188,7 @@ _zsh_highlight-zle-buffer() { *"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];; *) if _zsh_check-path; then style=$ZSH_HIGHLIGHT_STYLES[path] - elif [[ ${arg:0:1} = ${histchars:0:1} ]]; then + elif [[ $arg[0,1] = $histchars[0,1] ]]; then style=$ZSH_HIGHLIGHT_STYLES[history-expansion] else style=$ZSH_HIGHLIGHT_STYLES[default]