Handling change in directory before saving
cnrrobertson opened this issue · comments
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.
👋🏼 @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.
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..
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.