From 057da1d13308e0dcd80b280e9014ccd6ed6914c7 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Fri, 23 May 2025 14:50:15 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-23 14:50:15 --- .config/kak/autoload/filetype/kdl.kak | 51 ++++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.config/kak/autoload/filetype/kdl.kak b/.config/kak/autoload/filetype/kdl.kak index 7dffd993..a6a3948d 100644 --- a/.config/kak/autoload/filetype/kdl.kak +++ b/.config/kak/autoload/filetype/kdl.kak @@ -1,28 +1,3 @@ -hook global BufCreate .*[.](kdl) %{ - set-option buffer filetype kdl - set-option buffer comment_line "//" - set-option buffer comment_block_begin "/*" - set-option buffer comment_block_end "*/" - set-option window formatcmd "kdlfmt format -" -} - -hook global WinSetOption filetype=kdl %{ - require-module kdl - - # hook window InsertChar \n -group kdl-indent %{ kdl-indent-newline } - # hook window InsertChar \} -group kdl-indent %{ kdl-indent-closing-brace } - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kdl-indent } - - hook -group kdl-auto-format window BufWritePre .* format - hook -once -always WinSetOption filetype=.* %sh{ - if [ "$kak_opt_filetype" != "kdl" ]; then - echo "unset-option window formatcmd" - echo "remove-hooks window kdl-auto-format" - fi - } -} - provide-module kdl %~ define-command -hidden kdl-indent-newline %( @@ -45,3 +20,29 @@ define-command -hidden kdl-indent-closing-brace %( ) ~ + +hook global BufCreate .*[.](kdl) %{ + set-option buffer filetype kdl + set-option buffer comment_line "//" + set-option buffer comment_block_begin "/*" + set-option buffer comment_block_end "*/" + set-option window formatcmd "kdlfmt format -" +} + +hook global WinSetOption filetype=kdl %{ + require-module kdl + + hook window InsertChar \n -group kdl-indent %{ kdl-indent-newline } + hook window InsertChar \} -group kdl-indent %{ kdl-indent-closing-brace } + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kdl-indent } + + hook -group kdl-auto-format window BufWritePre .* format + hook -once -always WinSetOption filetype=.* %sh{ + if [ "$kak_opt_filetype" != "kdl" ]; then + echo "unset-option window formatcmd" + echo "remove-hooks window kdl-auto-format" + fi + } +} +