runtime(kdl): include syntax, indent and ftplugin files
Commit:
https://github.com/vim/vim/commit/2d88210b3c8516c30ed104054e5cdaef67880755
Author: inzuo Jiang <[email protected]>
Date: Mon Jun 10 21:13:56 2024 +0200
runtime(kdl): include syntax, indent and ftplugin files
closes: https://github.com/vim/vim/issues/14956
Co-authored-by: Aram Drevekenin <[email protected]>
Signed-off-by: inzuo Jiang <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index 7433062eb..926dc07cf 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -175,6 +175,7 @@ runtime/ftplugin/jsonc.vim @izhakjakov
runtime/ftplugin/julia.vim @carlobaldassi
runtime/ftplugin/jq.vim @vito-c
runtime/ftplugin/kconfig.vim @chrisbra
+runtime/ftplugin/kdl.vim @imsnif @jiangyinzuo
runtime/ftplugin/kotlin.vim @udalov
runtime/ftplugin/less.vim @genoma
runtime/ftplugin/liquid.vim @tpope
@@ -292,6 +293,7 @@ runtime/indent/javascript.vim @bounceme
runtime/indent/json.vim @elzr
runtime/indent/jsonc.vim @izhakjakov
runtime/indent/julia.vim @carlobaldassi
+runtime/indent/kdl.vim @imsnif @jiangyinzuo
runtime/indent/kotlin.vim @udalov
runtime/indent/krl.vim @KnoP-01
runtime/indent/ld.vim @dkearns
@@ -434,6 +436,7 @@ runtime/syntax/julia.vim @carlobaldassi
runtime/syntax/jq.vim @vito-c
runtime/syntax/kconfig.vim @chrisbra
runtime/syntax/kotlin.vim @udalov
+runtime/syntax/kdl.vim @imsnif @jiangyinzuo
runtime/syntax/krl.vim @KnoP-01
runtime/syntax/less.vim @genoma
runtime/syntax/liquid.vim @tpope
diff --git a/runtime/ftplugin/kdl.vim b/runtime/ftplugin/kdl.vim
new file mode 100644
index 000000000..c9a1d8b18
--- /dev/null
+++ b/runtime/ftplugin/kdl.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin
+" Language: KDL
+" Author: Aram Drevekenin <[email protected]>
+" Maintainer: Yinzuo Jiang <[email protected]>
+" Last Change: 2024-06-10
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setlocal comments=://
+setlocal commentstring=//\ %s
+setlocal formatoptions-=t
+
+let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<'
diff --git a/runtime/indent/kdl.vim b/runtime/indent/kdl.vim
new file mode 100644
index 000000000..2d24f18df
--- /dev/null
+++ b/runtime/indent/kdl.vim
@@ -0,0 +1,26 @@
+" Vim indent file
+" Language: KDL
+" Author: Aram Drevekenin <[email protected]>
+" Maintainer: Yinzuo Jiang <[email protected]>
+" Last Change: 2024-06-10
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=KdlIndent()
+let b:undo_indent = "setlocal indentexpr<"
+
+function! KdlIndent(...)
+ let line = getline(v:lnum)
+ let previousNum = prevnonblank(v:lnum - 1)
+ let previous = getline(previousNum)
+
+ if previous =~ "{" && previous !~ "}" && line !~ "}" && line !~ ":$"
+ return indent(previousNum) + &tabstop
+ else
+ return indent(previousNum)
+ endif
+endfunction
diff --git a/runtime/syntax/kdl.vim b/runtime/syntax/kdl.vim
new file mode 100644
index 000000000..a36bb9e92
--- /dev/null
+++ b/runtime/syntax/kdl.vim
@@ -0,0 +1,45 @@
+" Vim syntax file
+" Language: KDL
+" Maintainer: Aram Drevekenin <[email protected]>
+" Maintainer: Yinzuo Jiang <[email protected]>
+" Latest Revision: 2024-06-10
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match kdlNode ' (\w|-|\=)' display
+syn match kdlBool ' (true|false)' display
+
+syn keyword kdlTodo contained TODO FIXME XXX NOTE
+syn match kdlComment "//.*$" contains=kdlTodo
+
+" 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"
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1sGkiR-004mhW-6y%40256bit.org.