fix (#989)
Prevents auto-focus of nvimtree when there are multiple buffers opened and current buffer is closed
This commit is contained in:
parent
a8466ccf4c
commit
83fe03455e
|
@ -3,10 +3,11 @@ local M = {}
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
M.close_buffer = function(force)
|
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!"
|
cmd ":bd!"
|
||||||
else
|
else
|
||||||
cmd "bd"
|
-- switch to previous buffer then close current buffer
|
||||||
|
vim.cmd(":bp | bd" .. vim.fn.bufnr())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue