mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-01 16:32:54 +03:00
cc6fe5ae61
We set the "ini" filetype for files ending in one of "repo", "ini", "cfg", "properties" or "desktop". Most of these actually use Unix style comments (#) instead of DOS INI comments (;). Introduce filetype "conf" which is similar to "ini" except it uses the default # as comment_line string. Both Vim and Emacs have a filetype (or Major mode) named "conf" (hence modeline-parse of "vim ft=conf" will work). Here are references that show that the new "conf" files use #-comments: *.repo -- search for # in https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-configuring_yum_and_yum_repositories *.cfg: don't know much about this one, but at least the motivating file uses # https://github.com/buildout/buildout/blob/master/buildout.cfg *.properties files: https://en.wikipedia.org/wiki/.properties *.desktop: per spec https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html#comments
25 lines
679 B
Plaintext
25 lines
679 B
Plaintext
hook global BufCreate .+\.ini %{
|
|
set-option buffer filetype ini
|
|
}
|
|
|
|
hook global WinSetOption filetype=ini %{
|
|
require-module ini
|
|
}
|
|
|
|
hook -group ini-highlight global WinSetOption filetype=ini %{
|
|
add-highlighter window/ini ref ini
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini }
|
|
}
|
|
|
|
|
|
provide-module ini %{
|
|
|
|
add-highlighter shared/ini regions
|
|
add-highlighter shared/ini/code default-region group
|
|
add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
|
|
|
|
add-highlighter shared/ini/code/ regex "(?S)^\h*(\[.+?\])\h*$" 1:title
|
|
add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value
|
|
|
|
}
|