1 " Vim syntax file " Language: Mojom
2 " To get syntax highlighting for .mojom files, add the following to your .vimrc
4 " source /path/to/src/tools/vim/mojom.vim
6 if !exists("g:main_syntax")
9 elseif exists("b:current_syntax")
12 let g:main_syntax = 'mojom'
13 syntax region mojomFold start="{" end="}" transparent fold
17 syntax keyword mojomType bool int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double
18 syntax match mojomImport "^\(import\)\s"
19 syntax keyword mojomModule module
20 syntax keyword mojomKeyword interface enum struct union
23 syntax keyword mojomTodo contained TODO FIXME XXX
24 syntax region mojomComment start="/\*" end="\*/" contains=mojomTodo,mojomDocLink,@Spell
25 syntax match mojomLineComment "//.*" contains=mojomTodo,@Spell
26 syntax match mojomLineDocComment "///.*" contains=mojomTodo,mojomDocLink,@Spell
27 syntax region mojomDocLink contained start=+\[+ end=+\]+
29 " The default highlighting.
30 highlight default link mojomTodo Todo
31 highlight default link mojomComment Comment
32 highlight default link mojomLineComment Comment
33 highlight default link mojomLineDocComment Comment
34 highlight default link mojomDocLink SpecialComment
35 highlight default link mojomType Type
36 highlight default link mojomImport Include
37 highlight default link mojomKeyword Keyword
39 let b:current_syntax = "mojom"
40 let b:spell_options = "contained"
42 if g:main_syntax is# 'mojom'