Skip to content

Commit d2e3133

Browse files
committed
Add @spell clusters to Vim syntax file
Add @spell clusters to Vim syntax highlighting file to do spell checking only inside comments and strings
1 parent 690e464 commit d2e3133

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/etc/vim/syntax/rust.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
55
" Maintainer: Chris Morgan <[email protected]>
6-
" Last Change: 2013 Dec 10
6+
" Last Change: 2014 Jan 4
77

88
if version < 600
99
syntax clear
@@ -148,8 +148,8 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
148148
syn match rustSpecialError display contained /\\./
149149
syn match rustSpecial display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
150150
syn match rustStringContinuation display contained /\\\n\s*/
151-
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation
152-
syn region rustString start='r\z(#*\)"' end='"\z1'
151+
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation,@Spell
152+
syn region rustString start='r\z(#*\)"' end='"\z1' contains=@Spell
153153

154154
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
155155
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
@@ -180,10 +180,10 @@ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit
180180
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
181181

182182
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
183-
syn region rustCommentLine start="//" end="$" contains=rustTodo
184-
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo
185-
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment keepend extend
186-
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment keepend extend
183+
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
184+
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
185+
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
186+
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
187187
" FIXME: this is a really ugly and not fully correct implementation. Most
188188
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
189189
" a comment, but in practice at present it leaves comments open two levels

0 commit comments

Comments
 (0)