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

Session save in current folder #109

Open
iwkse opened this issue Jan 19, 2015 · 4 comments
Open

Session save in current folder #109

iwkse opened this issue Jan 19, 2015 · 4 comments

Comments

@iwkse
Copy link

iwkse commented Jan 19, 2015

Hi,
is it a way to save a session file in the current folder?
I think it's handy to have the ability to save the session within the source tree.

@ghost
Copy link

ghost commented Feb 27, 2015

Not a convenient option, but you could use the g:session_directory variable to specify where to save your session files. There might even be a way to automate setting it when you switch to a project folder, or open a certain type of file (but I don't know enough about vim scripting to know how to do that).

@smallhadroncollider
Copy link

I've not tested this much, but the following seems to work:

let g:session_directory = "./" 
let g:session_default_name = "session"
let g:session_autoload = "yes"
let g:session_autosave = "yes"

@smallhadroncollider
Copy link

Or, if you want them stored in a single location (e.g. for syncing between computers):

let g:session_default_name = substitute(getcwd(), "\/", "_", "g")
let g:session_autoload = "yes"
let g:session_autosave = "yes"

e.g. would store a project opened in /Volumes/Projects/onions in ~/.vim/sessions/_Volumes_Projects_onions.vim

@dylan-chong
Copy link

@smallhadroncollider I actually prefer using

let g:session_directory = "./" 
let g:session_default_name = "session"
let g:session_autosave = "yes"

then starting vim with vim -S so that i don't accidentally open the session if i dont want to.

Hopefully this is useful for someone

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

3 participants