We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1c4479 commit 27caccbCopy full SHA for 27caccb
lua/nvim-tree/view.lua
@@ -322,13 +322,17 @@ end
322
function M.close()
323
if not M.win_open() then return end
324
if #a.nvim_list_wins() == 1 then
325
- local ans = vim.fn.input(
326
- '[NvimTree] this is the last open window, are you sure you want to quit nvim ? y/n: '
+ local ok_bufs = vim.tbl_filter(
+ function(buf)
327
+ return a.nvim_buf_is_valid(buf) and vim.fn.buflisted(buf) == 1
328
+ end,
329
+ a.nvim_list_bufs()
330
)
- if ans == 'y' then
- vim.cmd "q!"
331
+ if #ok_bufs > 0 then
332
+ vim.cmd "sbnext"
333
+ else
334
+ vim.cmd "new"
335
end
- return
336
337
a.nvim_win_hide(M.get_winnr())
338
0 commit comments