diff --git a/rc/filetype/conf.kak b/rc/filetype/conf.kak new file mode 100644 index 00000000..8288a0ba --- /dev/null +++ b/rc/filetype/conf.kak @@ -0,0 +1,23 @@ +hook global BufCreate .+\.(repo|cfg|properties|desktop) %{ + set-option buffer filetype conf +} + +hook global WinSetOption filetype=conf %{ + require-module conf +} + +hook -group conf-highlight global WinSetOption filetype=conf %{ + add-highlighter window/conf ref conf + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/conf } +} + +provide-module conf %{ + +add-highlighter shared/conf regions +add-highlighter shared/conf/code default-region group +add-highlighter shared/conf/comment region '(^|\h)\K#' $ fill comment + +add-highlighter shared/conf/code/ regex "(?S)^\h*(\[.+?\])\h*$" 1:title +add-highlighter shared/conf/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value + +} diff --git a/rc/filetype/ini.kak b/rc/filetype/ini.kak index 1e922fdd..75762f6a 100644 --- a/rc/filetype/ini.kak +++ b/rc/filetype/ini.kak @@ -1,4 +1,4 @@ -hook global BufCreate .+\.(repo|ini|cfg|properties|desktop) %{ +hook global BufCreate .+\.ini %{ set-option buffer filetype ini }