diff --git a/python.nanorc b/python.nanorc index 7bb0889..b1ccf49 100644 --- a/python.nanorc +++ b/python.nanorc @@ -2,35 +2,47 @@ ## syntax "python" "\.py$" header "^#!.*/(env +)?python( |$)" -icolor brightred "def [0-9A-Z_]+" +## 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/zsh.nanorc b/zsh.nanorc index d82b6c5..1d04f2b 100644 --- a/zsh.nanorc +++ b/zsh.nanorc @@ -3,7 +3,7 @@ syntax "zsh" "\.?zsh[^\.]+?$" header "^#!.*/(env +)?zsh( |$)" ## Numbers -color brightwhite "[0-9]+" +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)\>"