sponsor Vim development Vim logo Vim Book Ad

Buffergator : Buffer listing, selection, and switching/navigation utility

 script karma  Rating 182/52, Downloaded by 6678  Comments, bugs, improvements  Vim wiki

created by
Jeet Sukumaran
 
script type
utility
 
description
Summary
=======

- Use `<Leader>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:

    - <ENTER> to edit the selected buffer in the previous window
    - <C-V> to edit the selected buffer in a new vertical split
    - <C-S> to edit the selected buffer in a new horizontal split
    - <C-T> to edit the selected buffer in a new tab page

- Use `[b` (or <M-b>) and `]b` (or <M-S-b>) to flip through the most-recently
  used buffer stack without opening the buffer listing "drawer".

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.)

Details
=======

Buffergator is a plugin for listing, navigating between, and selecting buffers
to edit. Upon invocation (using the command, ":BuffergatorOpen" or
"BuffergatorToggle", or the provided key mapping, "<Leader>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 <C-N> (or <SPACE>) /
<C-P> (or <C-SPACE>). 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:

    - Use movement keys (h,j,k,l) to select a buffer from the list, then type
      <CR> or "o" to open it in the previous window.
    - Type "42" and <CR> or "o" to open buffer number 42 in the previous
      window.
    - You can use "go" to open the currently selected buffer in the previous
      window, but with focus remaining in the buffer catalog ("42go" will do
      the same, but will select buffer number 42).
    - You can use "s" to open the currently selected buffer in new vertical
      split. "S" will open the buffer in a new vertical split, but keep the
      focus in the buffer catalog.  ("42s" or "42S" will do the same, but will
      select buffer number 42)
    - You can use "i" to open the currently selected buffer in new horizontal
      split. "I" will open the buffer in a new vertical split, but keep the
      focus in the buffer catalog.  ("42i" or "42I" will do the same, but will
      select buffer number 42)
    - You can use "t" to open the currently selected buffer in new tab ("42t"
      will do the same, but will select buffer number 42).

To reduce strain on muscle-memory, the following Ctrl-P keymaps are also
supported:

   - <C-V> : open in new vertical split
   - <C-S> : open in new horizontal split
   - <C-T> : open in new tab

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 ":BuffergatorTabsOpen" or the provided key mapping, "<Leader>t").

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:
"<Leader>b" to open and "<Leader>B" to close the buffer catalog, and
"<Leader>t" to open and "<Leader>T" to 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 "[b" (or <M-b>) and "]b" (or <M-S-b>) keys.  If you prefer to map other
keys, or do not want any keys mapped at all, set
"g:buffergator_suppress_keymaps" to 1 in your $VIMRUNTIME.

[NOTE: If you have other plugins installed that have key maps that start with
"<Leader>b" (e.g., BufExplorer, which uses "<Leader>bs", "<Leader>bv", etc.),
then you may notice a slight delay or lag when typing the default "<Leader>b"
to 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.

 
install details
If Pathogen is installed, you can install Buffergator by unpacking the source
archive in $VIMRUNTIME/bundle.  Otherwise, unpack the source archive and copy
"buffergator.vim" to $VIMRUNTIME/plugin and "buffergator.txt" to
$VIMRUNTIME/doc.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-buffergator-v2.4.1.tar.gz 2.4.1 2015-01-20 7.0 Jeet Sukumaran - Use 'gb' and 'gB' as default mappings for going to previous and next MRU buffer to avoid collisions with vim-unimpaired.
vim-buffergator-v2.4.0.tar.gz 2.4.0 2014-04-08 7.0 Jeet Sukumaran - Split into previous MRU buffer
- Ignore netre buffers
- Documentation fixes (thanks Andy Balaam)
- Various bug-fixes
vim-buffergator-v2.3.2.tar.gz 2.3.2 2013-05-09 7.0 Jeet Sukumaran - Split into MRU buffer using <Leader><Left>, <Leader><Up>, <Leader><Right>, and <Leader><Down> keys (for left, top, right, and bottom splits, respectively).
vim-buffergator-v2.3.1.tar.gz 2.3.1 2013-04-27 7.0 Jeet Sukumaran - When cycling through MRU buffers using ']b'/<M-B> and '[b'/<M-S-B> keys, cycle though local-window MRU buffer history instead of global history.
vim-buffergator-v2.3.0.tar.gz 2.3.0 2013-04-25 7.0 Jeet Sukumaran - Navigate the MRU buffer stack using global normal mode keys: in normal mode from any buffer, you can flip through the MRU(most-recently-used) buffer list without opening the Buffergator buffer catalog by using the "[b" (or <M-b>) and "]b" (or <M-S-b>) keys.
vim-buffergator-v2.2.2.tar.gz 2.2.2 2013-04-23 7.0 Jeet Sukumaran - Support for cycling through viewport/window split modes (``cw`` cycle through opening Buffergator in left, top, right, and bottom splits)
- Support for Ctrl-P/Cmd-T split-selection keymaps (CTRL-V to open in vertical split, CTRL-S to open in horizontal split, CTRL-T to open in tab)
- Support for toggling autodismiss modes (``cq``: toggle whether or not Buffergator closes after a buffer selection is made)
vim-buffergator-v2.1.1.tar.gz 2.1.1 2011-11-06 7.0 Jeet Sukumaran   - [BUG FIX] now works with Spanish locales (thanks to kolme)
vim-buffergator-v2.1.0.tar.gz 2.1.0 2011-10-17 7.0 Jeet Sukumaran - NEW FEATURE: Can now use buffer number as [count] preceding key map (so, for example, \"42s\" opens buffer number 42 in a new split).
- BUG FIX:  Buffergator window size remains fixed when window equalization command is given (thanks to Jan Christoph Ebersbach).
- BUG FIX: Alternate buffer designation behaves similar to \":buffer\" command (thanks to Jan Christoph Ebersbach)
vim-buffergator-v2.0.0.tar.gz 2.0.0 2011-09-01 7.0 Jeet Sukumaran - [NEW FEATURE] : Listing/selection/navigation of tab pages and tab page windows
- [NEW FEATURE] : Sort buffers (in buffer catalog) in MRU (most-recently used) order [thanks to Jeff Kinslow, https://github.com/jkins]
- [BUG FIX] : Can handle different locales
vim-buffergator-v1.3.2.tar.gz 1.3.2 2011-07-06 7.0 Jeet Sukumaran - Do not clobber default register when rendering buffer.
vim-buffergator-v1.3.1.tar.gz 1.3.1 2011-06-28 7.0 Jeet Sukumaran - respect autodismiss policy when trying to show existing
- command to only show buffer if it is already visible in a viewport
vim-buffergator-v1.3.0.tar.gz 1.3.0 2011-06-28 7.0 Jeet Sukumaran - Keys/commands to preferentially go to existing viewport already showing currently-selected buffer ('eo', 'es', 'ei', and 'et')
vim-buffergator-v1.2.1.tar.gz 1.2.1 2011-06-14 7.0 Jeet Sukumaran - added (redundant) key-mapping for 'go', 'gi', 'gs' for NERDTree compatibility
vim-buffergator-v1.2.0.tar.gz 1.2.0 2011-06-13 7.0 Jeet Sukumaran - switched to catalog viewer key mappings more consistent with NERDTree: e.g. "o/O", "s/S", "i/I", "t/T" to open/preview in previous window, vertical split, horizontal split, or tab page respectively; (if you prefer the old key-maps, set "g:buffergator_use_new_keymap=0" in your $VIMRUNTIME).
- added sorting by filename extension
vim-buffergator-v1.1.0.tar.gz 1.1.0 2011-06-12 7.0 Jeet Sukumaran   - Added key mappings to open tabs and splits 'silently' (in the background, keeping focus in catalog window)
ip used for rating: 23.20.220.59

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github