diff --git a/config/nvim/after/ftplugin/gitcommit.lua b/config/nvim/after/ftplugin/gitcommit.lua index 6ff2460..e8bcc2b 100644 --- a/config/nvim/after/ftplugin/gitcommit.lua +++ b/config/nvim/after/ftplugin/gitcommit.lua @@ -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() diff --git a/config/nvim/lua/fschauen/autocmd.lua b/config/nvim/lua/fschauen/autocmd.lua index 621521d..c24ef12 100644 --- a/config/nvim/lua/fschauen/autocmd.lua +++ b/config/nvim/lua/fschauen/autocmd.lua @@ -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 diff --git a/config/nvim/lua/fschauen/util/options.lua b/config/nvim/lua/fschauen/util/options.lua index 2f117a8..1685ad8 100644 --- a/config/nvim/lua/fschauen/util/options.lua +++ b/config/nvim/lua/fschauen/util/options.lua @@ -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