Shatur / neovim-session-manager

A simple wrapper around :mksession.
GNU General Public License v3.0
530 stars 52 forks source link

Warning about possible unwanted behavior #96

Closed Zeioth closed 1 year ago

Zeioth commented 1 year ago

When using the BufWritePre event. → Feel free to ignore or edit this commit.

Zeioth commented 1 year ago

I wonder what strategy we could follow to fix this. Or if it is fixable even. I've tried to delete the block:

  for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
    if vim.api.nvim_buf_is_valid(buffer) and not utils.is_restorable(buffer) then
      vim.api.nvim_buf_delete(buffer, { force = true })
    end
  end

And it is true having it fixes many unwanted scenarios (for example, restoring neotree would cause an inconsistent state on that plugin).

On the other side saving session only on VimLeave won't save the session in some scenarios like a power loss.

Shatur commented 1 year ago

Thanks! Not sure if it's possible to do something about it.