stevearc / resession.nvim

A replacement for mksession with a better API
MIT License
221 stars 15 forks source link

Extra `[No Name]` buffer is created #4

Closed RaafatTurki closed 1 year ago

RaafatTurki commented 1 year ago

As the titles says a [No Name] buffer comes into existence out of thin air, I've done some debugging and arrived at resession.

The buffer is created whenever a session that was saved after a new tab has been created is loaded, which as you can imagine a situation that automates itself once auto saving sessions on quit is added

Repro

1- use the following init.lua

require "paq" {
    {'stevearc/resession.nvim'};
}

vim.o.clipboard = 'unnamedplus'
vim.o.number = true

local resession = require('resession')
resession.setup()
vim.keymap.set('n', 'sl', function() resession.load('last') end)

vim.api.nvim_create_autocmd("VimLeavePre", {
  callback = function()
    resession.save("last")
  end,
})
  1. open any file with nvim, :tabnew then :qall
  2. open nvim, sl then :ls and observe the newly created [No Name] buffer

Here's me showcasing the bug

stevearc commented 1 year ago

I've adjusted the default settings to skip saving empty name buffers, and fixed a bug where new-tab buffers would hang around after load. I believe that should fix this issue

RaafatTurki commented 1 year ago

Fabulous!