misc: Add vim syntax highlighting file

This is an extremely basic initial version of syntax highlighting, written just
so that I can edit the MCL files in vim and not cry.

The following features are supported:
 - MCL keywords
 - strings (including escape characters)
 - comments
 - built-in resources (as of 0.0.27)
This commit is contained in:
Edward Toroshchyn
2025-02-05 08:50:50 -05:00
committed by James Shubin
parent bdc46648ff
commit 1e33c1fdae

38
misc/vim/mcl.vim Normal file
View File

@@ -0,0 +1,38 @@
" Vim syntax file
" Language: mgmt config language
if exists("b:current_syntax")
finish
endif
syn case match
syn keyword mclKeywords if else and or not in func class include import as
syn keyword mclTypes bool str int float map struct variant
syn keyword mclBuiltins true false panic
hi def link mclKeywords Keyword
hi def link mclTypes Type
hi def link mclBuiltins Constant
syn keyword mclTodo contained TODO FIXME XXX BUG
syn region mclComment start="#" end="$" contains=mclTodo
hi def link mclTodo Todo
hi def link mclComment Comment
syn keyword mclResources augeas aws:ec2 bmc:power config:etcd consul:kv cron deploy:tar dhcp:host
syn keyword mclResources dhcp:range dhcp:server docker:container docker:image exec file
syn keyword mclResources firewalld group gzip hetzner:vm hostname http:file http:flag http:proxy
syn keyword mclResources http:server kv mount msg net noop nspawn password pippet pkg print svc
syn keyword mclResources sysctl tar test tftp:file tftp:server timer user value virt virt:builder
hi def link mclResources Constant
syn region mclString start=+"+ skip=+\\"+ end=+"+ contains=mclEscapeChar
syn match mclEscapeChar display contained "\\."
hi def link mclString String
hi def link mclEscapeChar Special
let b:current_syntax = "mcl"