Shatur/neovim-session-manager

Load session for specific directory

Opened this issue · 11 comments

Describe the problem or limitation you are having

There's a load_current_dir_session but not a load_dir_session which takes a path to a dir.

Describe the solution you'd like

A load_dir_session that takes a path to a dir.

Describe alternatives you've considered

Additional context

If you also add current_dir_session that returns pwd if a session is active or empty string otherwise, implementing features like #39 or #29 should be a breeze even outside of the plugin.

I agree with the idea, but I would keep only load_dir_session and load current dir if the passed path is empty.

Not sure if this warrants a new issue, but it would also be nice to have a general current_sessions or similar that returns a list of all sessions. The usecase would be to display them on something like a dashboard.

Not sure if this warrants a new issue, but it would also be nice to have a general current_sessions or similar that returns a list of all sessions. The usecase would be to display them on something like a dashboard.

Just use this:

function utils.get_sessions()

Just use this:

function utils.get_sessions()

how to use this in the tmuxinator config ?
$ nvim -c ':SessionManager load_current_dir_session' - open last session
$ nvim -c ':SessionManager load_session /path/to/root/project/' -open last session
How to open a custom session via the terminal?

how to use this in the tmuxinator config ?

The function return list of all session. This is what I was asked about.

How to open a custom session via the terminal?

Use :SessionManager load_session and it will let you select a session.

Upd.:
$ nvim -c ':SessionManager [load_current_dir_session | load_last_session | load_session /path/to/root/project/]' always does one thing - it does not load the last session. Loads the last opened buffers. I opened a random file not from sessions and through this command was loaded not the specified session, but this file.
I also accidentally made a mistake in init.lua and nvim did not load but crashed with an error. So in the last run there were no open buffers. So I decided to do an experiment: run nvim like this - $ nvim -c ':SessionManager load_last_session'. And since this doesn't actually load the last session, but the last open buffers(which are not there), nvim crashed out with an error.

Use :SessionManager load_session and it will let you select a session.

as I already wrote, this will load the last open buffers

I don't understand you.

There is no such command :SessionManager load_session /path/to/root/project/. load_session does not accept any argument. It opens session selection.

always does one thing - it does not load the last session. Loads the last opened buffers.

Not sure what you meant by that.
See https://github.com/Shatur/neovim-session-manager#commands for commands and how they work.

load_session does not accept any argument. It opens session selection

I know. Someone wrote in the comments about this application and I just tried it. But still all three options :SessionManager do load the last buffers.
Now running via terminal: nvim -c ':SessionManager load_current_dir_ression' will get an error:

изображение

But still all three options :SessionManager do load the last buffers.

Please, open a new issue with minimal steps to reproduce and with explanation of what you expect and what actually happens. Because I'm not sure if I understand you.

ок