From fcf361745fa2dd2931595265a9f2e8837c2b0fb8 Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Fri, 14 Jun 2013 15:57:58 -0400 Subject: [PATCH] Add rules for assert, fail, and deriving to vim syntax file. Also highlight the mod path in "use module;" properly. --- src/etc/vim/syntax/rust.vim | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 5c08fdfecca..625424ac870 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -2,7 +2,7 @@ " Language: Rust " Maintainer: Patrick Walton " Maintainer: Ben Blum -" Last Change: 2012 Dec 25 +" Last Change: 2012 Jun 14 if version < 600 syntax clear @@ -13,13 +13,16 @@ endif syn keyword rustConditional match if else syn keyword rustOperator as +syn match rustAssert "\(); -syn match rustMacro '\w\(\w\)*!' -syn match rustMacro '#\w\(\w\)*' +syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail +syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained syn match rustFormat display "%%" contained syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat -syn region rustAttribute start="#\[" end="\]" contains=rustString +syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving +syn region rustDeriving start="deriving(" end=")" contains=rustTrait " Number literals syn match rustNumber display "\<[0-9][0-9_]*\>" @@ -143,11 +149,17 @@ hi def link rustMacro Macro hi def link rustType Type hi def link rustTodo Todo hi def link rustAttribute PreProc +hi def link rustDeriving PreProc hi def link rustStorage StorageClass hi def link rustLifetime Special " Other Suggestions: +" hi rustAttribute ctermfg=cyan +" hi rustDeriving ctermfg=cyan +" hi rustAssert ctermfg=yellow +" hi rustFail ctermfg=red " hi rustMacro ctermfg=magenta +" hi rustModPathSep ctermfg=grey syn sync minlines=200 syn sync maxlines=500