Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/etc/nano/rust.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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"

# function definition
color magenta "fn [a-z0-9_]+"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions names are allowed to include A-Z too.


# Reserved words
color yellow "\<(abstract|alignof|as|be|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 "//.*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(FWIW, aren't comments normally green? :) )


# Attributes
color magenta start="#!\[" end="\]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ! is optional.


# Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"