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

Load session for specific directory #80

Open
twiddli opened this issue Apr 17, 2023 · 11 comments
Open

Load session for specific directory #80

twiddli opened this issue Apr 17, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@twiddli
Copy link

twiddli commented Apr 17, 2023

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.

@twiddli twiddli added the enhancement New feature or request label Apr 17, 2023
@Shatur
Copy link
Owner

Shatur commented Apr 17, 2023

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

@twiddli
Copy link
Author

twiddli commented Apr 17, 2023

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.

@Shatur
Copy link
Owner

Shatur commented Apr 17, 2023

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()

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

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?

@Shatur
Copy link
Owner

Shatur commented Jun 27, 2023

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.

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

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.

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

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

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

@Shatur
Copy link
Owner

Shatur commented Jun 27, 2023

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.

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

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:

изображение

@Shatur
Copy link
Owner

Shatur commented Jun 27, 2023

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.

@pda-gb
Copy link

pda-gb commented Jun 27, 2023

ок

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants