Shatur/neovim-session-manager

load_current_dir_session incorrectly loads last session

Subjective opened this issue · 3 comments

Bug description

Running nvim "+SessionManager load_current_dir_session" from the shell loads the last session instead of the session associated with the current working directory.

Steps to reproduce

Minimal configuration
{
  "Shatur/neovim-session-manager"
}
  1. cd into a directory
  2. launch neovim and load session
  3. exit neovim and cd into another directory
  4. run nvim "+SessionManager load_current_dir_session"

Expected behavior
I expected neovim open the session associated with the cwd of the parent shell, not the last session.

Screenshots

Screen Recording 2023-04-11 at 12 38 23 AM

Environment

  • OS: MacOS Ventura 13.3
  • Plugins commit hash: d1883f3

Additional context

There are two main use cases I have for this: 1) I'd like to set this to a convenient alias to quickly open the neovim session associated with any working directory from the terminal, and 2) I can have tmux resurrect restore the correct neovim sessions associated with each split/window's cwd after restarting tmux. Thanks.

I think it happens because you have autoload_mode set to require('session_manager.config').AutoloadMode.LastSession

That seems to have fixed it, thanks! Any idea why it doesn't matter what arguments are passed in? I thought the arguments would have to be one of the following: load_session, load_last_session, load_current_dir_session, save_current_session, delete_session, but that doesn't seem to be the case.

Random Argument

Passing in no arguments throws an error:

No Argument

Any idea why it doesn't matter what arguments are passed in?

This setting takes precedence over the passed command. You don't need to run neovom like this.

Passing in no arguments throws an error:

Because you need a subcommand.