mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 12:50:37 +00:00
allow showing of buffer in a different tab if its already opened in another tab #1297
This commit is contained in:
parent
d4c71e1472
commit
7654a1fc8c
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue