From 38fe5aa0709891551258ea8888d2c7bb781cdc49 Mon Sep 17 00:00:00 2001 From: klutzy Date: Sun, 7 Apr 2013 01:59:06 +0900 Subject: [PATCH 1/3] vim: disable nested comment Since comment nesting does not work from 0.4. --- src/etc/vim/syntax/rust.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 87f4059716b35..380b0f505c15e 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -110,7 +110,7 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9 syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'" -syn region rustComment start="/\*" end="\*/" contains=rustComment,rustTodo +syn region rustComment start="/\*" end="\*/" contains=rustTodo syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend syn keyword rustTodo contained TODO FIXME XXX NB From 7c2a8c4ac2c89a174fdcf4cc68e17e7639a913c6 Mon Sep 17 00:00:00 2001 From: klutzy Date: Sun, 7 Apr 2013 04:10:40 +0900 Subject: [PATCH 2/3] vim: add rustCommentDoc --- src/etc/vim/syntax/rust.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 380b0f505c15e..75858966c5577 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -110,8 +110,11 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9 syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'" -syn region rustComment start="/\*" end="\*/" contains=rustTodo -syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend +syn region rustCommentDoc start="/\*\*" end="\*/" +syn region rustCommentDoc start="///" skip="\\$" end="$" keepend +syn match rustComment "/\*\*/" +syn region rustComment start="/\*[^\*]" end="\*/" contains=rustTodo +syn region rustComment start="//[^/]" skip="\\$" end="$" contains=rustTodo keepend syn keyword rustTodo contained TODO FIXME XXX NB @@ -134,6 +137,7 @@ hi def link rustConditional Conditional hi def link rustIdentifier Identifier hi def link rustModPath Include hi def link rustFuncName Function +hi def link rustCommentDoc SpecialComment hi def link rustComment Comment hi def link rustMacro Macro hi def link rustType Type From fc26911b493eb151710e1a96578aad55596cfeb7 Mon Sep 17 00:00:00 2001 From: klutzy Date: Sun, 7 Apr 2013 14:21:00 +0900 Subject: [PATCH 3/3] vim: fix comment highlighting bug Previous commit had a bug that a line which ends with "//" or "/*" is not correctly highlighted. --- src/etc/vim/syntax/rust.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 75858966c5577..303cc0834e8ef 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -113,8 +113,8 @@ syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8 syn region rustCommentDoc start="/\*\*" end="\*/" syn region rustCommentDoc start="///" skip="\\$" end="$" keepend syn match rustComment "/\*\*/" -syn region rustComment start="/\*[^\*]" end="\*/" contains=rustTodo -syn region rustComment start="//[^/]" skip="\\$" end="$" contains=rustTodo keepend +syn region rustComment start="/\*\([^\*]\|$\)" end="\*/" contains=rustTodo +syn region rustComment start="//\([^/]\|$\)" skip="\\$" end="$" contains=rustTodo keepend syn keyword rustTodo contained TODO FIXME XXX NB