nano-syntax-highlighting/python.nanorc

56 lines
1.4 KiB
Plaintext
Raw Normal View History

#
# MONOKAI like theme for python as used in the PyCharm IDE
#
# This theme uses extended colors of the gnome terminal. The standard command line
# may not reproduce the desired colors!
#
# A default gnome terminal theme could have unintended effects of the theme colors
# as well. Please use the default one!
2022-05-21 22:21:28 +02:00
syntax python "\.py$"
header "^#!.*python"
magic "Python script"
comment "#"
color white ".*"
# Function or method calls
color cyan "\w+\("
# Parameters inside method or function definitions.
color orange "def \w+\(.*\)( *-> *\w+){0,1}:"
# Function/method names on definitions
color green "def \w+\("
color green "@\w+"
# Statements
color brightcyan "\<(class|def|import|from|return|for|while|global|in|if|elif|else|raise|is|not|and|or|with|continue|break|try|except|finally|pass|yield)\>"
# Parameter type definitions
color white ": *[a-zA-Z_.]+ *(,|\)|= *\w*)"
# Return type definitions
color white "-> *\w+:"
# Operators
color red "(=|·|\/|\+|-|\*|\!|>|<|:)"
color cyan "\<(True|False|None)\>"
color white "(\(|\)|,|\.|->)"
# Number values
color brightmagenta "([0-9]|[0-9]+\.[0-9]+|self)"
# Strings
color yellow "'([^'\]|\\.)*'|"([^"\]|\\.)*"|'''|""""
# Comments
color grey "(^|[[:blank:]])#.*"
color grey start="'''([^'),]|$)" end="(^|[^(\])'''"
color grey start=""""([^"),]|$)" end="(^|[^(\])""""
# Redundant spaces
color brightred,brightred "[[:space:]]+$"