diff --git a/lua/neogit/client.lua b/lua/neogit/client.lua index 177bbba0e..de3c7ee9f 100644 --- a/lua/neogit/client.lua +++ b/lua/neogit/client.lua @@ -77,6 +77,10 @@ function M.editor(target, client, show_diff) logger.debug(("[CLIENT] Invoked editor with target: %s, from: %s"):format(target, client)) require("neogit.process").hide_preview_buffers() + if config.values.auto_close_console then + require("neogit.process").close_git_hook_buffers() + end + local rpc_client = RPC.create_connection(client) ---on_unload callback when closing editor diff --git a/lua/neogit/process.lua b/lua/neogit/process.lua index 050b98b13..f7af61b1c 100644 --- a/lua/neogit/process.lua +++ b/lua/neogit/process.lua @@ -115,6 +115,20 @@ function Process.hide_preview_buffers() end end +function Process.close_git_hook_buffers() + for _, v in pairs(processes) do + if v.git_hook then + v:close() + end + end +end + +function Process:close() + if self.buffer then + self.buffer:close() + end +end + function Process:show_console() if self.buffer then self.buffer:show()