@@ -20,7 +20,8 @@ syn keyword rustKeyword check claim cont const copy else export extern fai
20
20
syn keyword rustKeyword for if impl import in let log
21
21
syn keyword rustKeyword loop mod mut of pure
22
22
syn keyword rustKeyword ret self to unchecked
23
- syn keyword rustKeyword unsafe use while with
23
+ syn match rustKeyword " unsafe" " Allows also matching unsafe::foo()
24
+ syn keyword rustKeyword use while with
24
25
" FIXME: Scoped impl's name is also fallen in this category
25
26
syn keyword rustKeyword mod iface trait class enum type nextgroup =rustIdentifier skipwhite
26
27
syn keyword rustKeyword fn nextgroup =rustFuncName skipwhite
@@ -36,9 +37,19 @@ syn keyword rustType f64 i8 i16 i32 i64 str
36
37
37
38
syn keyword rustBoolean true false
38
39
39
- syn match rustItemPath " \(\w\| ::\)\+ "
40
+ syn keyword rustConstant some none " option
41
+ " syn keyword rustConstant left right " either
42
+ " syn keyword rustConstant ok err " result
43
+ " syn keyword rustConstant success failure " task
44
+ " syn keyword rustConstant cons nil " list
45
+ " syn keyword rustConstant empty node " tree
40
46
41
- syn region rustString start =+ L\= "+ skip =+ \\\\\|\\ "+ end =+ "+
47
+ " If foo::bar changes to foo.bar, change this ("::" to "\.").
48
+ " If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
49
+ syn match rustModPath " \w\(\w\) *::" he =e - 2 ,me =e - 2
50
+ syn match rustModPathSep " ::"
51
+
52
+ syn region rustString start =+ L\= "+ skip =+ \\\\\|\\ "+ end =+ "+
42
53
43
54
syn region rustAttribute start =" #\[ " end =" \] " contains =rustString
44
55
@@ -72,21 +83,25 @@ syn keyword rustTodo TODO FIXME XXX NB
72
83
hi def link rustHexNumber rustNumber
73
84
hi def link rustBinNumber rustNumber
74
85
75
- " Recommend changing rustAssert to something else - I use ctermfg=yellow.
76
86
hi def link rustString String
77
87
hi def link rustCharacter Character
78
88
hi def link rustNumber Number
79
89
hi def link rustBoolean Boolean
90
+ hi def link rustConstant Constant
80
91
hi def link rustFloat Float
81
92
hi def link rustAssert Keyword
82
93
hi def link rustKeyword Keyword
83
94
hi def link rustIdentifier Identifier
95
+ hi def link rustModPath Include
84
96
hi def link rustFuncName Function
85
97
hi def link rustComment Comment
86
98
hi def link rustMacro Macro
87
99
hi def link rustType Type
88
100
hi def link rustTodo Todo
89
101
hi def link rustAttribute PreProc
102
+ " Other Suggestions:
103
+ " hi def link rustModPathSep Conceal
104
+ " hi rustAssert ctermfg=yellow
90
105
91
106
syn sync minlines =200
92
107
syn sync maxlines =500
0 commit comments