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

Handling change in directory before saving #32

Closed
cnrrobertson opened this issue Oct 11, 2022 · 3 comments
Closed

Handling change in directory before saving #32

cnrrobertson opened this issue Oct 11, 2022 · 3 comments

Comments

@cnrrobertson
Copy link
Contributor

Hi, thanks for the amazing plugin!

I have a particular workflow where I will open a session in one directory and then possibly change directory to open files in a separate directory (for example notes in Dropbox). However, once I have done this, my session is automatically saved in the new directory location rather than the original. I'd prefer that once a session is opened, it is always saved back to it's original location.

If this is something you'd be open to implementing, it could use a global variable such as vim.g.persistlocation which is used in the VimLeavePre autocommand to determine save location rather than the current directory. This could also be a toggleable option.

If it is interesting to you, I'd be happy to submit a PR.

@olimorris
Copy link
Owner

olimorris commented Oct 11, 2022

👋🏼 @cnrrobertson. Just to check my understanding:

When you've opened up notes from Dropbox in the same session, upon saving the session, it writes the Dropbox location to the session file and not the original location?

What are the sessionoptions that you have set? I'm guessing the change of directory is changing the current working directory which is then written into the session file.

@cnrrobertson
Copy link
Contributor Author

That's right. If I change the working directory (makes telescope searching notes easier), it saves the session file with the new working directory.

And this happens whether I have curdir in sessionoptions or not..

@olimorris
Copy link
Owner

Got it and completely get the use case.

More than happy to accept a pull request for this and also agree that checking for the presence of a global variable is a neat way to solve this.

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

No branches or pull requests

2 participants