C/C++ highlighting added

This commit is contained in:
Mal 2022-06-06 00:35:53 +02:00
parent ae79b9f568
commit b277d9f3b4
1 changed files with 77 additions and 0 deletions

77
cpp.nanorc Normal file
View File

@ -0,0 +1,77 @@
#
# MONOKAI like theme for C++
#
# 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 javascript "\.(cpp|hpp|c|h)$"
comment "//"
color white ".*"
# Function or method calls
color cyan "\w+\("
# Function/method names on definitions
color green "@\w+"
color green "^[[:blank:]]+(\w+ )?\w+\(.*(\)| \{)$"
color white "^[[:blank:]]+[a-zA-Z_0-9]+ "
# Parameters inside method definitions
color orange "\([a-zA-Z_0-9,= '#:&]+\)( *\{|$)"
color white " \([a-zA-Z_0-9,= :&]+\)( *\{|$)"
# Re-whitening parameter types
color white "(\(|, )[a-zA-Z:]+ "
# Static method calls
color cyan "(^|[[:blank:]]|,|\(|=|\||&)[a-zA-Z_0-9]+::"
color white "::[a-zA-Z_0-9]+(::|$)"
# Statements
color brightcyan "\<(class|struct|from|new|const|return|for|while|if|elseif|else|throw|continue|break|try|catch|switch|case|static|do)\>"
# Special statements
color cyan "(public:|protected:|private:)"
# Special values
color magenta "\<(true|false|null)\>"
# Number values
color brightmagenta "[^a-zA-Z]([0-9]|[0-9]+\.?[0-9]+)[^a-zA-Z]"
# "this" statement
color brightmagenta "(^|[[:blank:]]|\()this"
# Re-whitening certain symbols
color white "(\(|\)|,|\.|\{|\}|;)"
# Fixing re-whited . inside number
color brightmagenta "[0-9]+\.[0-9]+"
# Operators
color red "(=|·|\/|\+|-|\*|\!|>|<|:|\?|&|\||%)"
# Template type definition
color white "<[a-zA-Z0-9]+>"
# Types
color brightcyan "\<(int|void|float|double|long|short|unsigned|bool|char)\>"
# Strings
color yellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'|`([^`\]|\\.)*`"
# Comments
color grey "(^|[[:blank:]])//.*"
color grey start="/\*" end="\*/"
# Redundant spaces
color ,brightred "[[:space:]]+$"
# Preprocessor statements
color yellow "^#\w+ <[a-zA-Z\./]+>"
color brightmagenta "^#\w+"