Vim Tips Wiki
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.


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.