Prevents auto-focus of nvimtree when there are multiple buffers opened and current buffer is closed
This commit is contained in:
siduck 2022-04-29 22:33:18 +05:30 committed by GitHub
parent a8466ccf4c
commit 83fe03455e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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