Matthew Marshall avatar Matthew Marshall committed 3d01696

Add files for rust.

Comments (0)

Files changed (3)

ftdetect/rust.vim

+au BufRead,BufNewFile *.rs    set filetype=rust
+" Vim indent file
+
+if exists("b:did_indent")
+	finish
+endif
+
+let b:did_indent = 1
+setlocal cindent
+setlocal cinkeys-=0#
+setlocal cino=j1,J1
+" Vim syntax file
+" Language:     Rust
+" Maintainer:   Patrick Walton <pcwalton@mozilla.com>
+" Last Change:  2010 Oct 13
+
+" Quit when a syntax file was already loaded
+if !exists("main_syntax")
+  if version < 600
+    syntax clear
+  elseif exists("b:current_syntax")
+    finish
+  endif
+  " we define it here so that included files can test for it
+  let main_syntax='rust'
+endif
+
+syn keyword   rustKeyword     alt as assert be bind break
+syn keyword   rustKeyword     check claim cont const copy do else enum export fail
+syn keyword   rustKeyword     fn for if iface impl import in inline lambda let log
+syn keyword   rustKeyword     loop mod mut mutable native note of prove pure
+syn keyword   rustKeyword     resource ret self syntax to type unchecked
+syn keyword   rustKeyword     unsafe use while with
+
+" Reserved words
+syn keyword   rustKeyword     m32 m64 m128 f80 f16 f128 class trait
+
+syn keyword   rustType        any int uint float char bool u8 u16 u32 u64 f32
+syn keyword   rustType        f64 i8 i16 i32 i64 str
+
+syn keyword   rustBoolean     true false
+
+syn match     rustItemPath    "\(\w\|::\)\+"
+
+syn region	  rustString      start=+L\="+ skip=+\\\\\|\\"+ end=+"+
+
+"integer number, or floating point number without a dot and with "f".
+syn case ignore
+syn match	  rustNumber		display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
+"hex number
+syn match	  rustNumber		display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
+syn match	rustFloat		display contained "\d\+f"
+"floating point number, with dot, optional exponent
+syn match	rustFloat		display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
+"floating point number, starting with a dot, optional exponent
+syn match	rustFloat		display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
+"floating point number, without dot, with exponent
+syn match	rustFloat		display contained "\d\+e[-+]\=\d\+[fl]\=\>"
+
+syn case match
+
+syn match   rustCharacter   "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"
+
+syn region    rustComment     start="/\*" end="\*/" contains=rustComment
+syn region    rustComment     start="//" skip="\\$" end="$" keepend
+
+hi def link rustString        String
+hi def link rustCharacter     Character
+hi def link rustNumber        Number
+hi def link rustBoolean       Boolean
+hi def link rustFloat         Float
+hi def link rustKeyword       Keyword
+hi def link rustComment       Comment
+hi def link rustMacro         Macro
+hi def link rustType          Type
+
+syn sync minlines=200
+syn sync maxlines=500
+
+let b:current_syntax = "rust"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.