vim: Apply gitcommit options to NeogitCommitMessage buffers

This commit is contained in:
Fernando Schauenburg 2024-02-24 21:08:01 +01:00
parent c39be0a592
commit 786b28fba5
3 changed files with 17 additions and 3 deletions

View file

@ -1,4 +1,2 @@
vim.bo.textwidth = 72
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
require("fschauen.util.options").set_gitcommit_buffer_options()

View file

@ -29,6 +29,15 @@ M.setup = function()
vim.opt.cursorlineopt = "both"
end,
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Replicate gitcommit filetype options for Neogit commit.",
group = group,
pattern = "NeogitCommitMessage",
callback = function(_)
require("fschauen.util.options").set_gitcommit_buffer_options()
end,
})
end
return M

View file

@ -25,4 +25,11 @@ M.toggle_spell = function()
vim.cmd([[set spell?]])
end
M.set_gitcommit_buffer_options = function()
print('here we are!')
vim.bo.textwidth = 72
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
end
return M