" " selectbuf.vim -- lets you select a buffer visually. " Author: Hari Krishna " Last Change: 15-Oct-2001 @ 19:27 " Requires: Vim-6.0 or higher, lightWeightArray.vim(1.0.1), " bufNwinUtils.vim(1.0.1) " Version: 2.1.3 " " Source this file and press to get the list of buffers. " Move the cursor on to the buffer that you need to select and press or " double click with the left-mouse button. " If you want to close the window without making a selection, press again. " You can also press ^W to open the file in a new window. " You can use dd to delete the buffer. " For convenience when the browser is opened, the line corresponding to the " next buffer is marked with 'a so that you can quickly go to the next buffer. " " You can define your own mapping to activat the browser using the following: " nmap SelectBuf " The default is to use . " " To configure the behavior, take a look at the following. You can define the " configuration properties in your .vimrc to change the defaults. " TODO: " See FIXME's below. if exists("loaded_selectbuf") finish endif let loaded_selectbuf=1 " " BEGIN configuration. " " " The name of the browser. The default is "---Select Buffer---", but you can " change the name at your will. if !exists("g:selBufWindowName") let g:selBufWindowName = '---\ Select\ Buffer\ ---' endif " " A non-zero value for the variable selBufOpenInNewWindow means that the " selected buffer should be opened in a separate window. The value zero will " open the selected buffer in the current window. " if !exists("g:selBufOpenInNewWindow") let g:selBufOpenInNewWindow = 0 endif " " A non-zero value for the variable selBufRemoveBrowserBuffer means that after " the selection is made, the buffer that belongs to the browser should be " deleted. But this is not advisable as vim doesn't reuse the buffer numbers " that are no longer used. The default value is 0, i.e., reuse a single " buffer. This will avoid creating a lot of buffers and quickly reach large " buffer numbers for the new buffers created. if !exists("g:selBufRemoveBrowserBuffer") let g:selBufRemoveBrowserBuffer = 0 endif " " A non-zero value for the variable selBufHighlightOnlyFilename will highlight " only the filename instead of the whole path. The default value is 0. if !exists("g:selBufHighlightOnlyFilename") let g:selBufHighlightOnlyFilename = 0 endif " " If help should be shown always. " The default is to NOT to show help. " if exists("g:selBufAlwaysShowHelp") let s:showHelp = g:selBufAlwaysShowHelp else let s:showHelp = 0 endif " " Should hide the hidden buffers or not. " The default is to NOT to show hidden buffers. " if exists("g:selBufAlwaysShowHidden") let s:showHidden = g:selBufAlwaysShowHidden else let s:showHidden = 0 endif " " If additional details about the buffers should be shown. " The default is to NOT to show details. " if exists("g:selBufAlwaysShowDetails") let s:showDetails = g:selBufAlwaysShowDetails else let s:showDetails = 0 endif " " If the directory buffers should be hidden from the list. " The default is to NOT to hide directory buffers. " if exists("g:selBufAlwaysShowDirectories") let s:showDirectories = g:selBufAlwaysShowDirectories else let s:showDirectories = 1 endif " " If the lines should be wrapped. " The default is to NOT to wrap. " if exists("g:selBufAlwaysWrapLines") let s:wrapLines = g:selBufAlwaysWrapLines else let s:wrapLines = 0 endif " " END configuration. " " " Initialize some variables. " " To store the buffer from which the browser is invoked. let s:originalBuffer = 1 " Store the header size. let s:headerSize = 0 " " Define a default mapping if the user hasn't defined a map. " if !hasmapto('SelectBuf') nmap SelectBuf endif " " Define a command too (easy for debugging). " if !exists("SelBuf") command! -nargs=0 SelectBuf :call SelBufListBufs() endif " The main plug-in mapping. nmap