blob: c690b706eac374706c21fb05556565ce1bcfd373 [file] [log] [blame]
Bram Moolenaar9712ff12022-09-18 13:04:22 +01001" Vim syntax file
2" Language: Valve Data Format
3" Maintainer: ObserverOfTime <chronobserver@disroot.org>
4" Filenames: *.vdf
5" Last Change: 2022 Sep 15
6
7if exists('b:current_syntax')
8 finish
9endif
10
11let s:cpo_save = &cpoptions
12set cpoptions&vim
13
14" Comment
15syn keyword vdfTodo contained TODO FIXME XXX
16syn match vdfComment +//.*+ contains=vdfTodo
17
18" Macro
19syn match vdfMacro /^\s*#.*/
20
21" Tag
22syn region vdfTag start=/"/ skip=/\\"/ end=/"/
23 \ nextgroup=vdfValue skipwhite oneline
24
25" Section
26syn region vdfSection matchgroup=vdfBrace
27 \ start=/{/ end=/}/ transparent fold
28 \ contains=vdfTag,vdfSection,vdfComment,vdfConditional
29
30" Conditional
31syn match vdfConditional /\[\$\w\{1,1021}\]/ nextgroup=vdfTag
32
33" Value
34syn region vdfValue start=/"/ skip=/\\"/ end=/"/
35 \ oneline contained contains=vdfVariable,vdfNumber,vdfEscape
36syn region vdfVariable start=/%/ skip=/\\%/ end=/%/ oneline contained
37syn match vdfEscape /\\[nt\\"]/ contained
38syn match vdfNumber /"-\?\d\+"/ contained
39
40hi def link vdfBrace Delimiter
41hi def link vdfComment Comment
42hi def link vdfConditional Constant
43hi def link vdfEscape SpecialChar
44hi def link vdfMacro Macro
45hi def link vdfNumber Number
46hi def link vdfTag Keyword
47hi def link vdfTodo Todo
48hi def link vdfValue String
49hi def link vdfVariable Identifier
50
51let b:current_syntax = 'vdf'
52
53let &cpoptions = s:cpo_save
54unlet s:cpo_save