From 1e33c1fdae2d1d26c2d71fc83f3161e7da1700c8 Mon Sep 17 00:00:00 2001 From: Edward Toroshchyn Date: Wed, 5 Feb 2025 08:50:50 -0500 Subject: [PATCH] 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) --- misc/vim/mcl.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 misc/vim/mcl.vim diff --git a/misc/vim/mcl.vim b/misc/vim/mcl.vim new file mode 100644 index 00000000..ce642f5e --- /dev/null +++ b/misc/vim/mcl.vim @@ -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"