diff --git a/01_defaults.zsh b/01_defaults.zsh new file mode 100755 index 0000000..835151a --- /dev/null +++ b/01_defaults.zsh @@ -0,0 +1,102 @@ +#!/usr/bin/env zsh +# Copyleft 2010 zsh-syntax-highlighting contributors +# http://github.com/nicoulaj/zsh-syntax-highlighting +# All wrongs reserved. +# vim: ft=zsh sw=2 ts=2 et + +# Token types styles. +# See http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135 +typeset -A ZSH_SYNTAX_HIGHLIGHTING_STYLES +ZSH_SYNTAX_HIGHLIGHTING_STYLES=( + default 'none' + isearch 'fg=magenta,standout' + special 'fg=magenta,standout' + unknown-token 'fg=red,bold' + reserved-word 'fg=yellow' + alias 'fg=green' + builtin 'fg=green' + function 'fg=green' + command 'fg=green' + path 'underline' + globbing 'fg=blue' + single-hyphen-option 'none' + double-hyphen-option 'none' + back-quoted-argument 'none' + single-quoted-argument 'fg=yellow' + double-quoted-argument 'fg=yellow' + dollar-double-quoted-argument 'fg=cyan' + back-double-quoted-argument 'fg=cyan' +) + +# Tokens that are always followed by a command. +ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS=( + '|' + '||' + ';' + '&' + '&&' + 'sudo' + 'start' + 'time' + 'strace' + 'noglob' + 'command' + 'builtin' +) + +# ZLE events that trigger an update of the highlighting. +ZSH_HIGHLIGHT_ZLE_UPDATE_EVENTS=( + accept-and-hold + accept-and-infer-next-history + accept-line + accept-line-and-down-history + backward-delete-char + backward-delete-word + backward-kill-word + beginning-of-buffer-or-history + beginning-of-history + beginning-of-history + beginning-of-line-hist + complete-word + delete-char + delete-char-or-list + down-history + down-line-or-history + down-line-or-history + down-line-or-search + end-of-buffer-or-history + end-of-history + end-of-line-hist + expand-or-complete + expand-or-complete-prefix + history-beginning-search-backward + history-beginning-search-forward + history-incremental-search-backward + history-incremental-search-forward + history-search-backward + history-search-forward + infer-next-history + insert-last-word + kill-word + magic-space + quoted-insert + redo + self-insert + undo + up-history + up-line-or-history + up-line-or-history + up-line-or-search + up-line-or-search + vi-backward-kill-word + vi-down-line-or-history + vi-fetch-history + vi-history-search-backward + vi-history-search-forward + vi-quoted-insert + vi-repeat-search + vi-rev-repeat-search + vi-up-line-or-history + yank +) + diff --git a/02_overrides.zsh b/02_overrides.zsh new file mode 100755 index 0000000..93718b0 --- /dev/null +++ b/02_overrides.zsh @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh +# Copyleft 2010 zsh-syntax-highlighting contributors +# http://github.com/nicoulaj/zsh-syntax-highlighting +# All wrongs reserved. +# vim: ft=zsh sw=2 ts=2 et + +ZSH_SYNTAX_HIGHLIGHTING_STYLES[default]='fg=white,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[reserved-word]='fg=yellow,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[alias]='fg=magenta,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[builtin]='fg=cyan,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[function]='fg=blue,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[command]='fg=green,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[path]='fg=cyan' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[single-hyphen-option]='fg=yellow,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[double-hyphen-option]='fg=green,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[single-quoted-argument]='fg=magenta,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[double-quoted-argument]='fg=red,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[dollar-double-quoted-argument]='fg=red' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[back-quoted-argument]='fg=cyan,bold' +ZSH_SYNTAX_HIGHLIGHTING_STYLES[back-double-quoted-argument]='fg=magenta' diff --git a/zsh-syntax-highlighting.zsh b/10_core.zsh similarity index 64% rename from zsh-syntax-highlighting.zsh rename to 10_core.zsh index d4ab80e..cd432d2 100755 --- a/zsh-syntax-highlighting.zsh +++ b/10_core.zsh @@ -4,102 +4,6 @@ # All wrongs reserved. # vim: ft=zsh sw=2 ts=2 et -# Token types styles. -# See http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135 -typeset -A ZSH_SYNTAX_HIGHLIGHTING_STYLES -ZSH_SYNTAX_HIGHLIGHTING_STYLES=( - default 'none' - isearch 'fg=magenta,standout' - special 'fg=magenta,standout' - unknown-token 'fg=red,bold' - reserved-word 'fg=yellow' - alias 'fg=green' - builtin 'fg=green' - function 'fg=green' - command 'fg=green' - path 'underline' - globbing 'fg=blue' - single-hyphen-option 'none' - double-hyphen-option 'none' - back-quoted-argument 'none' - single-quoted-argument 'fg=yellow' - double-quoted-argument 'fg=yellow' - dollar-double-quoted-argument 'fg=cyan' - back-double-quoted-argument 'fg=cyan' -) - -# Tokens that are always followed by a command. -ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS=( - '|' - '||' - ';' - '&' - '&&' - 'sudo' - 'start' - 'time' - 'strace' - 'noglob' - 'command' - 'builtin' -) - -# ZLE events that trigger an update of the highlighting. -ZSH_HIGHLIGHT_ZLE_UPDATE_EVENTS=( - accept-and-hold - accept-and-infer-next-history - accept-line - accept-line-and-down-history - backward-delete-char - backward-delete-word - backward-kill-word - beginning-of-buffer-or-history - beginning-of-history - beginning-of-history - beginning-of-line-hist - complete-word - delete-char - delete-char-or-list - down-history - down-line-or-history - down-line-or-history - down-line-or-search - end-of-buffer-or-history - end-of-history - end-of-line-hist - expand-or-complete - expand-or-complete-prefix - history-beginning-search-backward - history-beginning-search-forward - history-incremental-search-backward - history-incremental-search-forward - history-search-backward - history-search-forward - infer-next-history - insert-last-word - kill-word - magic-space - quoted-insert - redo - self-insert - undo - up-history - up-line-or-history - up-line-or-history - up-line-or-search - up-line-or-search - vi-backward-kill-word - vi-down-line-or-history - vi-fetch-history - vi-history-search-backward - vi-history-search-forward - vi-quoted-insert - vi-repeat-search - vi-rev-repeat-search - vi-up-line-or-history - yank -) - # ZLE highlight types. zle_highlight=( special:$ZSH_SYNTAX_HIGHLIGHTING_STYLES[special] diff --git a/README.md b/README.md index f4085ef..3be8fc5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ zsh-syntax-highlighting ======================= +Fork of https://github.com/nicoulaj/zsh-syntax-highlighting for separate files with defaults overrides. + An attempt at providing [Fish shell](http://www.fishshell.org) like syntax highlighting for [Zsh](http://www.zsh.org). @@ -11,35 +13,21 @@ An attempt at providing [Fish shell](http://www.fishshell.org) like syntax highl Download the script or clone this repository: - git clone git://github.com/nicoulaj/zsh-syntax-highlighting.git + git clone git://github.com/paradoxxxzero/zsh-syntax-highlighting.git Update your `~/.zshrc` so that the script is sourced: - source /path/to/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + for file in /path/to/zsh-syntax-highlighting/*.zsh; + do + source $file + done + Re-open your terminal, or just reload it to take changes into account: source ~/.zshrc -### With [oh-my-zsh](http://github.com/robbyrussell/oh-my-zsh) - -Download the script or clone this repository as a oh-my-zsh plugin: - - cd ~/.oh-my-zsh/plugins/ - git clone git://github.com/nicoulaj/zsh-syntax-highlighting.git - cd zsh-syntax-highlighting - ln -s zsh-syntax-highlighting.zsh zsh-syntax-highlighting.plugin.zsh - -Update your `~/.zshrc` so that the script is sourced: - - plugins=(zsh-syntax-highlighting) - -Re-open your terminal, or just reload it to take changes into account: - - source ~/.zshrc - - ## References * [zsh-users mailing list thread](http://www.zsh.org/mla/users/2010/msg00692.html)