Mercurial > repos > other > linux
annotate nanorc.d/python.nanorc @ 93:411e0a1c4382
Hide warnings and solve cross-version compatibility
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 02 Apr 2018 19:21:36 +0100 |
parents | 5f2c5800fa8a |
children |
rev | line source |
---|---|
88
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 ## Here is an example for Python. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 |
92
5f2c5800fa8a
Fix small differences with older Nano on the server
IBBoard <dev@ibboard.co.uk>
parents:
88
diff
changeset
|
3 syntax "python" "\.py$" |
88
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 header "^#!.*python[-0-9._]*" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 magic "Python script" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 linter pyflakes |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 comment "#" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 # Function definitions. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 icolor brightblue "(def|class) [0-9A-Z_]+" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 # Keywords. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 color magenta "\<(and|as|assert|async|await|break|continue)\>" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 color magenta "\<(del|elif|else|except|exec|finally|for|from)\>" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 color magenta "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 color magenta "\<(pass|print|raise|return|try|while|with|yield)\>" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 # Single-quoted strings. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 color yellow "'([^'\]|\\.)+'|''" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 color yellow ""([^"\]|\\.)+"|""" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 # Comments. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 color green "(^|[[:blank:]])#.*$" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 # Triple-quoted strings. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 color green start="'''([^'),]|$)" end="(^|[^(\])'''" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 color green start="\"\"\"([^"),]|$)" end="(^|[^(\])\"\"\"" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 # Special values. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 color red "\<(False|None|True)\>" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 # Reminders. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 color brightwhite,yellow "(FIXME|TODO|XXX)" |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 # Trailing whitespace. |
93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 color ,green "[[:space:]]+$" |