basic (tc)csh syntax highlighting, copied from zsh.nanorc with minor changes so far

This commit is contained in:
MatthewCox 2014-07-28 14:44:29 +01:00
parent da49488006
commit 490d669e2f
2 changed files with 40 additions and 3 deletions

37
tcsh.nanorc Normal file
View File

@ -0,0 +1,37 @@
## Syntax highlighting for (T)CSH scripts (initially copied from sh.nanorc)
syntax "tcsh" "\.?t?csh[^\.]+?$"
header "^#!.*/(env +)?t?csh( |$)"
## Numbers
color brightyellow "\b[0-9]+\b"
## Conditionals and control flow
color green "\<(always|case|do|done|elif|else|endif|esac|exit|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)\>"
## CSH (needs trimming, mostly bash right now)
color brightblue "\<(alias|bindkey|builtin|cd|eval|exec|jobs|let|popd|pushd|set|setenv|source|typeset|umask|unset)\>"
## TCSH-specific
#color brightblue "\<()\>"
## Common linux commands
color brightmagenta "\<(cat|chmod|chown|cp|cut|echo|env|false|find|grep|head|install|kill|less|ln|make|mkdir|mv|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 brightyellow ""(\\.|[^"])*""
color brightyellow "'(\\.|[^'])*'"
## Comments
color cyan "(^|[[:space:]])#.*$"
color brightcyan "(^|[[:space:]])##.*$"
## Trailing spaces
color ,blue "[[:space:]]+$"

View File

@ -17,7 +17,7 @@ color brightblue "\<(alias|bindkey|builtin|cd|eval|exec|export|jobs|let|popd|pus
## ZSH-specific ## ZSH-specific
color brightblue "\<(add-zsh-hook|autoload|compinit|echotc|emulate|print|prompt(init)?|setopt|zle|zmodload|zstyle)\>" color brightblue "\<(add-zsh-hook|autoload|compinit|echotc|emulate|print|prompt(init)?|setopt|zle|zmodload|zstyle)\>"
## Common linux commands ## Common linux commands
color brightmagenta "\<(cat|chmod|chown|cp|cut|echo|env|false|find|grep|head|install|kill|less|ln|make|mkdir|mv|pwd|rm|rmdir|sed|tar|true|touch|uname|wc|whoami)\>" 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 ## Function definition
icolor brightgreen "^\s+?(function\s+)?[0-9A-Z_]+\s+?\(\)" icolor brightgreen "^\s+?(function\s+)?[0-9A-Z_]+\s+?\(\)"
@ -26,8 +26,8 @@ icolor brightgreen "^\s+?(function\s+)?[0-9A-Z_]+\s+?\(\)"
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?" icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
## Strings ## Strings
color brightyellow ""(\\.|[^"])*"" color yellow ""(\\.|[^"])*""
color brightyellow "'(\\.|[^'])*'" color yellow "'(\\.|[^'])*'"
## Comments ## Comments
color cyan "(^|[[:space:]])#.*$" color cyan "(^|[[:space:]])#.*$"