From d16546acacd61a6c7516d6c155eae9e21dd92126 Mon Sep 17 00:00:00 2001 From: zbirenbaum Date: Fri, 29 Apr 2022 19:14:30 -0400 Subject: [PATCH] fix #977 --- lua/core/utils.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 074f316..04de6b0 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -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()