vim-scripts/bufexplorer.zip

Subversion checkout URL

You can clone with
or
.

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
• 8 commits
• 2 files changed
• 0 commit comments
• 1 contributor
Commits on Jan 21, 2013
 jeff lanzarotta Version 7.3.3 * Major cleanup and reorganization of the change log. * We welcome the return of g:bufExplorerSplitHorzSize and g:bufExplorerSplitVertSize. When setting these values, anything less than or equal to 0 causes the split windows size to be determined by Vim. If for example you want your new horizontal split window 10 rows high, set g:bufExplorerSplitHorzSize = 10 in your .vimrc. Similar would be done if wanting a vertical split except you would use the g:bufExplorerSplitVertSize variable instead. 31bd5bf
Commits on Feb 09, 2013
 jeff lanzarotta Version 7.3.4 Thanks go out to John Szakmeister for finding and fixing a bug in the RebuildBufferList method. The keepjumps line that clears the list could potentially reference a backwards range. 6b5e630 jeff lanzarotta Version 7.3.5 Michael Henry added the ability to view "No Name" buffers. This functionality was lost since version 7.3.0. He also did some removal of "dead" code and cleaned up the code to handle filenames with embedded '"'. 5ad9b12
Commits on Jun 14, 2013
 jeff lanzarotta Version 7.3.6 Removed the 'drop' window command that was causing issue with the argument-list being modified after the BufExplorer windows was displayed. ba43ab7
Commits on Nov 03, 2013
 jeff lanzarotta Version 7.4.1 - First update related to Vim 7.4. - I have been asked by several bufexplorer users to put the code on github so that the Vundle plugin could be used to make updates easier. The code can now be found on github at https://github.com/jlanzarotta/bufexplorer. For those that use the Vundle plugin, you can add 'Bundle 'jlanzarotta/bufexplorer' to your _vimrc or .vimrc file to get the latest version. - Changed license text. - Fixed issue with 'hidden'. If 'hidden' is set, make sure that g:bufExplorerFindActive is set to 0. Otherwise, when using /bs or /bv, and selecting a buffer, the original buffer will be switched to instead of being opened in the newly created windows. - Added new 'b' mapping when the bufExplorer window is opened. When 'b' is pressed, the user is prompted for the buffer number to switch to, and is is then switched to when is pressed. This allows for somewhat faster buffer switching instead of using the j and k keys or the mouse to select the buffer to switch to. - Removed 'set nolist' from the Initialize() function as well as the restore of the 'list' setting in the CleanUp() function. These were causing issues when multiple new files were opened from the command line. Furthermore, there was really no reason, that I can remember, to why the 'list' setting was saved, modified, and restored anyways. - Fixed issue with WinManager integration code not working correctly anymore. - Brought back the xnoremap setup for the 'd' and 'D' keys. These were removed for some reason after version 7.2.8. - Thanks to all the contributors and testers. - If there are any issues you find or enhancements you would like, let me know. 10ff312 jeff lanzarotta Version 7.4.2 Added global option g:bufExplorerDisableDefaultKeyMapping. This option controls weather the default key mappings (\be, \bs, and \bv) are enabled or not. See documentation for more information. 87c851e
Commits on Oct 26, 2014
 jeff lanzarotta Version 7.4.5 - Dr Michael Henry suggested to change all noremap commands to nnoremap. Using noremap is unnecessarily broad and can cause problems, especially for select mode. - Revert change where bufexplorer windows was closed even if the target buffer has not been loaded yet. - Ivan Ukhov fixed issue with deleting the last window. This update also fixes as well as another. If you have say, NERDtree open on the left side and bufexplorer on the right, that bufexplorer would close NERDtree erroneously thinking that it is closing itself. - Radoslaw Burny fixed a few bugs that surfaced when bufexplorer is used within winmanager. ef9f56a
Commits on Nov 05, 2014
 jeff lanzarotta Version v7.4.6 Converted files back to Unix format. It looks like I had git setup incorrectly and the files got converted to Dos format... 08b0100
Showing with 728 additions and 482 deletions.
1. +516 −329 doc/bufexplorer.txt
2. +212 −153 plugin/bufexplorer.vim
845 doc/bufexplorer.txt
 @@ -1,16 +1,42 @@ "============================================================================= -" Copyright: Copyright (C) 2001-2012 Jeff Lanzarotta -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" bufexplorer.vim is provided *as is* and comes with no -" warranty of any kind, either expressed or implied. In no -" event will the copyright holder be liable for any damages -" resulting from the use of this software. +" Copyright: Copyright (c) 2001-2014, Jeff Lanzarotta +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or +" without modification, are permitted provided that the +" following conditions are met: +" +" * Redistributions of source code must retain the above +" copyright notice, this list of conditions and the following +" disclaimer. +" +" * Redistributions in binary form must reproduce the above +" copyright notice, this list of conditions and the following +" disclaimer in the documentation and/or other materials +" provided with the distribution. +" +" * Neither the name of the {organization} nor the names of its +" contributors may be used to endorse or promote products +" derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +" CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " Name Of File: bufexplorer.vim " Description: Buffer Explorer Vim Plugin " Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com) -" Last Changed: Sunday, 23 Dec 2012 +" Last Changed: Monday, 03 November 2014 " Version: See g:bufexplorer_version for version number. " Usage: This file should reside in the plugin directory and be " automatically sourced. @@ -24,9 +50,9 @@ " Or you can override the defaults and define your own mapping " in your vimrc file, for example: " -" noremap :BufExplorer -" noremap :BufExplorerHorizontalSplit -" noremap :BufExplorerVerticalSplit +" nnoremap :BufExplorer +" nnoremap :BufExplorerHorizontalSplit +" nnoremap :BufExplorerVerticalSplit " " Or you can use " @@ -36,9 +62,6 @@ " " For more help see supplied documentation. " History: See supplied documentation. -" Issues: 'D' and 'd' remove the buffer from the list but the list is not -" displayed correctly. -" - Add ability to open a buffer in a new split when \be is used. "============================================================================= " Plugin Code {{{1 @@ -49,7 +72,7 @@ endif "2}}} " Version number -let g:bufexplorer_version = "7.3.2" +let g:bufexplorer_version = "7.4.6" " Check for Vim version {{{2 if v:version < 700 @@ -60,7 +83,7 @@ if v:version < 700 endif " Create commands {{{2 -command! BufExplorer :call BufExplorer(has ("gui") ? "drop" : "hide edit") +command! BufExplorer :call BufExplorer() command! BufExplorerHorizontalSplit :call BufExplorerHorizontalSplit() command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit() @@ -68,9 +91,9 @@ command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit() function! s:Set(var, default) if !exists(a:var) if type(a:default) - exec "let" a:var "=" string(a:default) + execute "let" a:var "=" string(a:default) else - exec "let" a:var "=" a:default + execute "let" a:var "=" a:default endif return 1 @@ -103,12 +126,9 @@ function! s:Setup() autocmd BufEnter,BufNew * call s:ActivateBuffer() autocmd BufWipeOut * call s:DeactivateBuffer(1) autocmd BufDelete * call s:DeactivateBuffer(0) - autocmd BufWinEnter $BufExplorer$ call s:Initialize() autocmd BufWinLeave $BufExplorer$ call s:Cleanup() - autocmd TabEnter * call s:TabEnter() - autocmd SessionLoadPost * call s:Reset() augroup END endfunction @@ -119,17 +139,17 @@ function! s:Reset() " command line are picked up correctly. let s:MRUList = range(1, bufnr('$')) - " Initialize one tab space array, ignore zero-based tabpagenr - " since all tabpagenr's start at 1. - " -1 signifies this is the first time we are referencing this - " tabpagenr. - " If Vim has been loaded with mksession, then it is possible for - " more tabs to exist. So use tabpagenr() to determine how large - " to make the array. If there are 4 tabs, there should be 5 - " elements in this array. - " Each element will hold a CSV list of buffers viewed in - " that tab. So on the 3rd tab, if there user has viewed - " 4 different buffers in that tab, the value would be: + " Initialize one tab space array, ignore zero-based tabpagenr since all + " tabpagenr's start at 1. -1 signifies this is the first time we are + " referencing this tabpagenr. + " + " If Vim has been loaded with mksession, then it is possible for more tabs + " to exist. So use tabpagenr() to determine how large to make the array. If + " there are 4 tabs, there should be 5 elements in this array. + " + " Each element will hold a CSV list of buffers viewed in that tab. So on + " the 3rd tab, if there user has viewed 4 different buffers in that tab, the + " value would be: " echo s:tabSpace[3] " [4, 9, 1, 10] " echo s:tabSpace @@ -137,7 +157,7 @@ function! s:Reset() let s:tabSpace = [] let i = 0 - while( tabpagenr('$') > 0 && i <= tabpagenr('$') ) + while(tabpagenr('$') > 0 && i <= tabpagenr('$')) call add(s:tabSpace, [-1]) let i = i + 1 endwhile @@ -219,8 +239,8 @@ endfunction " MRUPush {{{2 function! s:MRUPush(buf) - " Skip temporary buffer with buftype set. Don't add the BufExplorer window to the - " list. + " Skip temporary buffer with buftype set. Don't add the BufExplorer window + " to the list. if s:ShouldIgnore(a:buf) == 1 return endif @@ -239,11 +259,6 @@ function! s:ShouldIgnore(buf) return 1 endif - " Ignore unlisted buffers. - if buflisted(a:buf) == 0 - return 1 - endif - " Ignore buffers with no name. if empty(bufname(a:buf)) == 1 return 1 @@ -277,9 +292,6 @@ function! s:Initialize() let s:_report = &report let &report = 10000 - let s:_list = &list - set nolist - setlocal nonumber setlocal foldcolumn=0 setlocal nofoldenable @@ -309,10 +321,6 @@ function! s:Cleanup() let &report = s:_report endif - if exists("s:_list") - let &list = s:_list - endif - let s:running = 0 let s:splitMode = "" @@ -322,17 +330,17 @@ endfunction " BufExplorerHorizontalSplit {{{2 function! BufExplorerHorizontalSplit() let s:splitMode = "sp" - exec "BufExplorer" + execute "BufExplorer" endfunction " BufExplorerVerticalSplit {{{2 function! BufExplorerVerticalSplit() let s:splitMode = "vsp" - exec "BufExplorer" + execute "BufExplorer" endfunction " BufExplorer {{{2 -function! BufExplorer(open) +function! BufExplorer() let name = s:name if !has("win32") @@ -344,7 +352,7 @@ function! BufExplorer(open) if s:running == 1 " Go to the open buffer. if has("gui") - exec "drop" name + execute "drop" name endif return @@ -355,31 +363,21 @@ function! BufExplorer(open) silent let s:raw_buffer_listing = s:GetBufferInfo(0) - let buffer_listing_copy = copy(s:raw_buffer_listing) - - if (g:bufExplorerShowUnlisted == 0) - call filter(buffer_listing_copy, 'v:val.attributes !~ "u"') - endif - - if (!empty(buffer_listing_copy)) - call filter(buffer_listing_copy, 'v:val.shortname !~ "\\$No Name\\$"') - endif - -" if len(buffer_listing_copy) <= 1 -" call s:Warning("Sorry, there are no more buffers to explore") -" return -" endif - " We may have to split the current window. - if (s:splitMode != "") + if s:splitMode != "" " Save off the original settings. let [_splitbelow, _splitright] = [&splitbelow, &splitright] " Set the setting to ours. let [&splitbelow, &splitright] = [g:bufExplorerSplitBelow, g:bufExplorerSplitRight] + let _size = (s:splitMode == "sp") ? g:bufExplorerSplitHorzSize : g:bufExplorerSplitVertSize - " Do it. - exe 'keepalt '.s:splitMode + " Split the window either horizontally or vertically. + if _size <= 0 + execute 'keepalt ' . s:splitMode + else + execute 'keepalt ' . _size . s:splitMode + endif " Restore the original settings. let [&splitbelow, &splitright] = [_splitbelow, _splitright] @@ -388,7 +386,7 @@ function! BufExplorer(open) if !exists("b:displayMode") || b:displayMode != "winmanager" " Do not use keepalt when opening bufexplorer to allow the buffer that " we are leaving to become the new alternate buffer - exec "silent keepjumps ".a:open." ".name + execute "silent keepjumps hide edit".name endif call s:DisplayBufferList() @@ -410,6 +408,12 @@ function! s:DisplayBufferList() call s:SetupSyntax() call s:MapKeys() + + " Wipe out any existing lines in case BufExplorer buffer exists and the + " user had changed any global settings that might reduce the number of + " lines needed in the buffer. + silent keepjumps 1,$d _ + call setline(1, s:CreateHelp()) call s:BuildBufferList() call cursor(s:firstBufferLine, 1) @@ -432,8 +436,11 @@ function! s:MapKeys() nnoremap