diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ae9baa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +args.nanorc +tgn.nanorc diff --git a/nanorc b/nanorc index bdbff80..e363aa7 100644 --- a/nanorc +++ b/nanorc @@ -58,6 +58,7 @@ include ~/.nano/sed.nanorc include ~/.nano/sh.nanorc include ~/.nano/sql.nanorc include ~/.nano/systemd.nanorc +include ~/.nano/tcl.nanorc include ~/.nano/tex.nanorc include ~/.nano/vala.nanorc include ~/.nano/vi.nanorc @@ -65,4 +66,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/nanorc.nanorc b/nanorc.nanorc index 1eb940f..1aa85e0 100644 --- a/nanorc.nanorc +++ b/nanorc.nanorc @@ -5,7 +5,7 @@ syntax "nanorc" "\.?nanorc$" icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$" ## Keywords icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>" -icolor green "^[[:space:]]*(set|unset|include|syntax)\>" +icolor green "^[[:space:]]*(set|unset|include|syntax|header)\>" ## Colors icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)=" diff --git a/perl.nanorc b/perl.nanorc index 7bca4cd..9a96528 100644 --- a/perl.nanorc +++ b/perl.nanorc @@ -1,6 +1,8 @@ ## Here is an example for Perl. ## syntax "perl" "\.p[lm]$" +header "^#!.*/(env +)?perl( |$)" + color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>" color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>" icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)" diff --git a/python.nanorc b/python.nanorc index d76ab53..b1ccf49 100644 --- a/python.nanorc +++ b/python.nanorc @@ -1,35 +1,48 @@ ## Here is an example for Python. ## syntax "python" "\.py$" -icolor brightred "def [0-9A-Z_]+" +header "^#!.*/(env +)?python( |$)" +## built-in objects +color cyan "\<(None|self)\>" +## built-in attributes +color cyan "\<(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\>" +## built-in functions +color cyan "\<(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|extend|fileno|filter|float|flush|get|getattr|globals|has_key|hasattr|hash|hex|id|index|input|insert|int|intern|isatty|isinstance|issubclass|items|keys|len|list|locals|long|map|max|min|mode|name|oct|open|ord|pop|pow|range|raw_input|read|readline|readlines|reduce|reload|remove|repr|reverse|round|seek|setattr|slice|softspace|sort|str|tell|truncate|tuple|type|unichr|unicode|update|values|vars|write|writelines|xrange|zip)\>" +## special method names +color cyan "\<(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\>" +## exception classes +# color cyan "\<(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\>" +## types +color brightcyan "\<(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\>" +## definitions +color brightcyan "def [a-zA-Z_0-9]+" +## keywords +color brightblue "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|with|while|yield)\>" - -#Keyword Color -color green "\<(and|as|assert|class|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|try|while|with|yield)\>" -color brightmagenta "\<(continue|break|return)\>" - -# decorator color +## decorators color brightgreen "@.*[(]" -#Operator Color -color yellow "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" +## operators +color magenta "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" -#Parenthetical Color +## parentheses color magenta "[(){}]" "\[" "\]" -#String Color -color cyan "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}" -color cyan "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}" +## numbers +color brightyellow "\b[0-9]+\b" -color cyan start=""""[^"]" end=""""" start="'''[^']" end="'''" +## strings +color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}" +color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}" + +## comments +color green "#.*$" + +## block comments +color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''" #color cyan start=""""[^"]" end=""""" start="'''[^']" end="'''" #color cyan start="([[:space:]]"""|^""")" end=""""" start="'''[^']" end="'''" #color cyan start=""""" end=""""" start="'''" end="'''" #color cyan start="("""[^"]|[^"]""")" end="("""[^"]|[^"]""")" start="'''[^']" end="'''" #color cyan start="\"\"\"" end="\"\"\"" - - -#Comment Color -color brightblue "#.*$" - diff --git a/ruby.nanorc b/ruby.nanorc index 830dac6..36cadf8 100644 --- a/ruby.nanorc +++ b/ruby.nanorc @@ -1,6 +1,8 @@ ## Here is an example for Ruby. ## syntax "ruby" "\.rb$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile" +header "^#!.*/(env +)?ruby( |$)" + ## Asciibetical list of reserved words color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>" ## Constants diff --git a/sh.nanorc b/sh.nanorc index d0552bc..abf6619 100644 --- a/sh.nanorc +++ b/sh.nanorc @@ -1,14 +1,15 @@ ## Here is an example for Bourne shell scripts. ## syntax "sh" "\.sh$" "\.bashrc" "bashrc" "\.bash_aliases" "bash_aliases" "\.bash_functions" "bash_functions" "\.bash_profile" "bash_profile" -header "^#!.*/(ba)?sh" -icolor brightgreen "^[0-9A-Z_]+\(\)" +header "^#!.*/(env +)?(ba)?sh( |$)" + 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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color green "-[Ldefgruwx]\>" color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>" +icolor brightgreen "^\s+?[0-9A-Z_]+\s+?\(\)" icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?" -color cyan "(^|[[:space:]])#.*$" color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" +color cyan "(^|[[:space:]])#.*$" #color ,green "[[:space:]]+$" diff --git a/tcl.nanorc b/tcl.nanorc new file mode 100644 index 0000000..2959512 --- /dev/null +++ b/tcl.nanorc @@ -0,0 +1,24 @@ +syntax "tcl" "\.tcl$" +header "^#!.*/(env +)?tclsh( |$)" + +## Standard Tcl [info commands] +color cyan "\<(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\>" +## Basic Tcl sub commands +color cyan "\<(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\>" +color cyan "\<(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\>" +## Extended TclX [info commands] +color cyan "\<(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\>" +## Function declaration +color brightblue "proc[[:space:]]" "(\{|\})" +## Syntax +color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)" +## Numbers +color brightyellow "\<[0-9]+(\.[0-9]+)?\>" +## Strings +color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" +## Variables +icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?" +## Comments +color magenta "(^|;)[[:space:]]*#.*" +## Trailing whitespace +color ,blue "[[:space:]]+$" diff --git a/tcsh.nanorc b/tcsh.nanorc new file mode 100644 index 0000000..91b3e54 --- /dev/null +++ b/tcsh.nanorc @@ -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:]]+$" 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:]]*##.*$"