This commit is contained in:
zbirenbaum 2022-04-29 19:14:30 -04:00
parent 263dcc0115
commit d16546acac
1 changed files with 5 additions and 6 deletions

View File

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