summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/kdl.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /runtime/syntax/kdl.vim
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-upstream/2%9.1.0496.tar.xz
vim-upstream/2%9.1.0496.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/kdl.vim')
-rw-r--r--runtime/syntax/kdl.vim48
1 files changed, 48 insertions, 0 deletions
diff --git a/runtime/syntax/kdl.vim b/runtime/syntax/kdl.vim
new file mode 100644
index 0000000..97e8f93
--- /dev/null
+++ b/runtime/syntax/kdl.vim
@@ -0,0 +1,48 @@
+" Vim syntax file
+" Language: KDL
+" Maintainer: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Latest Revision: 2024-06-16
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match kdlNode '\v(\w|-|\=)' display
+syn match kdlBool '\v(true|false)' display
+
+syn keyword kdlTodo contained TODO FIXME XXX NOTE
+syn region kdlComment start="//" end="$" contains=kdlTodo,@Spell
+syn region kdlComment start="/\*" end="\*/" contains=kdlTodo,@Spell
+
+" Regular int like number with - + or nothing in front
+syn match kdlNumber '\d\+'
+syn match kdlNumber '[-+]\d\+'
+
+" Floating point number with decimal no E or e (+,-)
+syn match kdlNumber '\d\+\.\d*' contained display
+syn match kdlNumber '[-+]\d\+\.\d*' contained display
+
+" Floating point like number with E and no decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+
+" Floating point like number with E and decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+
+syn region kdlString start='"' end='"' skip='\\\\\|\\"' display
+
+syn region kdlChildren start="{" end="}" contains=kdlString,kdlNumber,kdlNode,kdlBool,kdlComment
+
+hi def link kdlTodo Todo
+hi def link kdlComment Comment
+hi def link kdlNode Statement
+hi def link kdlBool Boolean
+hi def link kdlString String
+hi def link kdlNumber Number
+
+let b:current_syntax = "kdl"
+
+" vim: sw=2 sts=2 et