Wikia

Vim Tips Wiki

Changes: Very basic session persistence

Edit

Back to page

(Quick tweak + add "see also" of similar tips)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 4: Line 4:
 
|previous=237
 
|previous=237
 
|next=239
 
|next=239
|created=April 25, 2002
+
|created=2002
 
|complexity=basic
 
|complexity=basic
 
|author=Michel de Bree
 
|author=Michel de Bree
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
I use the following code in my plugins directory to ease session persistence. If I want my session to persist I use <tt>:mks!</tt> and then whenever I open the <tt>session.vim</tt> 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 <tt>session.vim</tt> a bit cumbersome.
+
I use the following code in my plugins directory to ease session persistence. If I want my session to persist I use <code>:mks!</code> and then whenever I open the <code>session.vim</code> 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 <code>session.vim</code> a bit cumbersome.
   
 
<pre>
 
<pre>

Latest revision as of 05:20, July 13, 2012

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
  endif
endfunction

See alsoEdit

 TO DO 
Probably need to merge some of these.

CommentsEdit

Around Wikia's network

Random Wiki