From 30e21c2fc6bca996bd64fcde35b5f72e89c71877 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Mon, 29 Jun 2026 15:04:31 +0200 Subject: feat: don't open cached diff in new gitcommit windows --- after/ftplugin/gitcommit.lua | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'after/ftplugin/gitcommit.lua') diff --git a/after/ftplugin/gitcommit.lua b/after/ftplugin/gitcommit.lua index 0f97d93..98cdc0b 100644 --- a/after/ftplugin/gitcommit.lua +++ b/after/ftplugin/gitcommit.lua @@ -10,28 +10,4 @@ vim.opt_local.complete = { ".", -- current buffer } -vim.api.nvim_create_autocmd("BufWinEnter", { - desc = "Show cached git diff", - group = vim.g.dotfiles.augroup, - buffer = 0, - callback = function() - local MIN_COL_FOR_VERTICAL_SPLIT = 200 - local vert_split = vim.o.columns >= MIN_COL_FOR_VERTICAL_SPLIT - local gitcommit_window = vim.api.nvim_get_current_win() - -- Open cached diff window (see `:help ft-gitcommit-plugin`) - vim.cmd.DiffGitCached() - vim.opt_local.winfixwidth = false - vim.opt_local.winfixheight = false - if vert_split then - vim.cmd.wincmd("L") - else - vim.cmd.wincmd("J") - end - -- Enable English spell check in the original window - -- If `'spell'` is set before `:DiffGitCached` it propagates to the cached diff window (that we don't want) - vim.api.nvim_set_option_value("spell", true, { win = gitcommit_window }) - -- The current window is the diff window - vim.bo.filetype = "diff" - vim.opt_local.foldenable = false - end, -}) +vim.opt_local.spell = true -- cgit v1.3.1