-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathhcl.vim
61 lines (46 loc) · 1.91 KB
/
hcl.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
" Vim syntax file
" Language: HashiCorp Configuration Language (HCL)
" Maintainer: Jussi Virtanen
" Repository: https://github.com/jvirtanen/vim-hcl
" License: Vim
if exists('b:current_syntax')
finish
end
syn match hclVariable /\<[A-Za-z0-9_.\[\]*]\+\>/
syn match hclParenthesis /(/
syn match hclFunction /\w\+(/ contains=hclParenthesis
syn keyword hclKeyword for in if
syn region hclString start=/"/ end=/"/ contains=hclEscape,hclInterpolation
syn region hclString start=/<<-\?\z([A-Z]\+\)/ end=/^\s*\z1/ contains=hclEscape,hclInterpolation
syn match hclEscape /\\n/
syn match hclEscape /\\r/
syn match hclEscape /\\t/
syn match hclEscape /\\"/
syn match hclEscape /\\\\/
syn match hclEscape /\\u\x\{4\}/
syn match hclEscape /\\u\x\{8\}/
syn match hclNumber /\<\d\+\%([eE][+-]\?\d\+\)\?\>/
syn match hclNumber /\<\d*\.\d\+\%([eE][+-]\?\d\+\)\?\>/
syn match hclNumber /\<0[xX]\x\+\>/
syn keyword hclConstant true false null
syn region hclInterpolation start=/\${/ end=/}/ contained contains=hclInterpolation
syn region hclComment start=/\/\// end=/$/ contains=hclTodo
syn region hclComment start=/\#/ end=/$/ contains=hclTodo
syn region hclComment start=/\/\*/ end=/\*\// contains=hclTodo
syn match hclAttributeName /\w\+/ contained
syn match hclAttribute /^[^=]\+=/ contains=hclAttributeName,hclComment,hclString
syn match hclBlockName /\w\+/ contained
syn match hclBlock /^[^=]\+{/ contains=hclBlockName,hclComment,hclString
syn keyword hclTodo TODO FIXME XXX DEBUG NOTE contained
hi def link hclVariable PreProc
hi def link hclFunction Function
hi def link hclKeyword Keyword
hi def link hclString String
hi def link hclEscape Special
hi def link hclNumber Number
hi def link hclConstant Constant
hi def link hclInterpolation PreProc
hi def link hclComment Comment
hi def link hclTodo Todo
hi def link hclBlockName Structure
let b:current_syntax = 'hcl'