make .zsh* highlighting significantly better (started from sh)

This commit is contained in:
MatthewCox 2014-07-15 16:58:12 +01:00
parent a376424640
commit dcd55cddbd
3 changed files with 32 additions and 15 deletions

2
nanorc
View File

@ -64,4 +64,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

31
zsh.nanorc Normal file
View File

@ -0,0 +1,31 @@
## Syntax highlighting for zsh scripts (initially copied from sh.nanorc)
syntax "zsh" "\.zsh[^\.]+?$"
header "^#!.*/zsh"
## Function definition
icolor brightgreen "^[0-9A-Z_]+\(\)"
## Conditionals and control flow
color green "\<(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 / common linux commands
color brightblue "\<(alias|bindkey|cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|source|tar|touch|umask|unset)\>"
## zsh-specific
color brightblue "\<(autoload|compinit|prompt(init)?|setopt|zmodload|zstyle)\>"
## Variables
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
## Comments
color cyan "(^|[[:space:]])#.*$"
## Strings
color brightyellow ""(\\.|[^"])*""
color brightyellow "'(\\.|[^'])*'"
## Trailing spaces
#color ,green "[[:space:]]+$"

View File

@ -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:]]*##.*$"