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, +}