Skip to content

Commit

Permalink
Passable nano syntax highlighting
Browse files Browse the repository at this point in the history
rust.nanorc provides syntax highlighting for Rust. An attempt has been made to
make the syntax highlighting look good on both dark and light terminals.
Issue #21286.
  • Loading branch information
look committed Jan 17, 2015
1 parent 89c4e37 commit ac4baca
Showing 1 changed file with 35 additions and 0 deletions.
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_]+"

# 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 "//.*"

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

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

0 comments on commit ac4baca

Please sign in to comment.