From e72454e244084082d0b121dbf04212b57923986c Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sun, 2 Aug 2020 09:16:16 -0600 Subject: [PATCH 1/2] Fix lazygit vim fugitive conflict --- ftplugin/gitcommit.vim | 3 ++- lua/lazygit.lua | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim index a26467f..c86024c 100644 --- a/ftplugin/gitcommit.vim +++ b/ftplugin/gitcommit.vim @@ -1,6 +1,7 @@ -if g:lazygit_use_neovim_remote && executable("nvr") +if g:lazygit_opened && g:lazygit_use_neovim_remote && executable("nvr") augroup lazygit_neovim_remote autocmd! autocmd WinLeave :LazyGit + autocmd WinLeave :setglobal lazygit_opened=0 augroup END end diff --git a/lua/lazygit.lua b/lua/lazygit.lua index 1c1c4bb..b221ba7 100644 --- a/lua/lazygit.lua +++ b/lua/lazygit.lua @@ -4,6 +4,7 @@ local fn = vim.fn LAZYGIT_BUFFER = nil LAZYGIT_LOADED = false +vim.g.lazygit_opened = 0 --- Strip leading and lagging whitespace local function trim(str) @@ -42,6 +43,7 @@ local function on_exit(job_id, code, event) vim.cmd("silent! :q") LAZYGIT_BUFFER = nil LAZYGIT_LOADED = false + vim.g.lazygit_opened = 0 end end @@ -49,6 +51,7 @@ end local function exec_lazygit_command(cmd) if LAZYGIT_LOADED == false then -- ensure that the buffer is closed on exit + vim.g.lazygit_opened = 1 vim.fn.termopen(cmd, { on_exit = on_exit }) end vim.cmd "startinsert" From 29f696d0eff1224f6b8d9d9e8eb8bd30e052f1ea Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sun, 2 Aug 2020 09:39:25 -0600 Subject: [PATCH 2/2] Change setglobal to let --- ftplugin/gitcommit.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim index c86024c..2b303f7 100644 --- a/ftplugin/gitcommit.vim +++ b/ftplugin/gitcommit.vim @@ -2,6 +2,6 @@ if g:lazygit_opened && g:lazygit_use_neovim_remote && executable("nvr") augroup lazygit_neovim_remote autocmd! autocmd WinLeave :LazyGit - autocmd WinLeave :setglobal lazygit_opened=0 + autocmd WinLeave :let g:lazygit_opened=0 augroup END end