diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-28 09:14:32 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-28 09:14:32 +0000 |
commit | 904cec3c4a329cf89fc3219d359239910d61f3f6 (patch) | |
tree | 8d113899921dfbaca0e77c49ab5fc827362d1091 /autoload/filetype/conf.kak |
Diffstat (limited to 'autoload/filetype/conf.kak')
-rw-r--r-- | autoload/filetype/conf.kak | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/autoload/filetype/conf.kak b/autoload/filetype/conf.kak new file mode 100644 index 0000000..9b71589 --- /dev/null +++ b/autoload/filetype/conf.kak @@ -0,0 +1,30 @@ +hook global BufCreate .+\.(repo|cfg|properties|desktop) %{ + set-option buffer filetype conf +} + +hook global WinCreate .+\.ini %{ + try %{ + execute-keys /^\h*#<ret> + 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 + +} |