nano-syntax-highlighting/python.nanorc

59 lines
1.4 KiB
Plaintext

#
# 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!
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+"
# Import modules
color magenta "(import|from) \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 "'([^'\]|\\.)*'|"([^"\]|\\.)*"|'''|""""
color yellow start="'''([^'),]|$)" end="(^|[^(\])'''"
color yellow start=""""([^"),]|$)" end="(^|[^(\])""""
# Comments
color grey "(^|[[:blank:]])#.*"
# Redundant spaces
color brightred,brightred "[[:space:]]+$"