Vim Tips Wiki

Remember my buffers

Redirected from VimTip905

1,624pages on
this wiki
Add New Page
Talk0 Share
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.

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