Skip to content

Commit

Permalink
Merge remote-tracking branch 'krobelus/ini-hash-comments'
Browse files Browse the repository at this point in the history
  • Loading branch information
mawww committed Mar 21, 2022
2 parents 3667f8b + 3a856ef commit eae8ea8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
30 changes: 30 additions & 0 deletions rc/filetype/conf.kak
Original file line number Diff line number Diff line change
@@ -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

}
2 changes: 1 addition & 1 deletion rc/filetype/ini.kak
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hook global BufCreate .+\.(repo|ini|cfg|properties|desktop) %{
hook global BufCreate .+\.ini %{
set-option buffer filetype ini
}

Expand Down
4 changes: 4 additions & 0 deletions rc/tools/comment.kak
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ hook global BufSetOption filetype=coffee %{
set-option buffer comment_block_end '###'
}

hook global BufSetOption filetype=conf %{
set-option buffer comment_line '#'
}

hook global BufSetOption filetype=css %{
set-option buffer comment_line ''
set-option buffer comment_block_begin '/*'
Expand Down

0 comments on commit eae8ea8

Please sign in to comment.