From 4c33a74098bda854271524fdbc7978cfd951a779 Mon Sep 17 00:00:00 2001 From: "tobias.voelzel" Date: Fri, 14 Jan 2022 08:24:50 +0100 Subject: [PATCH] fix: improve git commit message via nvr Switch to the BufUnload event for reopening LazyGit window, so that the user can switch windows before submitting his commit message. --- ftplugin/gitcommit.vim | 4 ++-- lua/lazygit.lua | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim index 09b1757..4fc1f6a 100644 --- a/ftplugin/gitcommit.vim +++ b/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ if exists("g:lazygit_opened") && g:lazygit_opened && g:lazygit_use_neovim_remote && executable("nvr") augroup lazygit_neovim_remote autocmd! - autocmd WinLeave :LazyGit - autocmd WinLeave :let g:lazygit_opened=0 + autocmd BufUnload :lua local root = require('lazygit').project_root_dir(); vim.schedule(function() require('lazygit').lazygit(root) end) + autocmd BufUnload :let g:lazygit_opened=0 augroup END end diff --git a/lua/lazygit.lua b/lua/lazygit.lua index 749b17c..55b51a7 100644 --- a/lua/lazygit.lua +++ b/lua/lazygit.lua @@ -224,4 +224,9 @@ local function lazygitconfig() end end -return { lazygit = lazygit, lazygitfilter = lazygitfilter, lazygitconfig = lazygitconfig } +return { + lazygit = lazygit, + lazygitfilter = lazygitfilter, + lazygitconfig = lazygitconfig, + project_root_dir = project_root_dir, +}