Shatur / neovim-session-manager

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

Support autoloading session for the current git repository #128

Closed nuchs closed 5 months ago

nuchs commented 5 months ago

I've stolen the code from the first pull request for checking if we're in a git repo and added a new method to load a session for the root of the git repo if we're in one. It work like the other autoload methods so they can be configured to be tried in order (so I have mine try git, cwd, last)

I saw your comment about gitsigns but to be honest spawning the git process happens so fast that it's imperceptable (or at least it is on my machine). I didn't want to make the code more complicated if it didn't really improve the user expereince but I can add the check if you prefer.

I also had a think about your comment about autosaving being separate, and I agree so I've not tried to tackle that. (In my workflow, I save the session on BufWritePre and so it all just sort of works without any special handling required for the git directory)

Sorry about the formatting change to session_manager.setup, I only noticed my editor had done that after I'd pushed. Happy to put that back if your like.

Shatur commented 5 months ago

Thanks, looks good to me. Please, apply the formatting suggested by CI and I will merge it.