From 6eba681feec66d7f1ae7142e068234d939dc9e53 Mon Sep 17 00:00:00 2001 From: kygr Date: Sun, 15 Sep 2024 16:15:52 +0200 Subject: [PATCH] fix(pinned): buffer does not exist after switching sessions 1) After restoring a session, the buffer ids have changed and the old ones are not valid. --- lua/bufferline/groups.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/bufferline/groups.lua b/lua/bufferline/groups.lua index a1aefc25..b9e5b364 100644 --- a/lua/bufferline/groups.lua +++ b/lua/bufferline/groups.lua @@ -150,7 +150,9 @@ local group_state = { local function persist_pinned_buffers() local pinned = {} for buf, group in pairs(group_state.manual_groupings) do - if group == PINNED_ID then table.insert(pinned, api.nvim_buf_get_name(buf)) end + if group == PINNED_ID and vim.fn.bufexists(buf) == 1 then + table.insert(pinned, api.nvim_buf_get_name(buf)) + end end if #pinned == 0 then