Vim Tips Wiki

Very basic session persistence

Redirected from VimTip238

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 238 Printable Monobook Previous Next

created 2002 · complexity basic · author Michel de Bree · version 6.0

I use the following code in my plugins directory to ease session persistence. If I want my session to persist I use :mks! and then whenever I open the session.vim file, my session is restored. If I am working from a restored session and I close Vim, the session is saved automatically. Drawback is that it makes editing session.vim a bit cumbersome.

au BufRead session.vim so %
au VimLeave * call SaveCurrentSession()
function! SaveCurrentSession()
  if v:this_session != ""
    exe "mksession! " . v:this_session

See alsoEdit

Probably need to merge some of these.


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki