From 6f12b8ebaefd032da3231260d0429ce28db399a5 Mon Sep 17 00:00:00 2001 From: phanium <91544758+phanen@users.noreply.github.com> Date: Wed, 11 Jun 2025 22:34:08 +0800 Subject: [PATCH] fix: handle when there's only one tabpage --- lua/neogit/lib/buffer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/neogit/lib/buffer.lua b/lua/neogit/lib/buffer.lua index 911a670ac..562e7e5af 100644 --- a/lua/neogit/lib/buffer.lua +++ b/lua/neogit/lib/buffer.lua @@ -226,6 +226,9 @@ function Buffer:close(force) if self.kind == "tab" then local ok, _ = pcall(vim.cmd, "tabclose") + if not ok and #api.nvim_list_tabpages() == 1 then + ok, _ = pcall(vim.cmd, "bd! " .. self.handle) + end if not ok then vim.cmd("tab sb " .. self.handle) vim.cmd("tabclose #")