Skip to content

Commit

Permalink
Merge pull request #647 from Teatek/close-last-window
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey committed Jul 21, 2023
2 parents 3d63d76 + 8dd9674 commit 94b5d98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/neogit/lib/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ function Buffer:close(force)
local winnr = fn.bufwinnr(self.handle)
if winnr ~= -1 then
local winid = fn.win_getid(winnr)
api.nvim_win_close(winid, force)
if not pcall(api.nvim_win_close, winid, force) then
vim.cmd("b#")
end
else
api.nvim_buf_delete(self.handle, { force = force })
end
Expand Down

0 comments on commit 94b5d98

Please sign in to comment.