Mercurial > repos > other > linux
changeset 88:93b29bcbc9e7
Tidy up Python colouring so it doesn't burn eyes
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 02 Apr 2018 16:56:31 +0100 |
parents | 7d8c0070471c |
children | a5810e6bed7e |
files | nanorc nanorc.d/python.nanorc |
diffstat | 2 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/nanorc Mon Apr 02 16:48:13 2018 +0100 +++ b/nanorc Mon Apr 02 16:56:31 2018 +0100 @@ -13,7 +13,7 @@ include "/usr/share/nano/perl.nanorc" ## Python -include "/usr/share/nano/python.nanorc" +include "~/.nanorc.d/python.nanorc" ## Ruby include "/usr/share/nano/ruby.nanorc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nanorc.d/python.nanorc Mon Apr 02 16:56:31 2018 +0100 @@ -0,0 +1,33 @@ +## Here is an example for Python. + +syntax python "\.py$" +header "^#!.*python[-0-9._]*" +magic "Python script" +linter pyflakes +comment "#" + +# Function definitions. +icolor brightblue "(def|class) [0-9A-Z_]+" +# Keywords. +color magenta "\<(and|as|assert|async|await|break|continue)\>" +color magenta "\<(del|elif|else|except|exec|finally|for|from)\>" +color magenta "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>" +color magenta "\<(pass|print|raise|return|try|while|with|yield)\>" + +# Single-quoted strings. +color yellow "'([^'\]|\\.)+'|''" +color yellow ""([^"\]|\\.)+"|""" +# Comments. +color green "(^|[[:blank:]])#.*$" +# Triple-quoted strings. +color green start="'''([^'),]|$)" end="(^|[^(\])'''" +color green start="\"\"\"([^"),]|$)" end="(^|[^(\])\"\"\"" + +# Special values. +color red "\<(False|None|True)\>" + +# Reminders. +color brightwhite,yellow "(FIXME|TODO|XXX)" + +# Trailing whitespace. +color ,green "[[:space:]]+$"