Skip to content

Commit

Permalink
Version 6.0.8
Browse files Browse the repository at this point in the history
Was not resetting the showcmd command correctly.
Added nifty help file.
  • Loading branch information
jeff lanzarotta authored and vim-scripts committed Oct 18, 2010
1 parent 63f0e56 commit 9d457c2
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 59 deletions.
118 changes: 118 additions & 0 deletions doc/bufexplorer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
*bufexplorer.txt* Buffer Explorer November 28, 2001

Buffer Explorer *buffer-explorer* *bufexplorer*

Plugin for easilty exploring open buffers

|bufexplorer-usage| Usage
|bufexplorer-customization| Customization
|bufexplorer-changelog| Change Log
|bufexplorer-todo| Todo
|bufexplorer-credits| Credits

==============================================================================
Usage *bufexplorer-usage*

To start exploring in the current window, use:
\be or :BufExplorer
To start exploring in a newly split window, use:
\be or :SBufExplorer

Note: If the current buffer is modified, the current window is always
split.

Command to use once exploring:

<cr> or Opens the buffer that is under the cursor into the current
<leftmouse> window.
d Deletes the buffer from the list that is under the cursor.
p Toggles the showing of a split filename/pathname.
q Quit exploring.
s Selects the order the buffers are listed in. Either by their
name or by their number.
r Reverses the order the buffers are listed in.
? Displays help information.

Typically one would put bufexplorer.vim into the .vim/plugin directory
(vimfiles\plugin for Windows) where it becomes automatically available
for use. It sets up it's default keymaps to use \be and \bs. If you would
like to use something other than '\', you may simply change the leader
(see |mapleader|).

Once involked, Buffer Explorer display a sorted list of all the buffers
that are currently opened. You are then able to move the cursor to the
line containing the buffer's name you are wanting to act apone. Once you
have selected the buffer you would like, you can then either open it,
close it(delete), resort the list, reverse the sort, quit explorering
and so on...

You can avoid loading this plugin by setting the "loaded_bufexplorer"
variable:
:let loaded_bufexplorer = 1

===============================================================================
Customization *bufexplorer-customization*

*g:bufExplorerDetailedHelp*
To control whether detailed help is display by, use:
let g:bufExplorerDetailedHelp=1
The default is not to show detailed help.
*g:bufExplorerSortBy*
To control what field the buffers are sorted by, use:
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
The default is to sort by number.
*g:bufExplorerSplitBelow*
To control where the new split window will be placed above or below the
current window, use:
let g:bufExplorerSplitBelow=1 " Split new window below current.
let g:bufExplorerSplitBelow=0 " Split new window above current.
The default it to use what ever is set by the global &splitbelow
variable.

To control whether to sort the buffers in forward or reverse order, use:
let g:bufExplorerSortDirection=1 " Sort in forward order.
let g:bufExplorerSortDirection=-1 " Sort in reverse order.

To control whether to split out the path and file name or not, use:
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
let g:bufExplorerSplitOutPathName=-1 " Don't split the path and file
" name.

===============================================================================
Change Log *bufexplorer-changelog*

6.0.8 - Was not resetting the showcmd command correctly.
Added nifty help file.
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
some are not, yet. Added highlighting of current and alternate
filenames. Added spliting of path/filename toggle. Reworked
ShowBuffers().
Changed my email address.
6.0.6 - Copyright notice added. Fixed problem with the SortListing() function
failing when there was only one buffer to display.
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
hit 'd' on a buffer that belonged to a files that nolonger existed
and that the 'yank' buffer was being overridden by the help text when
the bufexplorer was opened.
6.0.4 - Thanks to Charles Campbell for making this plugin more plugin
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
as well as fixing the 'w:sortDirLabel not being defined' bug.
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
6.0.2 - Can't remember.

===============================================================================
Todo *bufexplorer-todo*

None at this time.

===============================================================================
Credits *bufexplorer-credits*

Author: Jeff Lanzarotta <jefflanzarotta@yahoo.com>

With help and suggestions from: Charles Campbell
Brett Carlane


vim:tw=78:ts=8:ft=help
79 changes: 20 additions & 59 deletions plugin/bufexplorer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,20 @@
" Description: Buffer Explorer Vim Plugin
" Maintainer: Jeff Lanzarotta (jefflanzarotta@yahoo.com)
" URL: http://lanzarotta.tripod.com/vim/plugin/6/bufexplorer.vim.zip
" Last Change: Monday, November 19, 2001
" Version: 6.0.7
" Last Change: Tuesday, November 28, 2001
" Version: 6.0.8
" Usage: Normally, this file should reside in the plugins
" directory and be automatically sourced. If not, you must
" manually source this file using ':source bufexplorer.vim'.
"
" Run ':BufExplorer' to launch the explorer and runs the
" user-specified command in the current window, or
" ':SBufExplorer' to launch the explorer and run the
" user-specified command in the the newly split window.
"
" You may use the default keymappings of
"
" <Leader>be - Opens BufExplorer
" <Leader>bs - Opens split windows BufExplorer
"
" or you may want to add something like the following
" three key mappings to your _vimrc/.vimrc file.
"
" map <Leader>b :BufExplorer<cr>
" map <Leader>B :SBufExplorer<cr>
" map <c-leftmouse> :BufExplorer<cr>
"
" If the current buffer is modified, the current window is
" always split.
"
" To control where the new split windows goes relative to
" the current window, use the following:
" For more help see supplied documentation.
"
" To put the new window above the current use:
" let g:bufExplorerSplitBelow=0
" To put the new window below the current use:
" let g:bufExplorerSplitBelow=1
"
" The default for this is to split 'above'.
"
" History: 6.0.7 - Thanks to Brett Carlane for some great enhancements.
" Some are added, some are not, yet. Added highlighting of
" current and alternate filenames. Added spliting of
" path/filename toggle. Reworked ShowBuffers().
" Changed my email address.
" 6.0.6 - Copyright notice added. Fixed problem with the
" SortListing() function failing when there was only one
" buffer to display.
" 6.0.5 - Fixed problems reported by David Pascoe, in that
" you where unable to hit 'd' on a buffer that belonged to a
" files that nolonger existed and that the 'yank' buffer was
" being overridden by the help text when the bufexplorer was
" opened.
" 6.0.4 - Thanks to Charles Campbell for making this plugin
" more plugin *compliant*, adding default keymappings
" of <Leader>be and <Leader>bs as well as fixing the
" 'w:sortDirLabel not being defined' bug.
" 6.0.3 - Added sorting capabilities. Sort taken from
" explorer.vim.
" 6.0.2 - Can't remember.
" History: See supplied documentation.
"=============================================================================

" Has this already been loaded?
Expand All @@ -87,9 +45,7 @@ endif
map <unique> <script> <Plug>StartBufExplorer :call <SID>StartBufExplorer(0)<CR>
map <unique> <script> <Plug>SplitBufExplorer :call <SID>StartBufExplorer(1)<CR>
"
" Create commands.
"
if !exists(':BufExplorer')
command BufExplorer :call <SID>StartBufExplorer(0)
endif
Expand All @@ -98,9 +54,7 @@ if !exists(':SBufExplorer')
command SBufExplorer :call <SID>StartBufExplorer(1)
endif

"
" Show detailed help?
"
if !exists("g:bufExplorerDetailedHelp")
let g:bufExplorerDetailedHelp = 0
endif
Expand All @@ -116,7 +70,7 @@ if !exists("g:bufExplorerSplitBelow")
let g:bufExplorerSplitBelow = &splitbelow
endif

" Whether to sort in forward or reserve order.
" Whether to sort in forward or reverse order.
if !exists("g:bufExplorerSortDirection")
let g:bufExplorerSortDirection = 1
let s:sortDirLabel = ""
Expand Down Expand Up @@ -171,15 +125,16 @@ endfunction

" DisplayBuffers.
function! <SID>DisplayBuffers()
" Turn off the swapfile, set the buffer type so that it won't get written,
" and so that it will get deleted when it gets hidden.
let _showcmd = &showcmd

setlocal bufhidden=delete
setlocal buftype=nofile
setlocal modifiable
setlocal noshowcmd
setlocal noswapfile
setlocal nowrap

set noshowcmd

if has("syntax")
call <SID>SetupSyntax()
endif
Expand All @@ -203,8 +158,11 @@ function! <SID>DisplayBuffers()

normal! zz

" Prevent the buffer from being modified.
setlocal nomodifiable

let &showcmd = _showcmd

unlet! _showcmd
endfunction

" SetupSyntax.
Expand Down Expand Up @@ -286,9 +244,7 @@ endfunction
" ShowBuffers.
function! <SID>ShowBuffers()
let _report = &report
let _showcmd = &showcmd
let &report = 10000
set noshowcmd

" Delete all lines in buffer.
silent 1,$d _
Expand Down Expand Up @@ -347,9 +303,8 @@ function! <SID>ShowBuffers()
call <SID>SortListing()

let &report = _report
let &showcmd = _showcmd

unlet! filenames _report _showcmd firstLine
unlet! filenames _report firstLine
endfunction

" SplitOutPathName.
Expand Down Expand Up @@ -505,12 +460,18 @@ endfunction

" ToggleSplitOutPathName
function! <SID>ToggleSplitOutPathName()
let _showcmd = &showcmd
set noshowcmd
let s:splitOutPathName = !s:splitOutPathName
setlocal modifiable

call <SID>SaveCursorPosition()
call <SID>ShowBuffers()
call <SID>RestoreCursorPosition()

setlocal nomodifiable
let &showcmd = _showcmd
unlet! _showcmd
endfunction

" Update the header
Expand Down

0 comments on commit 9d457c2

Please sign in to comment.