gennaro-tedesco / nvim-possession

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

Files that are deleted still shows in session file. #26

Closed I-Own-You closed 1 year ago

I-Own-You commented 1 year ago

I have encountered a issue.

If i delete a file within ranger plugin in neovim, the session still shows it after loading it the next time, if i update it the same is happening. I tried another session plugin and it behaves the same.

I tried deleting the file within the command line, and then it works as expected.

Here is a video to understand better.

https://github.com/gennaro-tedesco/nvim-possession/assets/91146968/c9135e39-2f42-4158-b8b1-6cee6490d98e

gennaro-tedesco commented 1 year ago

Good evening! I don't understand very well, in your screencast you show you're deleting the file 1.lua and then checking that django-tips.txt is still there? Why wouldn't it be? Moreover

the session still shows it after loading it the next time,

I don't see the sessions being invoked from the video, what command are you invoking exactly? Are you saving the session manually after deleting the file or are you using the auto-save mechanism?

I-Own-You commented 1 year ago

Good evening! I don't understand very well, in your screencast you show you're deleting the file 1.lua and then checking that django-tips.txt is still there? Why wouldn't it be? Moreover

the session still shows it after loading it the next time,

I don't see the sessions being invoked from the video, what command are you invoking exactly? Are you saving the session manually after deleting the file or are you using the auto-save mechanism?

I point to the file 1.lua with my mouse, not django-tips, i am deleting the 1.lua, then i exit vim and enter it again, and 1.lua still shows but it shouldnt, it is shown in the video, the saving session i invoke procession.set(), to show the list procession.list() as in documentation, it works as expected, i dont have problems with that

gennaro-tedesco commented 1 year ago

After you delete the 1.lua file with ranger, can you please check whether such buffer still exists in the list of buffers that are in memory and/or as a tab (since when you open it back again it shows as tab I presume you opened it as such, initially)?

Moreover can you try to reproduce the behaviour with both autosave = true and false (in the latter case, by manually saving the session before exiting)? Does it happen with either parameter being set?

I-Own-You commented 1 year ago

After you delete the 1.lua file with ranger, can you please check whether such buffer still exists in the list of buffers that are in memory and/or as a tab (since when you open it back again it shows as tab I presume you opened it as such, initially)?

Moreover can you try to reproduce the behaviour with both autosave = true and false (in the latter case, by manually saving the session before exiting)? Does it happen with either parameter being set?

Sure, but after 15-20 min, so i arrive at home

I-Own-You commented 1 year ago

After you delete the 1.lua file with ranger, can you please check whether such buffer still exists in the list of buffers that are in memory and/or as a tab (since when you open it back again it shows as tab I presume you opened it as such, initially)?

Moreover can you try to reproduce the behaviour with both autosave = true and false (in the latter case, by manually saving the session before exiting)? Does it happen with either parameter being set?

When i delete 1.lua, it doesnt exist in :buffers. Both autosave = true/false behave the same, 1.lua still appears

When i close the buffer, and then delete it, the buffer then doesnt appear(as expected)

gennaro-tedesco commented 1 year ago

When i delete 1.lua, it doesnt exist in :buffers.

but it does exist as empty buffer in a different tab, doesn't it (in your recording it's shown as opened in a different tab)?

When i close the buffer,

what buffer are you referring to here?

The reason I am asking is because I suspect that the ranger plugin you're using may delete the file in your tree view but still preserve it in the current nvim session (just removing its content, and hence as "empty" buffer). What nvim-possession does is merely invoking the command :mksession, thus you would get the same behaviour by manually saving the sessions (it doesn't really depend on the plugin, but rather on how the ranger file tree deletes files in a vim session).

I-Own-You commented 1 year ago

When i delete 1.lua, it doesnt exist in :buffers.

but it does exist as empty buffer in a different tab, doesn't it (in your recording it's shown as opened in a different tab)?

When i close the buffer,

what buffer are you referring to here?

The reason I am asking is because I suspect that the ranger plugin you're using may delete the file in your tree view but still preserve it in the current nvim session (just removing its content, and hence as "empty" buffer). What nvim-possession does is merely invoking the command :mksession, thus you would get the same behaviour by manually saving the sessions (it doesn't really depend on the plugin, but rather on how the ranger file tree deletes files in a vim session).

What do you mean a buffer in a different tab ? No, it doesnt exist at all, if it would be in a tab, in the right upper corner i would see that, so it is opened as a buffer. I am referring to 1.lua.

How it can remain as empty buffer if it doesnt exist ? And when i delete it, the buffer disappears, why would it come back when i load the session on next startup ?

So the problem is not on your side ?

gennaro-tedesco commented 1 year ago

How it can remain as empty buffer if it doesnt exist ?

This depends on what exactly the ranger plugin does: does it completely remove the file from disk, or does it remove the content only whilst preserving the memory location while in a vim session?

This said: in order to determine where the behaviour lies, could you please try to, after deleting the file, manually invoke :mksession <session name> and save the session manually? Once so, would the file still be present in such a manually saved session?

I-Own-You commented 1 year ago

Yes, the file still appears The file is completely deleted from my directory

gennaro-tedesco commented 1 year ago

If the file still appears even by manually saving the session then it means that ranger doesn't really delete the memory buffer :)

As such, this is to be addressed to the ranger plugin rather than the vim session mechanism.

I-Own-You commented 1 year ago

Okay, it seems that the file persists even if i dont delete it and just close it, and all files opened in neovim through ranger plugin doesnt go away, they persist in the session, and if i open them with neovim(in this case with fzf-lua :buffers), then i can close them/delete through ranger and they will go away, so the problem is opening newly created(empty) files through ranger, this is sick