Open dhruvasagar opened 10 years ago
So I've been using that VimEnter autocommand for a while with good results, although it still occasionally catches me by surprise. Maybe it's time to merge it in but disabled by default?
I certainly see a lot of value in a canonical central source of session files. I'm a biased against having a directory in .vim
because I like to keep that for shared config only. (BTW, those directories are usually singular, so you might consider naming the default ~/.vim/session
instead.) In sensible.vim I tried to find a canonical place to put that sort of stuff and failed miserably.
Lately my technique for switching being projects has been to make use of $CDPATH
(and the Vim equivalent 'cdpath'
). This plus globpath(&cdpath, '*/Session.vim')
is giving me some cool ideas.
Yea I like the general idea, and am quite pleased with the results & the workflow. I am sure it can be improved in several ways.
I'd like this to be merged in too, I am perfectly fine having it disabled by default, though I am not quite sure how to approach the merging in. Need your help for that, if you could quickly review the code it would be great, it's pretty small so shouldn't take a lot of time.
I am not very sure I understand the concept of 'cdpath' or how it's used.
Also although I keep these within .vim
, they're on .gitignore
so they don't trouble git. I like to keep them there for the lack of a better place. I'll change the default to ~/.vim/session
makes sense :).
I've been using autojump for a while, never knew about $CDPATH
, this is epic! I'll add support for this and send a PR soon.
@dhruvasagar
Any update on that &cdpath
approach?
I could imagine using it from/in prosession additionally to the central place for session files?
(let's consider moving it to an issue in prosession)
I haven't added that support, the central location seems to work better and most people don't have cdpath configured.
vim-prosession
is extremely useful for me.
@dhruvasagar thanks for your solution. I had been spending a lot of hours before found your plugin
I've had a few years to think.
VimEnter
autocommand fires if there are zero filename arguments, which means it breaks for usecases like vim +Gstatus
or vim -S/dev/null
. Unless someone finds a workaround that's as good as dead.g:obsession_home
variable that specifies a default path for relative filenames. Users could still use ./path
to target the current directory.:Obsession < file
. I don't like the mess it creates if you have modified buffers, but I am fine to leave it as caveat emptor.I've had a few years to think.
- The
VimEnter
autocommand fires if there are zero filename arguments, which means it breaks for usecases likevim +Gstatus
orvim -S/dev/null
. Unless someone finds a workaround that's as good as dead.
At the moment I rely on argc()
and StdInReadPost
to skip cases file arguments and stdin. Other scenarios, last I checked weren't reliably detected.
- I would be okay with a
g:obsession_home
variable that specifies a default path for relative filenames. Users could still use./path
to target the current directory.
Sounds fair
- Does switching between sessions effectively mean sourcing the session file? I could see sticking that somewhere like
:Obsession < file
. I don't like the mess it creates if you have modified buffers, but I am fine to leave it as caveat emptor.
Switching means sourcing the session file, but also removing the current session's buffers (after stopping it's session)
Hey Tim,
Yesterday I wrote vim-prosession which leverages vim-obsession to allow for autoloading of sessions on launch (in case no arguments were passed to vim) as well as provides a simple command with completion to enable switching between sessions easily. The idea is to use a session per project and you can easily switch sessions when you wish to switch context. This enables cleaner & isolated project sessions that keep buffers & settings that belong only for that project / session.
Wanted to know what your thoughts on the same might be ?