Skip to content
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

The session does not load via $ nvim -c {command} #90

Open
pda-gb opened this issue Jun 27, 2023 · 7 comments
Open

The session does not load via $ nvim -c {command} #90

pda-gb opened this issue Jun 27, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

Bug description

In the terminal, running nvim with the command :SessionManager load_current_dir_ression does not open a session from the current directory:

$ nvim -c ':SessionManager load_current_dir_ression'

Steps to reproduce

  1. I have projects proj_1, proj_2.

$ cd /path/to/root/dir/proj_1 
$ nvim
  • Open a file (file_proj_1) from this project via neo-tree.
  1. Save the session through the menu: {<leader>-Ss}. Close nvim.

$ cd /path/to/root/dir/proj_2
$ nvim
  • Open some file (file_proj_2) from this project with neo-tree.
  1. Save the session through the menu: {<leader>-Ss}. Close nvim.

  2. Then I go to the directory of the first project(proj_1).I run nvim with the command to run from the project session of the current directory.

$ cd /path/to/root/dir/proj_1
$ nvim -c ':SessionManager load_current_dir_session'

Result:
file_proj_2 is open in the buffer, the root directory in the neo-tree is /path/to/root/dir/proj_2. This is the loaded proj_2 session.

Expected behavior
A session of the first project(proj-1) must be open.

Environment

  • OS: macOS 13.4
  • latest nvim + astrovim plugins

Additional context

  • In nvim via terminal mode, the commands :SessionManager [load_current_dir_session | load_last_session | load_session] work.
  • :h -c
@pda-gb pda-gb added the bug Something isn't working label Jun 27, 2023
@Shatur
Copy link
Owner

Shatur commented Jun 27, 2023

Oh, I got it. You probably have autoload_mode = config.AutoloadMode.LastSession in your config. Could you change it to Disabled?

@pda-gb
Copy link
Author

pda-gb commented Jun 27, 2023

LastSession is the default setting? There is no autoload_mode in my config. I searched all over ~/.config/nvim/**

@Shatur
Copy link
Owner

Shatur commented Jun 27, 2023

LastSession is the default setting?

Yes, you need to override it explicitly.

@pda-gb
Copy link
Author

pda-gb commented Jun 28, 2023

I just started dealing with nvim and immediately started with astrovim. It didn't work to add a parameter change.
But I didn't do that. Because it is logically wrong.
Because the default value of the parameter is needed to run the application without specified parameters. When you need one startup with a specific parameter, it is passed in the startup command. And the default value of the parameter is overridden.
Rewriting the configuration file for a single run is a mistake.

Let's look at an example on neo-tree.
The default window position is left. But by running$ nvim -c ":Neotree position=right" it will start with a neo-vim window already open on the right.

I think the plugin is missing getting data from the nvim start command. Now I don't know if this is a bug or a missing feature. I think the developer has to decide what to do - change the tag or leave it. Or just close the issue.

@Shatur
Copy link
Owner

Shatur commented Jun 28, 2023

It didn't work to add a parameter change.

With the mentioned change it works exactly as you described in "expected behavior", I tested it.

The plugin by default autoloads last session when you just call nvim. It's done via autocmd. And you can't override it with -c because it's impossible to detect if there was something sent this way (see :h argc(), it only for files).

What you need is to disable the autoloading the way I said in your configuration and -c will work as you expect.

@pda-gb
Copy link
Author

pda-gb commented Jun 29, 2023

Unfortunately, I do not know how your plugin works with pure nvim, I have it installed through astrovim. And I did not see that the last session is loaded by default.
I understand what you are saying. Apparently I haven't figured it all out yet and I expected the same plugins to work.

@Shatur
Copy link
Owner

Shatur commented Jun 29, 2023

Show me how you installed it, I think you enabled lazy loading and that's why session is not autoloaded by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants