fix #977
This commit is contained in:
parent
263dcc0115
commit
d16546acac
@ -3,12 +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 vim.bo.buftype == "terminal" then vim.api.nvim_win_hide(0) return end
|
||||||
cmd ":bd!"
|
force = force or not vim.bo.buflisted or vim.bo.buftype == "nofile"
|
||||||
else
|
-- if not force, change to prev buf and then close current
|
||||||
-- switch to previous buffer then close current buffer
|
local close_cmd = force and ":bd!" or ":bp | bd" .. vim.fn.bufnr()
|
||||||
vim.cmd(":bp | bd" .. vim.fn.bufnr())
|
vim.cmd(close_cmd)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.load_config = function()
|
M.load_config = function()
|
||||||
|
Loading…
Reference in New Issue
Block a user