Skip to content

Commit

Permalink
fix: don't save or load empty buffers (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 13, 2022
1 parent cd210b8 commit 53b742a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/resession/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ M.load = function(name, opts)
for i, tab in ipairs(data.tabs) do
if i > 1 then
vim.cmd("tabnew")
-- Tabnew creates a new empty buffer. Dispose of it when hidden.
vim.bo.buflisted = false
vim.bo.bufhidden = "wipe"
end
if tab.cwd then
vim.cmd(string.format("tcd %s", tab.cwd))
Expand Down Expand Up @@ -532,6 +535,9 @@ M.default_buf_filter = function(bufnr)
if buftype ~= "" and buftype ~= "acwrite" then
return false
end
if vim.api.nvim_buf_get_name(bufnr) == "" then
return false
end
return vim.bo[bufnr].buflisted
end

Expand Down

0 comments on commit 53b742a

Please sign in to comment.