nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 790f98560b4f1aaf548536f2ea2b472300c53739
parent d718ed4fc3130f16550cbd2628e71e8769febf2c
Author: Benjamin Mintz <bmintz@protonmail.com>
Date:   Tue, 18 Sep 2018 20:21:00 +0000

syntax: python: do not highlight 'print' and 'exec' in Python 3

Assume that 'print' and 'exec' are statements when they are followed
by whitespace, and are functions otherwise.  This does not highlight
"print'x'" nor "print{x}", but these statements are poor style.

Signed-off-by: Benjamin Mintz <bmintz@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>

Diffstat:
Msyntax/python.nanorc | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/syntax/python.nanorc b/syntax/python.nanorc @@ -10,9 +10,14 @@ comment "#" icolor brightblue "def [0-9A-Z_]+" # Keywords. color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>" -color brightcyan "\<(def|del|elif|else|except|exec|finally|for|from)\>" +color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>" color brightcyan "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>" -color brightcyan "\<(pass|print|raise|return|try|while|with|yield)\>" +color brightcyan "\<(pass|raise|return|try|while|with|yield)\>" + +# These two are keywords in Python 2, but functions in Python 3, +# so only color them when they are followed by whitespace, assuming +# that print(x) is a function invocation and print (x) is a statement. +color brightcyan "\<(exec|print)([[:blank:]]|$)" # Special values. color brightmagenta "\<(False|None|True)\>"