gennaro-tedesco / nvim-possession

📌 the no-nonsense session manager
MIT License
215 stars 7 forks source link

Loading a saved session doesn't restore properly #3

Closed jackfranklin closed 1 year ago

jackfranklin commented 1 year ago

Hey,

I gave this a go and unfortunately I can't get it working, which may well be an issue on my end, but I would appreciate some pointers trying to figure it out.

I have loaded the plugin using Packer, and my config looks like this:

local possession = require("nvim-possession")
possession.setup()
vim.keymap.set("n", "<leader>sl", function()
  possession.list()
end)
vim.keymap.set("n", "<leader>sn", function()
  possession.new()
end)
vim.keymap.set("n", "<leader>su", function()
  possession.update()
end)

I can save a session and have it appear in the list correctly, but when I select one and hit enter, I get taken into that directory, but none of the files I had open are visible. It's like it has remembered the working directory of the session but no other details.

I also get a lot of other sessions pop up in the list that I am not explicitly creating via nivm-possession, it is like Vim is auto saving those, but they also fail to load correctly if I try to select them. Are there additional details I need to have this all work, or is the problem likely deep within my config? I am happy to debug further if required. Thanks!

gennaro-tedesco commented 1 year ago

Good afternoon and thank your for reporting this issue. First of all let us verify that your session files are properly located and loadable independently of the plugin: in order to do so invoke

lua vim.cmd.source("/path/to/session/file")

from within neovim, where /path/to/session/file/ is the full path of your session file on your computer (such path should ideally correspond to vim.fn.stdpath("data") .. "/sessions/"). The above command is nothing but what the plugin does to load sessions (see here) up to appending the proper paths to the file name.

Are you able to load the session by doing so?

Next we need to verify what your session path is (it may not necessarily correspond to vim.fn.stdpath("data").."/sessions/").

I also get a lot of other sessions pop up in the list that I am not explicitly creating via nivm-possession

This is expected, because nvim-possession loads all session files in your session path (up to some regex parsing), so not exclusively the ones created by itself.

jackfranklin commented 1 year ago

Apologies for the noise, I had an old session plugin that I thought I had uninstalled but I had not. It was conflicting. Once I properly removed those files from my system, this plugin works perfectly. Thanks!