Vim Tips Wiki

Very basic session persistence

1,613pages on
this wiki
Revision as of 05:20, July 13, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.


Around Wikia's network

Random Wiki