This commit is contained in:
zbirenbaum 2022-04-29 19:14:30 -04:00
parent 263dcc0115
commit d16546acac

View file

@ -3,12 +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
cmd ":bd!"
else
-- switch to previous buffer then close current buffer
vim.cmd(":bp | bd" .. vim.fn.bufnr())
end
if vim.bo.buftype == "terminal" then vim.api.nvim_win_hide(0) return end
force = force or not vim.bo.buflisted or vim.bo.buftype == "nofile"
-- if not force, change to prev buf and then close current
local close_cmd = force and ":bd!" or ":bp | bd" .. vim.fn.bufnr()
vim.cmd(close_cmd)
end
M.load_config = function()