From 7e312f8d95216b17c56140a5e9222378799a81dc Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Wed, 14 Mar 2018 18:28:34 +0200 Subject: [PATCH 1/7] Enable highlighting of built-in Python classes --- python.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.nanorc b/python.nanorc index 29b9e3c..f1b27d3 100644 --- a/python.nanorc +++ b/python.nanorc @@ -12,7 +12,7 @@ color cyan "\<(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerc ## 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)\>" +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 From 0f2ad69b02e5eaa65a7a4e8ea12aeb2474acf15e Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Wed, 14 Mar 2018 18:29:17 +0200 Subject: [PATCH 2/7] Make Python quoted strings brown --- python.nanorc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python.nanorc b/python.nanorc index f1b27d3..5016a33 100644 --- a/python.nanorc +++ b/python.nanorc @@ -41,8 +41,9 @@ color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}" color green "#.*$" ## block comments -color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''" +#color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''" #color cyan start=""""[^"]" end=""""" start="'''[^']" end="'''" +color yellow start=""""[^"]" end=""""" start="'''[^']" end="'''" #color cyan start="([[:space:]]"""|^""")" end=""""" start="'''[^']" end="'''" #color cyan start=""""" end=""""" start="'''" end="'''" #color cyan start="("""[^"]|[^"]""")" end="("""[^"]|[^"]""")" start="'''[^']" end="'''" From be1c690ef1023706aaff94781c0607a59614d282 Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Wed, 14 Mar 2018 18:29:54 +0200 Subject: [PATCH 3/7] Add reminders to Python syntax --- python.nanorc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python.nanorc b/python.nanorc index 5016a33..d8b5584 100644 --- a/python.nanorc +++ b/python.nanorc @@ -51,3 +51,6 @@ color yellow start=""""[^"]" end=""""" start="'''[^']" end="'''" ## Trailing spaces color ,green "[[:space:]]+$" + +# reminders +color brightwhite,yellow "(FIXME|TODO|XXX)" From b364e4bf4d0d09ef73c427bfbebe5041638a773d Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Wed, 14 Mar 2018 18:34:58 +0200 Subject: [PATCH 4/7] Make Python comment rule more specific --- python.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.nanorc b/python.nanorc index d8b5584..e5cf6f3 100644 --- a/python.nanorc +++ b/python.nanorc @@ -38,7 +38,7 @@ color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}" color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}" ## comments -color green "#.*$" +color green "^#.*|[[:space:]]#.*$" ## block comments #color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''" From c3c19967171cdace5bb1bf310e38f274dc1a0fdd Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Sat, 17 Mar 2018 10:35:56 +0200 Subject: [PATCH 5/7] Python: Make numbers yellow instead of blue to make them easier to read --- python.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.nanorc b/python.nanorc index e5cf6f3..cc98ae2 100644 --- a/python.nanorc +++ b/python.nanorc @@ -30,7 +30,7 @@ color magenta "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" color magenta "[(){}]" "\[" "\]" ## numbers -icolor blue "\b(([1-9][0-9]+)|0+)\.[0-9]+j?\b" "\b([1-9][0-9]*[Lj]?)\b" "\b0o?[0-7]*L?\b" "\b0x[1-9a-f][0-9a-f]*L?\b" "\b0b[01]+\b" +icolor brightyellow "\b(([1-9][0-9]+)|0+)\.[0-9]+j?\b" "\b([1-9][0-9]*[Lj]?)\b" "\b0o?[0-7]*L?\b" "\b0x[1-9a-f][0-9a-f]*L?\b" "\b0b[01]+\b" ## strings From 4bf49a725a97b5a6d8796fa875d90ad4b6e0d0d1 Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Wed, 26 Dec 2018 18:59:10 +0200 Subject: [PATCH 6/7] Unify comments in Python file --- python.nanorc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python.nanorc b/python.nanorc index cc98ae2..f19e170 100644 --- a/python.nanorc +++ b/python.nanorc @@ -49,8 +49,8 @@ color yellow start=""""[^"]" end=""""" start="'''[^']" end="'''" #color cyan start="("""[^"]|[^"]""")" end="("""[^"]|[^"]""")" start="'''[^']" end="'''" #color cyan start="\"\"\"" end="\"\"\"" -## Trailing spaces +## trailing spaces color ,green "[[:space:]]+$" -# reminders +## reminders color brightwhite,yellow "(FIXME|TODO|XXX)" From 49c839cfea998b9520c2f822c12d0b3bd8bc0691 Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Fri, 4 Jan 2019 16:31:34 +0200 Subject: [PATCH 7/7] Remove dead code in Python definition --- python.nanorc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/python.nanorc b/python.nanorc index f19e170..d34d191 100644 --- a/python.nanorc +++ b/python.nanorc @@ -41,13 +41,7 @@ color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}" color green "^#.*|[[:space:]]#.*$" ## block comments -#color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''" -#color cyan start=""""[^"]" end=""""" start="'''[^']" end="'''" color yellow 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="\"\"\"" ## trailing spaces color ,green "[[:space:]]+$"