Vim plugin to list, select and switch between buffers.
Use
b(typically:
\b) to open a window listing all buffers. In this window, you can use normal movement keys to select a buffer and then:
Use
gb(or ) and
gB(or ) to flip through the most-recently used buffer stack without opening the buffer listing "drawer".
Use
, , , to split a new window left, up, right, or down, respectively, and edit the previous MRU buffer there.Many other options are supported: (e.g. open in existing window/tab, or in the same window; preview buffer without leaving buffer listing; "pin" the buffer listing so that it is open all the time, etc. etc.)
Buffergator is a plugin for listing, navigating between, and selecting buffers to edit. Upon invocation (using the command,
:BuffergatorOpenor
BuffergatorToggle, or the provided key mapping,
b), a "catalog" of listed buffers are displayed in a separate new window split (vertical or horizontal, based on user options; default = vertical). From this "buffer catalog", a buffer can be selected and opened in an existing window, a new window split (vertical or horizontal), or a new tab page.
Selected buffers can be "previewed", i.e. opened in a window or tab page, but with focus remaining in the buffer catalog. Even better, you can "walk" up and down the list of buffers shown in the catalog by using
(or ) / (or ). These keys select the next/previous buffer in succession, respectively, opening it for preview without leaving the buffer catalog viewer.The buffer opening commands follow that of NERDTree. Examples:
oto open it in the previous window.
42and or
oto open buffer number 42 in the previous window.
goto open the currently selected buffer in the previous window, but with focus remaining in the buffer catalog (
42gowill do the same, but will select buffer number 42).
sto open the currently selected buffer in new vertical split.
Swill open the buffer in a new vertical split, but keep the focus in the buffer catalog. (
42sor
42Swill do the same, but will select buffer number 42)
ito open the currently selected buffer in new horizontal split.
Iwill open the buffer in a new vertical split, but keep the focus in the buffer catalog. (
42ior
42Iwill do the same, but will select buffer number 42)
tto open the currently selected buffer in new tab (
42twill do the same, but will select buffer number 42).
To reduce strain on muscle-memory, the following Ctrl-P keymaps are also supported:
Other key maps allow you to jump to a target buffer in an open window/split/tab page if it is already active there instead of creating a new window. Minimal management of buffers (wiping/dropping) are also provided.
Buffergator also provides a way to list tab pages and buffers associated with windows in tab pages (the "tab page catalog", which can be invoked using the command
:BuffergatorTabsOpenor the provided key mapping,
to).
The buffer listing can be sorted alphabetically by filename, by full filepath, by extension followed by filename, or by most-recently used (MRU).
By default, Buffergator provides global key maps that invoke its main commands:
bto open and
Bto close the buffer catalog, and
toto open and
tcto close the tab page catalog. In addition, in normal mode from any buffer, you can flip through the MRU (most-recently-used) buffer list without opening the buffer catalog by using the
gb(or ) and
gB(or ) keys, or flip through the buffers in buffer (number) order by using
[band
]b. If you prefer to map other keys, or do not want any keys mapped at all, set
g:buffergator_suppress_keymapsto 1 in your $VIMRUNTIME.
[NOTE: If you have other plugins installed that have key maps that start with
b(e.g., BufExplorer, which uses
bs,
bv, etc.), then you may notice a slight delay or lag when typing the default
bto start Buffergator. In this case, you should either use another keymap for Buffergator or BufExplorer.]
Detailed usage description given in the help file, which can be viewed on-line here:
http://github.com/jeetsukumaran/vim-buffergator/blob/master/doc/buffergator.txt
Source code repository can be found here:
http://github.com/jeetsukumaran/vim-buffergator
NOTE: There are many other plugins that provide similar functionality. This plugin is very much in the "BufExplorer" and "SelectBuf" vein, in that it provides a full-window buffer "view" of the buffers. I wanted a plugin that (a) listed the loaded buffers in a (optionally-)persistant "drawer", (b) allowed me to preview buffers without leaving the drawer, and (c) allowed me to walk up and down the list of buffers, previewing them, but without leaving the drawer. None of the existing plugins did this (as far as I know), and hence I rolled out this one. The other plugins provide more functionality with respect to other operations (e.g., buffer management), that I did not have an immediate need for, so I did not incorporate it into this plugin.