From b7e6d9895e1daecf1c113e01186203025098b9a6 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 13 Oct 2010 10:43:19 -0700 Subject: [PATCH] First stab at a Vim syntax highlighter for Rust --- src/etc/rust.vim | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/etc/rust.vim diff --git a/src/etc/rust.vim b/src/etc/rust.vim new file mode 100644 index 00000000000..2a5a58b9042 --- /dev/null +++ b/src/etc/rust.vim @@ -0,0 +1,35 @@ +" Vim syntax file +" Language: Rust +" Maintainer: Patrick Walton +" 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 use meta syntax mutable native mod import export +syn keyword rustKeyword let auto io state unsafe auth with bind type true +syn keyword rustKeyword false any int uint float char bool u8 u16 u32 u64 +syn keyword rustKeyword f32 i8 i16 i32 i64 f64 rec tup tag vec str fn +syn keyword rustKeyword iter obj as drop task port chan flush spawn if +syn keyword rustKeyword else alt case in do while break cont fail log +syn keyword rustKeyword note claim check prove for each ret put be + +syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ + +syn region rustComment start="/\*" end="\*/" +syn region rustComment start="//" skip="\\$" end="$" keepend + +hi def link rustString String +hi def link rustKeyword Keyword +hi def link rustComment Comment + +let b:current_syntax = "rust" +