Skip to content

Instantly share code, notes, and snippets.

@Lokathor
Last active January 3, 2020 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lokathor/9b06f2c2460a8ac566b688aeb4ee3d69 to your computer and use it in GitHub Desktop.
Save Lokathor/9b06f2c2460a8ac566b688aeb4ee3d69 to your computer and use it in GitHub Desktop.
## An improved version of the "official" rust highlight file, Licensed GPL v3
syntax "rust" "\.rs"
comment "//"
# The order of these colorations is significant.
# Matches later down will re-color earlier matches.
# Thus, we place the most general matches first and allow them to be overriden later if necessary.
# Function definitions
color magenta "fn [a-zA-Z_0-9]+"
# Constants/Traits/Enums/Structs/Types/...
color magenta "[A-Z][A-Za-z0-9_]+"
# Reserved words
color yellow "\<(abstract|alignof|as|async|await|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)\>"
color brightred "\<(unsafe)\>"
# Operators
color yellow "&"
color white "&="
# Macros
color red "[a-zA-Z_]+!"
# Strings and Byte Strings
color green "b?\".*\""
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="\"#+"
# Characters and Bytes
color green "b?'\\?.'"
# Comments
color cyan "//.*"
color cyan start="/\*" end="\*/"
# Attributes
color brightmagenta start="#!?\[" end="\]"
# Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"
## Just general settings
set autoindent
set tabsize 2
set tabstospaces
set softwrap
set smarthome
set smooth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment