Sunday, November 28, 2010

save and restore the buffer list (last edited opened files) across Vim sessions

Is it possible to save and restore the buffer list across Vim sessions?

Yes. To save and restore the buffer list across Vim session, include the '%' flag in the 'viminfo' option. Note that if Vim is invoked with a filename argument, then the buffer list will not be restored from the last session. To use buffer lists across sessions, invoke Vim without passing filename arguments.

# vim ~/.vimrc
set viminfo+=%

Some scripts for buffer switching are listed below, in order by the script id. You can search Vim Scripts for "buffer" to find others.

[] bufexplorer A popular buffer explorer.
[] SelectBuf A fast and extensible buffer explorer.
[] selbuff Another buffer select script
[] PopupBuffer To select a buffer from a PopUp menu.
[] minibufexpl A popular buffer explorer which takes very little screen space.
[] FavMenu
[] mru
[] incbufswitch Switch buffers using an incremental search.
[] bufmenu2 More balanced buffers menu hierarchy.
[] buflist Buffer browser.
[] TinyBufferExplorer A 1-file buffer list plugin with grouping.
[] bufferlist Simple, fast, and slick non-disturbing buffer list.
[] TabBar
[] bufmap Automatically maps buffers to function keys.
[] buftabs Minimalistic buffer tabs saving screen space.
[] bufpos Switch buffer with Alt-.
[] tselectbuffer A quick buffer selector/switcher.
[] LustyExplorer Dynamic filesystem and buffer explorer.
[] QuickBuf Very small but quick and powerful buffer manager.
[] fuzzyfinder Explore buffer/file/MRU/favorite with a fuzzy pattern.
[] LustyJuggler Switch very quickly between active buffers.
[] QuickName Conveniently navigate buffers; incremental search by name.
[] bufmru Quickly switch to most recently used buffer.
[] vimuiex Commands: VxBufListSelect/VxOpenRecentFile/VxFileBrowser, with filtering and MRU
[] QuickNameBuf Quickly navigate between buffers using an incremental search by name (a combination of QuickName and QuickBuf)

Reference:
http://vim.wikia.com/wiki/Vim_buffer_FAQ
http://vim.wikia.com/wiki/VimTip686

No comments: