Skip to content

Commit 15f05dc

Browse files
committed
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)
1 parent c14daba commit 15f05dc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/etc/vim/syntax/rust.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
102102
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
103103
syn match rustFormat display "%%" contained
104104
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
105-
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial
105+
syn match rustStringContinuation display contained /\\\n\s*/
106+
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
106107

107108
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
108109
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
@@ -137,9 +138,9 @@ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit
137138
syn match rustCharacter /'\([^'\\]\|\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
138139

139140
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
140-
syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend
141+
syn region rustComment start="//" end="$" contains=rustTodo keepend
141142
syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo
142-
syn region rustCommentDoc start="//[/!]" skip="\\$" end="$" contains=rustTodo keepend
143+
syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend
143144

144145
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
145146

@@ -157,6 +158,7 @@ hi def link rustTrait rustType
157158
hi def link rustSigil StorageClass
158159
hi def link rustFormat Special
159160
hi def link rustSpecial Special
161+
hi def link rustStringContinuation Special
160162
hi def link rustString String
161163
hi def link rustCharacter Character
162164
hi def link rustNumber Number

0 commit comments

Comments
 (0)