diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2022-02-09 16:13:29 +0100 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2022-02-19 17:31:55 +0100 |
| commit | 3a856ef57b433e6c0f11247d2b2193cf782eb3be (patch) | |
| tree | 5d8a5ac410ab49bb5e923df950a613f190b93b82 | |
| parent | cc6fe5ae6138f901cf5de315a166584770b45e58 (diff) | |
rc conf: treat ini files as conf if they contain a #-comment
*.ini files traditionally use ; but for example the "foot" terminal's
foot.ini uses #. Add a hack to treat ini files as "conf" filetype
if they contain a #-comment (very slim chance of false positives).
This requires to explicitly set comment_line to the default #,
because we set the "ini" filetype earlier.
| -rw-r--r-- | rc/filetype/conf.kak | 7 | ||||
| -rw-r--r-- | rc/tools/comment.kak | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/rc/filetype/conf.kak b/rc/filetype/conf.kak index 8288a0ba..9b715893 100644 --- a/rc/filetype/conf.kak +++ b/rc/filetype/conf.kak @@ -2,6 +2,13 @@ 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 } diff --git a/rc/tools/comment.kak b/rc/tools/comment.kak index 8d3ee798..1094fbba 100644 --- a/rc/tools/comment.kak +++ b/rc/tools/comment.kak @@ -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 '/*' |
