Elegant buffer explorer - takes very little screen space
Pull request Compare This branch is 509 commits behind fholgado:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is an updated and modified version of the script available here: http://www.vim.org/scripts/script.php?script_id=159

[6.4.1] 1/6/2011 - Added patches by Danielle Church to sort the MBE window by most recently used buffers. Added patches by Stephan Sokolow to close MBE on buffer select.

[6.4.0] 1/1/2011 - Added Emacs-like 'uniquify' feature where MBE will show a parent directory when there are 2 buffers with the same filename.

i.e. There are 2 buffers with the same filename:

Originally, MBE would just display 'style.css' for both buffers. Now, MBE crawls up the directory tree to find the first differentiating parent directory for both buffers, s MBE will show:


- Now sets winfixheight and winfixwidth for the MBE buffer so that it does not get resized automatically by window resizing commands such as 'CTRL W='.

[6.3.7] 12/19/2010 - MBE now uses it's own custom statusline format to reduce visual clutter. (By Federico Holgado)

[6.3.6] 12/16/2010 - Added behavior to reflect buffer highlighting states automatically on buffer change and buffer save. This corrects previous behavior where MBE was only updated after entering another buffer and it would be marked as modified even though the buffer was just saved. (By Federico Holgado)

[6.3.5] 12/12/2010 - Added two more states for buffer names to the included possible states to reflect the current buffer that is active. These states can be targeted by the following syntax: (By Federico Holgado)


You can see a screenshot of what this looks like here: http://fhl.gd/qnNQ

[6.3.4] - Added to the original script were the following keybindings: (By Oliver Uvman)

Added to the original script were the following keybindings: (By Oliver Uvman)

h and l to move left and right when selecting buffers in addition to the original Tab and Shift-Tab
o and e to show a buffer in addition to the original <CR>
s to open the selected buffer in a split window
v to open the selected buffer in a vertically split window

Big thanks to Bindu Wavell for writing this script! I just added some minor things which I think others might find useful. I tried submitting this as a patch to him, but got no answer. Bindu: Contact me if you want to integrate this into your plugin and I'll remove this one.

Original description:

Several modern GUI editors list your open buffers as tabs along the top or bottom of your screen (VisualStudio, DreamWeaver, EditPlus and UltraEdit come to mind), now we have this feature in VIM! You can checkout a screenshot here: http://www.wavell.net/vim/vim_screenshot.gif.

You can quickly switch buffers by double-clicking the appropriate "tab" (if you don't want to use the mouse just put the cursor on the "tab" and press enter). As you open and close buffers the tabs get updated. Buffers that are modified get visually marked and buffers that are open in a window get visually marked. The -MiniBufferExplorer- opens automatically when you open more than one eligible buffer (no need to open the explorer if you�re only editing one file.) -MiniBufExplorer- doesn't bother showing non-modifiable or hidden buffers. You can delete buffers by selecting them and pressing d on the keyboard.

When you are in the -MiniBufExplorer- window, Tab and Shift-Tab move forward and backward respectively through the buffer list.

There are a growing number of optional features in this script that are enabled by letting variables in your .vimrc:

  control + the vim direction keys [hjkl] can be made to move you between windows.
  control + arrow keys can be made to do the same thing
  control + tab & shift + control + tab can be setup to switch through your open windows (like in MS Windows)
  control + tab & shift + control + tab can alternatively be setup to cycle forwards and backwards through your modifiable buffers in the current window

NOTE: Some versions of vim don't support all of the key mappings that this script uses so you may experience degraded functionality. For example on Solaris SHIFT-TAB appears to fire the regular TAB mappings (same for console and gvim.) Also CONTROL+ARROWS appears to work in gvim on Solaris, but not in my xterm. All of the key bindings appear to work in Windows.

[Thanks to Jeff Lanzarotta for his BufExplorer plugin (http://vim.sourceforge.net/scripts/script.php?script_id=42) that got me started down this slippery slope.]