vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit a0d31fbbea41780d0a009411f994befc469734d5
parent 65f302daffdbea6afd36af43b1e6ae0d04aa1431
Author: Karol Kosek <krkk@serenityos.org>
Date:   Sat, 25 Sep 2021 13:12:16 +0200

filetype: Set diff filetype for COMMIT_EDITMSG files

This filename is set when writing a commit message in git.

If you run git-commit with an --verbose option or if you just have set
it in your git-config, that shows you the patch diff on bottom
of the file.

Unfortunately, now every patch file will set colorcolumn, but overall
I think this is better than having duplicated lexers.

Diffstat:
Mlua/plugins/filetype.lua | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua @@ -96,7 +96,8 @@ vis.ftdetect.filetypes = { ext = { "%.desktop$" }, }, diff = { - ext = { "%.diff$", "%.patch$", "%.rej$" }, + ext = { "%.diff$", "%.patch$", "%.rej$", "^COMMIT_EDITMSG$" }, + cmd = { "set colorcolumn 72" }, }, dmd = { ext = { "%.d$", "%.di$" }, @@ -159,10 +160,6 @@ vis.ftdetect.filetypes = { gherkin = { ext = { "%.feature$" }, }, - ['git-commit'] = { - ext = { "^COMMIT_EDITMSG$" }, - cmd = { "set colorcolumn 72" }, - }, ['git-rebase'] = { ext = { "git%-rebase%-todo" }, },