mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 12:50:37 +00:00
fix #1215
This commit is contained in:
parent
1383117bd3
commit
6bb209a834
1 changed files with 3 additions and 3 deletions
|
@ -6,8 +6,9 @@ local merge_tb = vim.tbl_deep_extend
|
|||
|
||||
M.close_buffer = function(force)
|
||||
if vim.bo.buftype == "terminal" then
|
||||
api.nvim_win_hide(0)
|
||||
return
|
||||
force = force or #api.nvim_list_wins() < 2 and ":bd!"
|
||||
local swap = force and #api.nvim_list_bufs() > 1 and ":bp | bd!" .. fn.bufnr()
|
||||
return vim.cmd(swap or force or "hide")
|
||||
end
|
||||
|
||||
local fileExists = fn.filereadable(fn.expand "%p")
|
||||
|
@ -20,7 +21,6 @@ M.close_buffer = function(force)
|
|||
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" .. fn.bufnr()
|
||||
vim.cmd(close_cmd)
|
||||
|
|
Loading…
Reference in a new issue