runtime(kdl): include syntax, indent and ftplugin files

closes: #14956

Co-authored-by: Aram Drevekenin <aram@poor.dev>
Signed-off-by: inzuo Jiang <jiangyinzuo@foxmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
inzuo Jiang
2024-06-10 21:13:56 +02:00
committed by Christian Brabandt
parent d03882baac
commit 2d88210b3c
4 changed files with 91 additions and 0 deletions

26
runtime/indent/kdl.vim Normal file
View File

@ -0,0 +1,26 @@
" Vim indent file
" Language: KDL
" Author: Aram Drevekenin <aram@poor.dev>
" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
" 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