Merge pull request #91 from MengQ0627/quit-last-window

fix: close the last window
This commit is contained in:
~hedy
2024-09-08 09:11:14 +08:00
committed by GitHub

View File

@@ -76,9 +76,15 @@ end
---Close view window and remove winnr/bufnr fields
function View:close()
if self.win then
vim.api.nvim_win_close(self.win, true)
self.win = nil
self.buf = nil
local windows = vim.api.nvim_list_wins()
local win_count = #windows
if win_count == 1 then
vim.api.nvim_command('q')
else
vim.api.nvim_win_close(self.win, true)
self.win = nil
self.buf = nil
end
end
end