fix tabufline crash when formatting buf | (#1265)

This commit is contained in:
siduck 2022-06-26 06:24:52 +05:30
parent 876295ec02
commit 62b9c09f44
6 changed files with 35 additions and 22 deletions

View file

@ -195,8 +195,20 @@ M.packer_sync = function(...)
end
end
M.bufilter = function()
local bufs = vim.t.bufs
for i = #bufs, 1, -1 do
if not vim.api.nvim_buf_is_loaded(bufs[i]) then
table.remove(bufs, i)
end
end
return bufs
end
M.tabuflineNext = function()
local bufs = vim.t.bufs or {}
local bufs = M.bufilter() or {}
for i, v in ipairs(bufs) do
if api.nvim_get_current_buf() == v then
@ -207,7 +219,7 @@ M.tabuflineNext = function()
end
M.tabuflinePrev = function()
local bufs = vim.t.bufs or {}
local bufs = M.bufilter() or {}
for i, v in ipairs(bufs) do
if api.nvim_get_current_buf() == v then