Support autoloading session for the current git repository #128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.