diff --git a/lua/core/init.lua b/lua/core/init.lua index f9c364e..7e98731 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -39,7 +39,7 @@ autocmd("BufEnter", { vim.t.bufs = vim.api.nvim_list_bufs() -- thx to https://github.com/ii14 & stores buffer per tab -> table -autocmd("BufAdd", { +autocmd({ "BufAdd", "BufEnter" }, { callback = function(args) if vim.t.bufs == nil then vim.t.bufs = { args.buf } @@ -47,7 +47,7 @@ autocmd("BufAdd", { local bufs = vim.t.bufs -- check for duplicates - if not vim.tbl_contains(bufs, args.buf) then + if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then table.insert(bufs, args.buf) vim.t.bufs = bufs end