From a98449b46636ff9fe7eb21b58cd9c22c1fdaafe9 Mon Sep 17 00:00:00 2001 From: Matthew Cox Date: Sat, 2 Aug 2014 23:12:13 +0100 Subject: [PATCH] significantly improved zsh* syntax highlighting (started from sh.nanorc) --- nanorc | 2 +- zsh.nanorc | 37 +++++++++++++++++++++++++++++++++++++ zshrc.nanorc | 14 -------------- 3 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 zsh.nanorc delete mode 100644 zshrc.nanorc diff --git a/nanorc b/nanorc index bdbff80..7bfefdf 100644 --- a/nanorc +++ b/nanorc @@ -65,4 +65,4 @@ include ~/.nano/xml.nanorc include ~/.nano/xresources.nanorc include ~/.nano/yaml.nanorc include ~/.nano/yum.nanorc -include ~/.nano/zshrc.nanorc +include ~/.nano/zsh.nanorc diff --git a/zsh.nanorc b/zsh.nanorc new file mode 100644 index 0000000..443c0a3 --- /dev/null +++ b/zsh.nanorc @@ -0,0 +1,37 @@ +## Syntax highlighting for ZSH scripts (initially copied from sh.nanorc) +syntax "zsh" "\.?zsh[^\.]+?$" +header "^#!.*/(env +)?zsh( |$)" + +## Numbers +color brightyellow "\b[0-9]+\b" + +## Conditionals and control flow +color green "\<(always|case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>" +color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" +## Conditional flags +color green "-[Ldefgruwx]\>" +color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" + +## Bash-inherited +color brightblue "\<(alias|bindkey|builtin|cd|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\>" +## ZSH-specific +color brightblue "\<(add-zsh-hook|autoload|compinit|echotc|emulate|print|prompt(init)?|setopt|zle|zmodload|zstyle)\>" +## Common linux commands +color brightmagenta "\<(cat|chmod|chown|cp|cut|echo|env|false|find|grep|head|install|kill|less|ln|make|mkdir|mv|nice|pwd|rm|rmdir|sed|tar|true|touch|uname|wc|whoami)\>" + +## Function definition +icolor brightgreen "^\s+?(function\s+)?[0-9A-Z_]+\s+?\(\)" + +## Variables +icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?" + +## Strings +color yellow ""(\\.|[^"])*"" +color yellow "'(\\.|[^'])*'" + +## Comments +color cyan "(^|[[:space:]])#.*$" +color brightcyan "(^|[[:space:]])##.*$" + +## Trailing spaces +color ,blue "[[:space:]]+$" diff --git a/zshrc.nanorc b/zshrc.nanorc deleted file mode 100644 index e5d4183..0000000 --- a/zshrc.nanorc +++ /dev/null @@ -1,14 +0,0 @@ -## Hightlightings for zsh configuration files (most used keywords) -syntax "zshrc" "\.?zshrc$" - -## Keywords -color red "\<(autoload|prompt(init)?|zstyle|zmodload|compinit|setopt|export|source)\>" -color magenta "\<(alias|bindkey|function)\>" - -## Strings -icolor white ""(\\.|[^"])*"" -icolor white "'(\\.|[^'])*'" - -## Comments -icolor brightblue "^[[:space:]]*#.*$" -icolor cyan "^[[:space:]]*##.*$"