Skip to content

Commit 55de232

Browse files
committed
vim: Highlight identifiers
1 parent 358dc59 commit 55de232

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/etc/vim/syntax/rust.vim

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ if !exists("main_syntax")
1515
endif
1616

1717
syn keyword rustKeyword alt as assert be bind break
18-
syn keyword rustKeyword check claim cont const copy do else enum export fail
19-
syn keyword rustKeyword fn for if iface impl import in inline lambda let log
18+
syn keyword rustKeyword check claim cont const copy do else export fail
19+
syn keyword rustKeyword for if impl import in inline lambda let log
2020
syn keyword rustKeyword loop mod mut mutable native note of prove pure
21-
syn keyword rustKeyword resource ret self syntax to type unchecked
21+
syn keyword rustKeyword ret self syntax to unchecked
2222
syn keyword rustKeyword unsafe use while with
23+
" FIXME: Scoped impl's name is also fallen in this category
24+
syn keyword rustKeyword mod iface resource class enum type nextgroup=rustIdentifier skipwhite
25+
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
26+
27+
syn match rustIdentifier "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
28+
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
2329

2430
" Reserved words
2531
syn keyword rustKeyword m32 m64 m128 f80 f16 f128 class trait
@@ -59,6 +65,8 @@ hi def link rustNumber Number
5965
hi def link rustBoolean Boolean
6066
hi def link rustFloat Float
6167
hi def link rustKeyword Keyword
68+
hi def link rustIdentifier Identifier
69+
hi def link rustFuncName Function
6270
hi def link rustComment Comment
6371
hi def link rustMacro Macro
6472
hi def link rustType Type

0 commit comments

Comments
 (0)