-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Create different sessions for different git branches #68
Comments
That's not really what I was looking for, I also like this plugin's quality of not having to think about it, so I wouldn't like to have project-local directory/files to manage. Besides that, for my specific use-case, I think it wouldn't work, as in most project I'm working on I can't sync that kind of files to the repo. I was actually thinking of something simpler, like just appending the branch name to the session's filename, so a single directory could have multiple sessions, one for each branch. What do you think? |
@rmagatti I'm not able to reopen the issue, but hope you take a look at this |
There are three main concerns I have with that.
That said, I think this could be a good optional feature, I just wouldn't want it as part of the core functionality. Point number 3 there is really the most concerning part imo, this can prove difficult to handle. |
I wrote a big reply and then closed my browser on mistake :c |
Hey @rmagatti, sorry for the delay. Those are all valid points, but I think making the behavior I'm proposing optional Point 3 has two aspects: how does autorestore behave when changing branches and how does autosave behave. For this, I'll AutorestoreI think it shouldn't do anything. There's no good way for us to know exactly when a user switches branches. The only one I can think of is running a check on Even if we could know when the change happens, if a user changed branches without closing Neovim, it's either one of two cases:
Seeing as there is correct options and we can't know what behavior the user prefers each time they change branches, I think opting for the less intrusive way (of doing nothing) is better --- in which case, if they want AutosavingKnowing that a user changed branches (that the branch in which they're quitting Neovim is different than the one they started it in) is easier than knowing when they did it. We can just store the startup branch on a global variable (vim's? lua's? don't which would be more appropriate) and check, on VimLeave, check the active branch against it. For this I see three options, when changing from
Again, as we can't know for sure what the user prefers each time, so maybe this could be an option. Honestly tho, I really think it's safe to assume that if the user changed branches without closing Neovim and didn't restore Also, the plugin could maybe expose a command to quit Neovim without triggering the autosave. I think this'd be cool regardless of which of the above behaviors is default --- many times I've restored a session to do something quickly and would rather not overwrite it after. Optimal scenarioNow that I think of it, maybe the best-case scenario (if we knew exactly when the user changed branches) would be to immediately autosave |
Any progress? Need this feature too. Every time I quit nvim → switch to another branch → open nvim, files in the previous branch become 'no name', even if I switch back won't recover the session. So I have to operate carefully to prevent my session from being destroyed. |
I actually never got around to trying this, life got busy after my last comment =/ |
I actually came here to request this same idea. I could care less for detecting the git checkout and autosaving/reloading. If I want to change branches then I'd shutdown nvim (:qa), checkout, and then reopen nvim. |
If no one else is working on this I may be able to do it. I recently realized this is a feature I can really use. |
I've submitted PR #121. A very bare-bones effort at this feature.
|
PR #121 is merged. Thanks for working on it @WhoIsSethDaniel! 🎉 |
I'd like to have different sessions (with auto-save and auto-restore) for multiple branches on the same directory, so I don't keep overwriting the session whenever changing branches. I could maybe make a PR for this if you'd be ok with that
The text was updated successfully, but these errors were encountered: