dotfiles-pub/common/nano/syntax/rust.nanorc

60 lines
1.7 KiB
Text

# Nano configuration for Rust
# Copyright 2015 The Rust Project Developers.
#
# NOTE: Rules are applied in order: later rules re-colorize matching text.
syntax "Rust" "\.rs"
comment "//"
# function definition
color magenta "fn [a-z0-9_]+"
# Reserved words
color yellow "\<(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
# macros
color red "[a-z_]+!"
# Constants
color magenta "[A-Z][A-Z_]+"
# Traits/Enums/Structs/Types/etc.
color magenta "[A-Z][a-z]+"
# Strings
color green "\".*\""
color green start="\".*\\$" end=".*\""
# NOTE: This isn't accurate but matching "#{0,} for the end of the string is too liberal
color green start="r#+\"" end="\"#+"
# Comments
color blue "^\s*//.*"
color blue start="^\s*/\*" end="\*/"
# Attributes
color magenta start="#!\[" end="\]"
# Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"
## Trailing spaces
color ,red "[[:space:]]+$"
# rainbow indent
color ,brightblack "^[[:space:]]{32}"
color ,black "^[[:space:]]{30}"
color ,brightblack "^[[:space:]]{28}"
color ,black "^[[:space:]]{26}"
color ,brightblack "^[[:space:]]{24}"
color ,black "^[[:space:]]{22}"
color ,brightblack "^[[:space:]]{20}"
color ,black "^[[:space:]]{18}"
color ,brightblack "^[[:space:]]{16}"
color ,black "^[[:space:]]{14}"
color ,brightblack "^[[:space:]]{12}"
color ,black "^[[:space:]]{10}"
color ,brightblack "^[[:space:]]{8}"
color ,black "^[[:space:]]{6}"
color ,brightblack "^[[:space:]]{4}"
color ,black "^[[:space:]]{2}"