summaryrefslogtreecommitdiff
path: root/lua/functions.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/functions.lua')
-rw-r--r--lua/functions.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lua/functions.lua b/lua/functions.lua
index 6ec4658..7d95ac3 100644
--- a/lua/functions.lua
+++ b/lua/functions.lua
@@ -110,7 +110,7 @@ function _G.close_current_buffer()
local all_buffers = vim.fn.getbufinfo()
- local buffers = table.filter(
+ local file_buffers = table.filter(
all_buffers,
function(buf_info)
return buf_info.loaded == 1
@@ -121,10 +121,10 @@ function _G.close_current_buffer()
end
)
- if #buffers ~= 0 then
- vim.cmd("buffer " .. buffers[1].bufnr)
- else
+ if #file_buffers == 0 then
vim.cmd("new")
+ else
+ vim.cmd("buffer " .. file_buffers[1].bufnr)
end
vim.api.nvim_buf_delete(current_buf_nr, { force = true })