Skip to content

Commit

Permalink
Merge pull request #91 from MengQ0627/quit-last-window
Browse files Browse the repository at this point in the history
fix: close the last window
  • Loading branch information
hedyhli authored Sep 8, 2024
2 parents e2fc8d8 + c727d3a commit 8ca4dd7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lua/outline/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8ca4dd7

Please sign in to comment.