# HG changeset patch # User IBBoard # Date 1522684591 -3600 # Node ID 93b29bcbc9e7de0b7ebe0decd76967cb64af0b1e # Parent 7d8c0070471cbedbad43addedd27f8fb0be0c323 Tidy up Python colouring so it doesn't burn eyes diff -r 7d8c0070471c -r 93b29bcbc9e7 nanorc --- 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" diff -r 7d8c0070471c -r 93b29bcbc9e7 nanorc.d/python.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:]]+$"