Prevents auto-focus of nvimtree when there are multiple buffers opened and current buffer is closed
navigator
siduck 2 years ago committed by GitHub
parent a8466ccf4c
commit 83fe03455e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,10 +3,11 @@ local M = {}
local cmd = vim.cmd
M.close_buffer = function(force)
if force or not vim.bo.buflisted or vim.bo.buftype == 'nofile' then
if force or not vim.bo.buflisted or vim.bo.buftype == "nofile" then
cmd ":bd!"
else
cmd "bd"
-- switch to previous buffer then close current buffer
vim.cmd(":bp | bd" .. vim.fn.bufnr())
end
end

Loading…
Cancel
Save