sponsor Vim development Vim logo Vim Book Ad

SelectBuf : A fast and extensible buffer explorer.

 script karma  Rating 227/72, Downloaded by 12762  Comments, bugs, improvements  Vim wiki

created by
Hari Krishna Dara
 
script type
utility
 
description
PLEASE READ THE INSTALL SECTION COMPLETELY.

SelectBuf is a buffer explorer similar to the file explorer plugin that comes
with Vim, the difference being that file explorer allows you to view the files
on the file system, where as buffer explorer limits the view to only the files
that are already opened in the current Vim session. It is even possible and
easy to extend the plugin with new commands.

Since the first time I released it in Jul '99 (try sending an email to
[email protected]), the script has gone many
revisions and enhancements both in technology and features, taking advantage of all the niceties that the new versions of Vim has to offer.

For detailed help, see ":help selectbuf" or read doc/selectbuf.txt.

- Install the plugin, restart vim and press <F3> (the default key binding) to
  get the list of buffers.
- Move the cursor on to the buffer that you need to select and press <CR> or
  double click with the left-mouse button.
- If you want to close the window without making a selection, press <F3>
  again.
- You can also press ^W<CR> or O to open the file in a new or previous window.
  You can use d to delete or D to wipeout the buffer. Use d again to
  undelete a previously deleted buffer (you need to first view the deleted
  buffers using u command).

You can change the default key mapping to open browser window by setting

      nmap <unique> <silent> <YourKey> <Plug>SelectBuf

Almost everything is configurable, including all the key mappings that are
available. E.g., you can change the help key to <C-H> instead of the default ?,
so you can free it to do backward searches in the file list, using the
following mapping:

      noremap <silent> <Plug>SelBufHelpKey <C-H>

Some highlights of the features are:

- It is super fast as the buffer list is cached and incrementally built as new
  files are added and the old ones are deleted.
- Hide buffer numbers to save on real estate (goes well with "Always On" mode
  or when used with WinManager).
- Opens a new window to avoid disturbing your existing windows. But you can
  change the behavior to reuse the current window or even to permanently keep
  it open.
- You can select block of buffers and delete or wipeout all the buffers at once.
- You can toggle various settings on and off while you are in the browser. You
  can e.g., toggle showing the buffer indicators by pressing i.
- Goes very well with WinManager.
- There are different sorting keys available. You can sort by buffer number,
  name, type (extension), path, indicators and MRU order. You can even select a
  default sort order
- If you use multiple windows, then the browser restores the window sizes after
  closing it.
- Syntax coloring makes it easy to find the buffer you are looking to switch to.
- Full configurability.
- Extensibility.
- Support for WinManager and multiselect plugins.
- and many more.

For more information, read the vim help on seletbuf.


Search_key_words: buffer selectbuf bufexplorer explorer list select multvals genutils multiselect Hari Krishna Dara
 
install details
For complete installation instructions, read the help on
selectbuf-installation. To get started on the help, expand the zip file in your
runtime directory and run :helpt on your doc directory or just read through the
doc/selectbuf.txt file.

Requires,
genutils.vim: vimscript#197

Depends on (optional),
multiselect.vim: vimscript#953

WinManager version 2.3 has some bugs because of which selectbuf may not work
correctly with it. I am working with Srinath to have a new version with fixes
until then, a version with fixes can be downloaded from:

http://mywebpage.netscape.com/haridara/vim/winmanager.vim

For versions older than 4.0, you also need multvals.vim: vimscript#171 in addition to genutils, and you need to download the non-autoload versions of both. See their respective installation sections for more information .

For versions older than 2.2.2,
bufNwinUtils.vim: http://vim.sourceforge.net/scripts/script.php?script_id=108
lightWeightArray.vim: http://vim.sourceforge.net/scripts/script.php?script_id=109

 

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
selectbuf-4.3.zip 4.3 2007-06-12 7.0 Hari Krishna Dara - New setting selBufShowRelativePath (Nathan Huizinga
  (nathan dot huizinga at gmail dot com)).
- Bug fix: |:SBSettings| is still broken.
Requires at least version 2.4 of genutils.
selectbuf-4.2.zip 4.2 2007-06-05 7.0 Hari Krishna Dara - Bug fix: |:SBSettings| is broken.
- Bug fix: syntax highlighting is sometimes broken the first time browser
  window is open.
- Bug fix: formatting is sometimes broken with incremental update, when
  browser is open after certain sequence of buffer changes.
selectbuf-4.1.zip 4.1 2006-09-12 7.0 Hari Krishna Dara - Bug fix: multiselect usage is not conditional in some places.
- Bug fix: Syntax may not be setup correctly when the first time browser window
  is opened.
selectbuf-4.0.zip 4.0 2006-09-11 7.0 Hari Krishna Dara - Started using vim7 features, so it is no longer backwards compatible.
- No longer depends on multvals. The plugin has been reworked to use Vim7 arrays
  and sort(), so there should be significant improvement in performance
  everywhere.
- It is now autoloaded on demand, which means it will help your vim session
  load faster.
- Support for multiselect has been enhanced. The selections are a lot more
  meaningful now, as they move along with the buffers. You can even sort the
  contents and still not loose your selections.
- |:SBSettings| is now more flexible and easier to use as it supports arguments
  and command-line completion.
- The global variables for the settings are no longer removed, but you should
  still run |:SBInitialize| for any side effects to take place. Use
  |:SBSettings| to make this easier.
If you want to use multiselect with this plugin, make sure you download the latest version of it.
selectbuf-3.6.zip 3.6 2006-05-08 6.0 Hari Krishna Dara Release 3.6 for vim7 compatibility. Also includes minor changes. This
will probably the last release that will work in Vim 6.3/6.4 version.
- Restoring search string works again. New setting
  |selBufRestoreSearchString|.
- New mark d, see |selectbuf-marks|.
selectbuf-3.5.zip 3.5 2005-03-16 6.0 Hari Krishna Dara Bug fixes.
- Refresh now updates the MRU list.
- Fixed broken "toggle details" functionality.
- "SBLaunch ." now correctly launches windows explorer on the current
  directory as expected.
- Entering buffer number directly in the browser window now works much
  better.
- Misc. bug fixes.
selectbuf-3.4.zip 3.4 2004-10-28 6.0 Hari Krishna Dara - Faster sorting of buffer list.
- If multiselect is installed, you can use spacebar to toggle selection. See
  |selectbuf-multiselect|.
- Fixed a bug in case-insensitive sorting of buffer names.
- Number keys are now mapped to jump to a buffer by its number. See
  |selectbuf-buffer-search|.
- Bug fixes.
    - If SBExec created a new window, it results in a Vim error.
    - Toggle buffer numbers is broken.
    - Other misc. bug fixes.

Get the latest multvals (vimscript #171) and genutils (vimscript #197) plugins.
selectbuf-3.3.zip 3.3 2004-07-23 6.0 Hari Krishna Dara Now requires Vim 6.3.

Mostly a maintenance release.
- Better launcher command for windows. You can now launch applications
  with arguments, and handles spaces well.
- Improved the performance of delete/wipeout when the list of files is
  huge.
- Better performance for toggling indicators,paths etc.
- A fix for incremental update in split paths.
selectbuf-3.2.zip 3.2 2004-04-07 6.0 Hari Krishna Dara :help selectbuf-changes-3.2

- Added a feature to split file paths, instead of the setting
  selBufHighlightOnlyFilename. See help on |selBufAlwaysShowPaths|. The browser
  by default now starts with this mode.
- The display is now more compact by the use of only required number of spaces
  than using hard tabs.
- A setting to ignore case while sorting, see |selBufIgnoreCaseInSort|.
- A new "selectbuf" filetype to further customize the syntax highlighting and
  extend the functionality, see |selectbuf-filetype|. There is now an API
  available, see |selectbuf-extend|.
- New command SBExec for selections, see |SBExec|. Extremely useful to execute
  external commands.
- Support for multiple selections through multiselect.vim plugin, see
  |selectbuf-multiselect|.
- New command (very useful, at least on MS Windows), |SBLaunch|.
- Improved |SelBufTHiddenKey| and |SelBufTDetailsKey| to avoid doing a full
  refresh. It should work much faster now.
selectbuf-3.1.zip 3.1 2003-05-02 6.0 Hari Krishna Dara Fixed many bugs found/reported in version 3.0. The plugin is also much more responsive under WinManager. See :h |selectbuf-changes| for information on what is fixed. Thanks a lot to David Fishburn (fishburn at sybase dot com) for reporting many issues. I also had to fix some more of the WinManager issues, so please download the latest version (with my patches) from the URL mentioned in the installation section. Also download version 1.6 of genutils plugin.
selectbuf-3.0.zip 3.0 2003-03-29 6.0 Hari Krishna Dara This is a major improvement over the previous version. One feature for
which I worked very hard is the incremental update of the buffer list.
The buffer opens very quickly now irrespective of how many files you
have currently open in your current session.  Here is a brief list of
new features. For a complete list and their description see the :help
selectbuf-features

    - Incremental update of the browser for speed. The browser caches the
      the list of buffers and incrementally changes it as you open new
      files and delete them.
    - Hide buffer numbers to save real estate (useful with "Always on"
      mode or with WinManager).
    - New vim help file with detailed description of features and configuration.
    - Block operations for buffer deletes now works well.
    - "Always On" mode is now much better.
    - Marks for a quick access to the next, previous and current buffers
      has a better meaning.
    - WinManager integration. This requires patches to WinManager
      though. Until Srinath is out of his hibernation to validate my
      patches and make the next release, it can be downloaded from:

http://mywebpage.netscape.com/haridara/vim/winmanager.vim

      With incremental update feature, opening files from WinManager now
      literally flies. Get the latest versions of multvals and genutils plugins
      along with this. I would very much appreciate any feedback.
selectbuf.vim 2.2.4 2002-02-19 6.0 Hari Krishna Dara - Main improvement is the faster sorting algorithm. The browser sorts much quickly and works flawlessly when there are a lot of files open (order of 200), especially when the MRU is selected. Still more can be done to imrove the sorting speed.
- When the browser window is opened, a message is generated with the total number of buffers and number of buffers shown.
- Cleaned up a lot of stuff. Now the impact of the browser on the user environment is much less as it avoids cluttering search history and restores the unnamed register.
selectbuf.vim 2.2.3 2002-02-04 6.0 Hari Krishna Dara Fixed the "myBufNr" not defined error reported by Halim Salman.
selectbuf.vim 2.2.2 2002-02-01 6.0 Hari Krishna Dara I have finally added MRU soring support with the popular demand :)

- Now you can specify the sorting method to be by MRU files. To make mru the default order, place this line in your vimrc:

let g:selBufDefaultSortOrder = "mru"

You can also use SBBufToHead and SBBufToTail commands with a buffer number argument to move the specified buffer to the starting and ending of the MRU list.

- If you make any changes to the configuration, you can use the new command SBInitialize to reconfigure the internal data of selectbuf.vim.

- Fixed some misc. bugs.
- FIxed the broken save/restore window settings (after converting to 6.0). Now even the vertically split windows are restored correctly.

Note that you need the new improved script genutils.vim instead of the older bufNwinUtils.vim. Download it from

http://vim.sourceforge.net/scripts/script.php?script_id=197

Also you need the new improved multvals.vim instead of the older lightWeightArray.vim. Download it from:

http://vim.sourceforge.net/scripts/script.php?script_id=171
selectbuf.vim 2.1.11 2001-11-15 6.0 Hari Krishna Dara - New feature to bulk delete/wipeout multiple buffers by selecting the rows.
  Very useful when you load a bunch of files by mistake and you just want to
  delete all the buffers at once. You can also sort by type and select all the
  buffers of a particular type and delete/wipeout at once.
- Complete configurability of the key mappings for all the commands. You can
  define your own key mappings for all the actions, or just for those that you
  don't like the default key assignment. E.g., I don't like to use "?" for
  showing the help (though it is more intuitive), as it disables my ability to
  search backwards in the browser window. So I changed the assignment by
  putting the following line in .vimrc

        noremap <silent> <Plug>SelBufHelpKey <C-H>

  The ? key is now freed and I can use ^H instead to toggle help header.
selectbuf.vim 2.1.10 2001-11-08 6.0 Hari Krishna Dara I am making this a 2.1 release version after a good amount of usage for the past
few weeks. Here is a final summary of all the new features in this release:

    - help header with a status line
    - open/close browser using the same key (to get a quick glance of the files)
    - optionally show buffer indicators
    - show/hide hidden buffers
    - separate delete and wipeout functionality
    - refresh browser
    - show/hide path info
    - buffer markers for easy navigation
    - most of the features are configurable
    - avoid cluttering the global name space with the config variables
    - sort/reverse sort by "buffer nubmer", "name", "path", "type", "indicators"
    - must better syntax highlighting (configurable)
    - optionally open a vertical window for the browser
    - three operating modes for the browser
        - split: standard style, split opens the browser window
        - switch: reuse the current window (bufexplorer style)
        - keep: keep browser always open. Very useful when used with the
                previous option to open a vertically split window.

    Requires 1.0.3 bufNwinUtils.vim.

Please keep sending bug reports/suggestions/comments etc.
selectbuf.vim 2.1beta9 2001-11-05 6.0 Hari Krishna Dara Forgot to mention that you require the latest bufNwinUtils.vim. Download it: http://vim.sourceforge.net/scripts/script.php?script_id=108
selectbuf.vim 2.1beta9 2001-11-05 6.0 Hari Krishna Dara I have added most of the features that I wanted to, and also fixed all the FIXME's. So the script is now mostly clean and very stable.

- Now sort by name and sort by path are separate.
- Fixed the bug in remembering the cursor position.
- More configurability of the script. Fix for avoiding the global config params from cluttering the global namespace.
- You can specify a default sort order.
- Syntax coloring in the browser window is much better now.
- Added P command to show/hide paths.
- Improved stability.

It is very close to a release version now.
selectbuf.vim 2.1beta6 2001-10-26 6.0 Hari Krishna Dara Added some cool new features and fixed some problems.

- Added sorting. You can now sort by "buffer number", "name", "type" or by "indicators".
  - Use s to select the sort type forward.
  - Use S to select the sort type backward.
  - Use r to sort in the reverse order.
  - Since r is more appropriate (and familiar) for reverse sorting, I used R to refresh the browser.
- I got the solution for the toggling the meaning of activation key, so now you can use the same key that activates the browser to even close it. So provided you have <F3> mapped, you can have a quick look at the browser by pressing <F3> twice in quick succession.
- I also used some nice 6.0 features to make the browser buffer more friendly.
- Fixed the spurious nomodifiable problem (happens occassionally). Thanks for reporting this problem.
selectbuf.vim 2.1beta3 2001-10-23 6.0 Hari Krishna Dara Added the following useful features:

- Optionally hide fileexplorer buffers.
- Undelete (relist) buffers.
- show status line with the current settings.
selectbuf.vim 2.1beta2 2001-10-19 6.0 Hari Krishna Dara I got a nice feedback from a few people that mapping cursor movement commands for functionality is asking for trouble. Since w, W, h and H are cursor movement commands, before it is too late, I changed the key mappings as follows:

Delete buffer: d from D
Wipeout buffer: D from W
Toggle hidden: u from H (u for unlisted)
Toggle wrap: p from w
Toggle help: ? from h

Now you shouldn't see many surprises when you follow your natural instincts to move cursor :)
Please continue to give feedback. Thank you.
selectbuf.vim 2.1beta1 2001-10-18 6.0 Hari Krishna Dara Some nice improvements.
- help header (can be toggled)
- buffer indicators on the lines of :ls (can be toggled)
- show hidden buffers (can be toggled)
- Separate delete and wipeout functionality for buffers
- refresh browser (without reopening) .
- buffer markers to easily navigate.
- more robust.
- more configurability.

It is still beta, but I have done quite a lot of testing and it seems to be stable. I would appreciate any bug reports and feedback. I have more ideas for some good features to come soon, but if you would like to see any features yourself, please let me know.

You need the 1.0.1 version of bufNwinUtils.vim
selectbuf.vim 2.0.3 2001-10-10 6.0 Hari Krishna Dara Removed the ^M's.
selectbuf.vim 2.0.2 2001-10-08 6.0 Hari Krishna Dara While converting the script to 6.0, lost the hack that restores search history when the browser is closed.
selectbuf.vim 2001-10-05 6.0 Hari Krishna Dara Initial upload
ip used for rating: 142.132.191.50

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