olimorris / persisted.nvim

💾 Simple session management for Neovim with git branching, autoloading and Telescope support
MIT License
418 stars 24 forks source link

Update logic for autoload or starting sessions. #104

Closed neandrake closed 6 months ago

neandrake commented 6 months ago

The logic to prevent autoloading/starting sessions when any arguments are supplied to neovim is to prevent session management from kicking in when editing a single file.

This updates the logic to allow a single argument passed to neovim as long as the argument is an existing directory. When neovim is launched in this way it behaves the same as opening neovim with no arguments but has changed the working directory.

This results in consistent behavior of the autoloading/starting of sessions when passing a directory argument to start neovim.

See: https://github.com/olimorris/persisted.nvim/discussions/93

neandrake commented 6 months ago

@Dioswilson I made some updates that I think will resolve most of the odd state you identified.

olimorris commented 6 months ago

This is a great PR. Thanks for your contribution.

I tried to rename the functions and update the comment blocks (mainly to aid myself when it comes to maintaining) but couldn't push it to the PR...something up with my Git config. So will merge and then and re-apply them.