From 15f05dc581f4978c91113a0bce6ea2fdfc164ca0 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 29 Aug 2013 15:22:34 +1000 Subject: [PATCH] Modernise some Vim syntax highlighting. - Remove highlighting of ``L"..."`` (obsolete syntax) - Remove backslash at end of line being a line continuation always (obsolete syntax; this only affects comments, actually) - Add highlighting for backslash at end of line and leading whitespace on the following line inside a string (a genuine line continuation) --- src/etc/vim/syntax/rust.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index b5e529396359..6bf6946c7971 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -102,7 +102,8 @@ 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 match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/ -syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial +syn match rustStringContinuation display contained /\\\n\s*/ +syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait @@ -137,9 +138,9 @@ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit syn match rustCharacter /'\([^'\\]\|\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial syn region rustCommentML start="/\*" end="\*/" contains=rustTodo -syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend +syn region rustComment start="//" end="$" contains=rustTodo keepend syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo -syn region rustCommentDoc start="//[/!]" skip="\\$" end="$" contains=rustTodo keepend +syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend syn keyword rustTodo contained TODO FIXME XXX NB NOTE @@ -157,6 +158,7 @@ hi def link rustTrait rustType hi def link rustSigil StorageClass hi def link rustFormat Special hi def link rustSpecial Special +hi def link rustStringContinuation Special hi def link rustString String hi def link rustCharacter Character hi def link rustNumber Number