Wikia

Vim Tips Wiki

Changes: Remember my buffers

Edit

Back to page

(change "anon" author to blank; trim "created" date; minor manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 21: Line 21:
 
The '%' flag tells vim to remember your list of opened buffers in your viminfo file.
 
The '%' flag tells vim to remember your list of opened buffers in your viminfo file.
   
Try, for example, opening Vim and editing your vimrc file. Then without using <tt>:bd</tt> to delete the buffer, quit Vim (<tt>:wq</tt>). If you open Vim again, check your buffer list (<tt>:ls</tt>) and you will notice that the vimrc buffer is still there.
+
Try, for example, opening Vim and editing your vimrc file. Then without using <code>:bd</code> to delete the buffer, quit Vim (<code>:wq</code>). If you open Vim again, check your buffer list (<code>:ls</code>) and you will notice that the vimrc buffer is still there.
   
 
==Comments==
 
==Comments==

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

Tip 905 Printable Monobook Previous Next

created 2005 · complexity basic · version 5.7


Vim can remember the list of your opened buffers even after you close Vim.

In Vim, or vimrc do:

:exec 'set viminfo=%,' . &viminfo

The '%' flag tells vim to remember your list of opened buffers in your viminfo file.

Try, for example, opening Vim and editing your vimrc file. Then without using :bd to delete the buffer, quit Vim (:wq). If you open Vim again, check your buffer list (:ls) and you will notice that the vimrc buffer is still there.

CommentsEdit

Instead of

:exec 'set viminfo=%,' . &viminfo

to put a string at the start of an option you can also use the shorter

:set viminfo^=%

What happens if I open more than one Vim at a time? I would think it would make more sense to save a session instead.


Around Wikia's network

Random Wiki