From 7654a1fc8c77780753a222c2bd1fb850fa789eab Mon Sep 17 00:00:00 2001 From: siduck Date: Fri, 1 Jul 2022 06:27:40 +0530 Subject: [PATCH] allow showing of buffer in a different tab if its already opened in another tab #1297 --- lua/core/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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