[SCM] vim-scripts packaging branch, master, updated. v20091011-30-gc476b42

James Vega jamessan at debian.org
Sun Aug 14 03:27:02 UTC 2011


The following commit has been merged in the master branch:
commit a20d2db6b4251ed1385340d2b668b017429804c3
Author: James Vega <jamessan at debian.org>
Date:   Sat Jun 25 23:47:30 2011 -0400

    Update bufexplorer to 7.2.8
    
    Signed-off-by: James Vega <jamessan at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 0e27000..f1f0dd1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,7 +8,7 @@ vim-scripts (20091012) UNRELEASED; urgency=low
     - Color Sampler Pack: Update to 8.03
     - vcscommand: Update to 1.99.35
     - calendar: Update to 2.5
-    - bufexplorer: Update to 7.2.4
+    - bufexplorer: Update to 7.2.8
     - gnupg: Update to 3026
       + Fixes a bug when the user's shell is (t)csh and /bin/sh is dash.
         (Closes: #552085)
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 6abd291..1aa055c 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -47,7 +47,7 @@ email:       delux256-vim at yahoo dot com
 license:     license [2], see below
 extras:	     doc/bufexplorer.txt
 disabledby:  let loaded_bufexplorer = 1
-version:     7.2.4
+version:     7.2.8
 
 script_name: plugin/minibufexpl.vim
 addon:       minibufexplorer
diff --git a/doc/bufexplorer.txt b/doc/bufexplorer.txt
index 51537b2..06e9223 100644
--- a/doc/bufexplorer.txt
+++ b/doc/bufexplorer.txt
@@ -1,7 +1,7 @@
-*bufexplorer.txt*              Buffer Explorer       Last Change: 06 Jan 2010
+*bufexplorer.txt*              Buffer Explorer       Last Change: 22 Oct 2010
 
 Buffer Explorer                                *buffer-explorer* *bufexplorer*
-                                Version 7.2.4
+                                Version 7.2.8
 
 Plugin for easily exploring (or browsing) Vim |:buffers|.
 
@@ -58,12 +58,12 @@ Commands to use once exploring:
  <leftmouse>   Opens the buffer that is under the cursor into the current
                window.
  <shift-enter> Opens the buffer that is under the cursor in another tab.
- D            |:delete|the buffer under the cursor from the list.  The
+ d            |:delete|the buffer under the cursor from the list.  The
                buffer's 'buflisted' is cleared. This allows for the buffer to
                be displayed again using the 'show unlisted' command.
  R             Toggles relative path/absolute path.
  T             Toggles to show only buffers for this tab or not.
- d            |:wipeout|the buffer under the cursor from the list.  When a
+ D            |:wipeout|the buffer under the cursor from the list.  When a
                buffers is wiped, it will not be shown when unlisted buffer are
                displayed.
  f             Toggles whether you are taken to the active window when
@@ -106,6 +106,10 @@ WINDOW LAYOUT                                       *bufexplorer-windowlayout*
 ===============================================================================
 CUSTOMIZATION                                       *bufexplorer-customization*
 
+                                                          *g:bufExplorerChgWin*
+If set, bufexplorer will bring up the selected buffer in the window specified
+by g:bufExplorerChgWin.
+
                                                      *g:bufExplorerDefaultHelp*
 To control whether the default help is displayed or not, use: >
   let g:bufExplorerDefaultHelp=0       " Do not show default help.
@@ -125,6 +129,10 @@ use: >
   let g:bufExplorerFindActive=1        " Go to active window.
 The default is to be taken to the active window.
 
+                                                         *g:bufExplorerFuncRef*
+When a buffer is selected, the functions specified either singly or as a list
+will be called.
+
                                                      *g:bufExplorerReverseSort*
 To control whether to sort the buffer in reverse order or not, use: >
   let g:bufExplorerReverseSort=0       " Do not sort in reverse order.
@@ -145,6 +153,12 @@ directory, use: >
   let g:bufExplorerShowRelativePath=1  " Show relative paths.
 The default is to show absolute paths.
 
+                                                   *g:bufExplorerShowTabBuffer*
+To control weither or not to show buffers on for the specific tab or not, use: >
+  let g:bufExplorerShowTabBuffer=0        " No.
+  let g:bufExplorerShowTabBuffer=1        " Yes.
+The default is not to show.
+
                                                     *g:bufExplorerShowUnlisted*
 To control whether to show unlisted buffer or not, use: >
   let g:bufExplorerShowUnlisted=0      " Do not show unlisted buffers.
@@ -182,15 +196,25 @@ current window, use: >
   let g:bufExplorerSplitRight=1        " Split right.
 The default is to use the global &splitright.
 
-                                                   *g:bufExplorerShowTabBuffer*
-To control weither or not to show buffers on for the specific tab or not, use: >
-  let g:bufExplorerShowTabBuffer=0        " No.
-  let g:bufExplorerShowTabBuffer=1        " Yes.
-The default is not to show.
-
 ===============================================================================
 CHANGE LOG                                              *bufexplorer-changelog*
 
+7.2.8  - Enhancements:
+         * Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
+           http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR
+7.2.7  - Fix:
+         * My 1st attempt to fix the "cache" issue where buffers information
+           has changed but the cache/display does not reflect those changes.
+           More work still needs to be done.
+7.2.6  - Fix:
+         * Thanks to Michael Henry for pointing out that I totally forgot to
+           update the inline help to reflect the previous change to the 'd'
+           and 'D' keys. Opps!
+7.2.5  - Fix:
+         * Philip Morant suggested switching the command (bwipe) associated
+           with the 'd' key with the command (bdelete) associated with the 'D'
+           key. This made sense since the 'd' key is more likely to be used
+           compared to the 'D' key.
 7.2.4  - Fix:
          * I did not implement the patch provided by Godefroid Chapelle
            correctly. I missed one line which happened to be the most
diff --git a/html/index.html b/html/index.html
index 1cfb11f..0bc2455 100644
--- a/html/index.html
+++ b/html/index.html
@@ -50,7 +50,7 @@
    <li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
   </ul>
   <p>
-  Page generated on Sat, 25 Jun 2011 23:43:53 -0400
+  Page generated on Sat, 25 Jun 2011 23:47:01 -0400
 .
   </p>
  </body>
diff --git a/html/plugin_bufexplorer.vim.html b/html/plugin_bufexplorer.vim.html
index 7769eff..f4220f4 100644
--- a/html/plugin_bufexplorer.vim.html
+++ b/html/plugin_bufexplorer.vim.html
@@ -166,8 +166,14 @@
 <tr>
   <td class="lightbg"><b> script karma </b></td>
   <td>
-    Rating <b>2263/750</b>,
-    Downloaded by 49883  </td>
+    Rating <b>2601/861</b>,
+    Downloaded by 68282  </td>
+  <td class="lightbg">
+  <b> Comments, bugs, improvements </b>
+  </td>
+  <td>
+    <a href="http://vim.wikia.com/wiki/Script:42">Vim wiki</a>
+  </td>  
 </tr>
 </table>
 <p>
@@ -217,6 +223,38 @@ Click on the package to download.
     <th valign="top">release notes</th>
 </tr>
 <tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14208">bufexplorer.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>7.2.8</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2010-11-08</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=97">jeff lanzarotta</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
<br>(<a target="_blank" href="http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR">http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR</A>)
<br>* Fixed update date.</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=12904">bufexplorer.zip</a></td>
+    <td class="roweven" valign="top" nowrap><b>7.2.7</b></td>
+    <td class="roweven" valign="top" nowrap><i>2010-04-26</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=97">jeff lanzarotta</a></i></td>
+    <td class="roweven" valign="top" width="2000">This is my first attempt to fix the "cache" issue where buffer information has changed but the cache/display does not reflect those changes. More work still needs to be done. More or less the cache has been disabled.</td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=12363">bufexplorer.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>7.2.6</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2010-02-12</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=97">jeff lanzarotta</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Thanks to Michael Henry for pointing out that I totally forgot to update the inline help to reflect the previous change to the 'd' and 'D' keys. Opps!</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=12354">bufexplorer.zip</a></td>
+    <td class="roweven" valign="top" nowrap><b>7.2.5</b></td>
+    <td class="roweven" valign="top" nowrap><i>2010-02-10</i></td>
+    <td class="roweven" valign="top" nowrap>6.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=97">jeff lanzarotta</a></i></td>
+    <td class="roweven" valign="top" width="2000">Philip Morant suggested switching the command (bwipe) associated with the 'd' key with the command (bdelete) associated with the 'D' key. This made sense since the 'd' key is more likely to be used compared to the 'D' key.</td>
+</tr>
+<tr>
         <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=12104">bufexplorer.zip</a></td>
     <td class="rowodd" valign="top" nowrap><b>7.2.4</b></td>
     <td class="rowodd" valign="top" nowrap><i>2010-01-14</i></td>
diff --git a/plugin/bufexplorer.vim b/plugin/bufexplorer.vim
index 127325f..8791363 100644
--- a/plugin/bufexplorer.vim
+++ b/plugin/bufexplorer.vim
@@ -1,5 +1,5 @@
 "==============================================================================
-"    Copyright: Copyright (C) 2001-2009 Jeff Lanzarotta
+"    Copyright: Copyright (C) 2001-2010 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,
@@ -10,7 +10,7 @@
 " Name Of File: bufexplorer.vim
 "  Description: Buffer Explorer Vim Plugin
 "   Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com)
-" Last Changed: Wednesday, 06 Jan 2010
+" Last Changed: Friday, 22 October 2010
 "      Version: See g:bufexplorer_version for version number.
 "        Usage: This file should reside in the plugin directory and be
 "               automatically sourced.
@@ -38,7 +38,7 @@ endif
 "1}}}
 
 " Version number
-let g:bufexplorer_version = "7.2.4"
+let g:bufexplorer_version = "7.2.8"
 
 " Check for Vim version 700 or greater {{{1
 if v:version < 700
@@ -225,14 +225,12 @@ endfunction
 function! s:BEDeactivateBuffer(remove)
   let _bufnr = str2nr(expand("<abuf>"))
 
+  call s:BEMRUPop(_bufnr)
+
   if a:remove
-    call s:BEMRUPop(_bufnr)
     call s:BEDeleteBufferListing(_bufnr)
   else
-    if ! s:BEIgnoreBuffer(_bufnr) == 1
-      " If the buffer is unlisted, refresh the list.
-      let s:refreshBufferList = 1
-    endif
+    let s:refreshBufferList = 1
   endif
 endfunction
 
@@ -302,6 +300,7 @@ function! s:BEIgnoreBuffer(buf)
 
   " Do not add the BufExplorer window to the list.
   if fnamemodify(bufname(a:buf), ":t") == s:name
+    call s:BEError("The buffer name was [".s:name."] so it was skipped.")
     return 1
   endif
 
@@ -314,12 +313,12 @@ endfunction
 
 " BECleanup {{{1
 function! s:BECleanup()
-  let &insertmode = s:_insertmode
-  let &showcmd = s:_showcmd
-  let &cpo = s:_cpo
-  let &report = s:_report
-  let &list = s:_list
-  let s:running = 0
+  if exists("s:_insertmode")|let &insertmode = s:_insertmode|endif
+  if exists("s:_showcmd")   |let &showcmd    = s:_showcmd   |endif
+  if exists("s:_cpo")       |let &cpo        = s:_cpo       |endif
+  if exists("s:_report")    |let &report     = s:_report    |endif
+  if exists("s:_list")      |let &list       = s:_list      |endif
+  let s:running   = 0
   let s:splitMode = ""
 
   delmarks!
@@ -339,37 +338,42 @@ endfunction
 
 " StartBufExplorer {{{1
 function! StartBufExplorer(open)
-  let name = s:name
+    let name = s:name
 
-  if !has("win32")
-    " On non-Windows boxes, escape the name so that is shows up correctly.
-    let name = escape(name, "[]")
-  endif
-
-  " Make sure there is only one explorer open at a time.
-  if s:running == 1
-    " Go to the open buffer.
-    if has("gui")
-      exec "drop" name
+    if !has("win32")
+        " On non-Windows boxes, escape the name so that is shows up correctly.
+        let name = escape(name, "[]")
+        call s:BEError("Escaped")
     endif
 
-    return
-  endif
+    " Make sure there is only one explorer open at a time.
+    if s:running == 1
+        call s:BEError("WHAT THE 1")
+        " Go to the open buffer.
+        if has("gui")
+            call s:BEError("WHAT THE 2")
+            call s:BEError(name)
+            exec "drop" name
+        endif
 
-  " Add zero to ensure the variable is treated as a Number.
-  let s:originBuffer = bufnr("%") + 0
+        return
+    endif
 
-  if !exists('s:raw_buffer_listing') || 
-        \ empty(s:raw_buffer_listing) ||
-        \ s:refreshBufferList == 1
-    silent let s:raw_buffer_listing = s:BEGetBufferInfo(0)
-  endif
+    " Add zero to ensure the variable is treated as a Number.
+    let s:originBuffer = bufnr("%") + 0
 
-  let copy = copy(s:raw_buffer_listing)
+    " Create or rebuild the raw buffer list if necessary.
+    if !exists('s:raw_buffer_listing') || 
+            \ empty(s:raw_buffer_listing) ||
+            \ s:refreshBufferList == 1
+        silent let s:raw_buffer_listing = s:BEGetBufferInfo(0)
+    endif
 
-  if (g:bufExplorerShowUnlisted == 0)
-    call filter(copy, 'v:val.attributes !~ "u"')
-  endif
+    let copy = copy(s:raw_buffer_listing)
+
+    if (g:bufExplorerShowUnlisted == 0)
+        call filter(copy, 'v:val.attributes !~ "u"')
+    endif
 
   " We may have to split the current window.
   if (s:splitMode != "")
@@ -434,13 +438,15 @@ function! s:BEMapKeys()
   nnoremap <buffer> <silent> o             :call <SID>BESelectBuffer()<cr>
   nnoremap <buffer> <silent> t             :call <SID>BESelectBuffer("tab")<cr>
   nnoremap <buffer> <silent> <s-cr>        :call <SID>BESelectBuffer("tab")<cr>
-  nnoremap <buffer> <silent> d             :call <SID>BERemoveBuffer("wipe", "n")<cr>
-  xnoremap <buffer> <silent> d             :call <SID>BERemoveBuffer("wipe", "v")<cr>
-  nnoremap <buffer> <silent> D             :call <SID>BERemoveBuffer("delete", "n")<cr>
-  xnoremap <buffer> <silent> D             :call <SID>BERemoveBuffer("delete", "v")<cr>
+
+  nnoremap <buffer> <silent> d             :call <SID>BERemoveBuffer("delete", "n")<cr>
+  xnoremap <buffer> <silent> d             :call <SID>BERemoveBuffer("delete", "v")<cr>
+  nnoremap <buffer> <silent> D             :call <SID>BERemoveBuffer("wipe", "n")<cr>
+  xnoremap <buffer> <silent> D             :call <SID>BERemoveBuffer("wipe", "v")<cr>
+
   nnoremap <buffer> <silent> m             :call <SID>BEMRUListShow()<cr>
   nnoremap <buffer> <silent> p             :call <SID>BEToggleSplitOutPathName()<cr>
-  nnoremap <buffer> <silent> q             :call <SID>BEClose()<cr>
+  nnoremap <buffer> <silent> q             :call <SID>BEClose("quit")<cr>
   nnoremap <buffer> <silent> r             :call <SID>BESortReverse()<cr>
   nnoremap <buffer> <silent> R             :call <SID>BEToggleShowRelativePath()<cr>
   nnoremap <buffer> <silent> s             :call <SID>BESortSelect()<cr>
@@ -551,8 +557,8 @@ function! s:BECreateHelp()
     call add(header, '" <F1> : toggle this help')
     call add(header, '" <enter> or o or Mouse-Double-Click : open buffer under cursor')
     call add(header, '" <shift-enter> or t : open buffer in another tab')
-    call add(header, '" D : delete buffer')
-    call add(header, '" d : wipe buffer')
+    call add(header, '" d : delete buffer')
+    call add(header, '" D : wipe buffer')
     call add(header, '" f : toggle find active buffer')
     call add(header, '" p : toggle spliting of file and path name')
     call add(header, '" q : quit')
@@ -625,62 +631,65 @@ function! s:BEGetBufferInfo(bufnr)
     let s:listedpads[n] = repeat(' ', max(listedwidths[n]))
   endfor
 
-  let s:refreshBufferList = 0
+  let s:refreshBufferList = 1
 
   return all
 endfunction
 
 " BEBuildBufferList {{{1
 function! s:BEBuildBufferList()
-  let lines = []
+    let lines = []
 
-  " Loop through every buffer.
-  for buf in s:raw_buffer_listing
-    if (!g:bufExplorerShowUnlisted && buf.attributes =~ "u")
-      " Skip unlisted buffers if we are not to show them.
-      continue
-    endif
-    if (g:bufExplorerShowTabBuffer)
-      let show_buffer = 0
-      for bufnr in s:tabSpace[tabpagenr()]
-        if (buf.attributes =~ '^\s*'.bufnr.'\>')
-          " Only buffers shown on the current tabpagenr
-          let show_buffer = 1
-          break
+    " Loop through every buffer.
+    for buf in s:raw_buffer_listing
+        " Skip unlisted buffers if we are not to show them.
+        if (!g:bufExplorerShowUnlisted && buf.attributes =~ "u")
+            continue
         endif
-      endfor
-      if show_buffer == 0 
-        continue
-      endif
-    endif
 
-    let line = buf.attributes." "
+        if (g:bufExplorerShowTabBuffer)
+            let show_buffer = 0
 
-    if g:bufExplorerSplitOutPathName
-      let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
-      let path = buf[type]
-      let pad  = (g:bufExplorerShowUnlisted) ? s:allpads.shortname : s:listedpads.shortname
-      let line .= buf.shortname." ".strpart(pad.path, len(buf.shortname))
-    else
-      let type = (g:bufExplorerShowRelativePath) ? "relativename" : "fullname"
-      let path = buf[type]
-      let line .= path
-    endif
+            for bufnr in s:tabSpace[tabpagenr()]
+                if (buf.attributes =~ '^\s*'.bufnr.'\>')
+                    " Only buffers shown on the current tabpagenr
+                    let show_buffer = 1
+                    break
+                endif
+            endfor
 
-    let pads = (g:bufExplorerShowUnlisted) ? s:allpads : s:listedpads
+            if show_buffer == 0 
+                continue
+            endif
+        endif
 
-    if !empty(pads[type])
-      let line .= strpart(pads[type], len(path))." "
-    endif
+        let line = buf.attributes." "
+
+        if g:bufExplorerSplitOutPathName
+            let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
+            let path = buf[type]
+            let pad  = (g:bufExplorerShowUnlisted) ? s:allpads.shortname : s:listedpads.shortname
+            let line .= buf.shortname." ".strpart(pad.path, len(buf.shortname))
+        else
+            let type = (g:bufExplorerShowRelativePath) ? "relativename" : "fullname"
+            let path = buf[type]
+            let line .= path
+        endif
 
-    let line .= buf.line
+        let pads = (g:bufExplorerShowUnlisted) ? s:allpads : s:listedpads
 
-    call add(lines, line)
-  endfor
+        if !empty(pads[type])
+            let line .= strpart(pads[type], len(path))." "
+        endif
+
+        let line .= buf.line
+
+        call add(lines, line)
+    endfor
 
-  call setline(s:firstBufferLine, lines)
+    call setline(s:firstBufferLine, lines)
 
-  call s:BESortListing()
+    call s:BESortListing()
 endfunction
 
 " BESelectBuffer {{{1
@@ -711,8 +720,8 @@ function! s:BESelectBuffer(...)
   endif
 
   if bufexists(_bufNbr)
-    if bufnr("#") == _bufNbr
-      return s:BEClose()
+    if bufnr("#") == _bufNbr && !exists("g:bufExplorerChgWin")
+      return s:BEClose("")
     endif
 
     " Are we suppose to open the selected buffer in a tab?
@@ -737,12 +746,14 @@ function! s:BESelectBuffer(...)
         exec s:BEGetWinNbr(tabNbr, _bufNbr) . "wincmd w"
       endif
     else
-      "No, the use did not ask to open the selected buffer in a tab.
+        "No, the use did not ask to open the selected buffer in a tab.
 
-      " Are we suppose to move to the tab where this active buffer is?
-      if bufloaded(_bufNbr) && g:bufExplorerFindActive
-        " Close the BE window.
-        call s:BEClose()
+        " Are we suppose to move to the tab where this active buffer is?
+        if exists("g:bufExplorerChgWin")
+ 	        exe g:bufExplorerChgWin."wincmd w"
+ 	    elseif bufloaded(_bufNbr) && g:bufExplorerFindActive
+            " Close the BE window.
+            call s:BEClose("")
 
         " Get the tab number where this buffer is located at.
         let tabNbr = s:BEGetTabNbr(_bufNbr)
@@ -764,6 +775,23 @@ function! s:BESelectBuffer(...)
 
     " Make the buffer 'listed' again.
     call setbufvar(_bufNbr, "&buflisted", "1")
+ 
+ 	" call any associated function references
+ 	" g:bufExplorerFuncRef may be an individual function reference
+ 	"                or it may be a list containing function references.
+ 	" It will ignore anything that's not a function reference.
+ 	" See  :help FuncRef  for more on function references.
+ 	if exists("g:BufExplorerFuncRef")
+ 	  if type(g:BufExplorerFuncRef) == 2
+ 	    keepj call g:BufExplorerFuncRef()
+ 	  elseif type(g:BufExplorerFuncRef) == 3
+ 	    for FncRef in g:BufExplorerFuncRef
+ 	      if type(FncRef) == 2
+ 		    keepj call FncRef()
+ 	      endif
+ 	    endfor
+ 	  endif
+    endif
   else
     call s:BEError("Sorry, that buffer no longer exists, please select another")
     call s:BEDeleteBuffer(_bufNbr, "wipe")
@@ -772,217 +800,217 @@ endfunction
 
 " BEDeleteBufferListing {{{1
 function! s:BEDeleteBufferListing(buf)
-  if exists('s:raw_buffer_listing') && !empty(s:raw_buffer_listing)
-    " Delete the buffer from the raw buffer list.
-    " Careful use of ' and " so we do not have to escape all the \'s
-    " Regex: ^\s*\(10\|20\)\>
-    "        ^ - Starting at the beginning of the string
-    "        \s* - optional whitespace
-    "        \(10\|20\) - either a 10 or a 20
-    "        \> - end of word (so it can't make 100 or 201)
-    call filter(s:raw_buffer_listing, "v:val.attributes !~ '".'^\s*\('.substitute(a:buf, ' ', '\\|', 'g').'\)\>'."'")
-  endif
+    if exists('s:raw_buffer_listing') && !empty(s:raw_buffer_listing)
+        " Delete the buffer from the raw buffer list.
+        " Careful use of ' and " so we do not have to escape all the \'s
+        " Regex: ^\s*\(10\|20\)\>
+        "        ^ - Starting at the beginning of the string
+        "        \s* - optional whitespace
+        "        \(10\|20\) - either a 10 or a 20
+        "        \> - end of word (so it can't make 100 or 201)
+        call filter(s:raw_buffer_listing, "v:val.attributes !~ '".'^\s*\('.substitute(a:buf, ' ', '\\|', 'g').'\)\>'."'")
+    endif
 endfunction
 
 " BERemoveBuffer {{{1
 function! s:BERemoveBuffer(type, mode) range
-  " Are we on a line with a file name?
-  if line('.') < s:firstBufferLine
-    return
-  endif
-
-  " These commands are to temporarily suspend the activity of winmanager.
-  if exists("b:displayMode") && b:displayMode == "winmanager"
-    call WinManagerSuspendAUs()
-  endif
+    " Are we on a line with a file name?
+    if line('.') < s:firstBufferLine
+        return
+    endif
 
-  let _bufNbrs = ''
+    " These commands are to temporarily suspend the activity of winmanager.
+    if exists("b:displayMode") && b:displayMode == "winmanager"
+        call WinManagerSuspendAUs()
+    endif
 
-  for lineNum in range(a:firstline, a:lastline)
-    let line = getline(lineNum)
+    let _bufNbrs = ''
+
+    for lineNum in range(a:firstline, a:lastline)
+        let line = getline(lineNum)
+
+        if line =~ '^\s*\(\d\+\)'
+            " Regex: ^\s*\(10\|20\)\>
+            "        ^ - Starting at the beginning of the string
+            "        \s* - optional whitespace
+            "        \zs - start the match here
+            "        \d\+ - any digits
+            "        \> - end of word (so it can't make 100 or 201)
+            let bufNbr = matchstr(line, '^\s*\zs\d\+\>')
+
+            " Add 0 to bufNbr to ensure Vim treats it as a Number
+            " for use with the getbufvar() function
+            if bufNbr !~ '^\d\+$' || getbufvar(bufNbr+0, '&modified') != 0
+                call s:BEError("Sorry, no write since last change for buffer ".bufNbr.", unable to delete")
+            else
+                let _bufNbrs = _bufNbrs . (_bufNbrs==''?'':' '). bufNbr 
+            endif
+        endif
+    endfor
 
-    if line =~ '^\s*\(\d\+\)'
-      " Regex: ^\s*\(10\|20\)\>
-      "        ^ - Starting at the beginning of the string
-      "        \s* - optional whitespace
-      "        \zs - start the match here
-      "        \d\+ - any digits
-      "        \> - end of word (so it can't make 100 or 201)
-      let bufNbr = matchstr(line, '^\s*\zs\d\+\>')
+    " Okay, everything is good, delete or wipe the buffers.
+    call s:BEDeleteBuffer(_bufNbrs, a:type)
 
-      " Add 0 to bufNbr to ensure Vim treats it as a Number
-      " for use with the getbufvar() function
-      if bufNbr !~ '^\d\+$' || getbufvar(bufNbr+0, '&modified') != 0
-        call s:BEError("Sorry, no write since last change for buffer ".bufNbr.", unable to delete")
-      else
-        let _bufNbrs = _bufNbrs . (_bufNbrs==''?'':' '). bufNbr 
-      endif
+    " Reactivate winmanager autocommand activity.
+    if exists("b:displayMode") && b:displayMode == "winmanager"
+        call WinManagerForceReSize("BufExplorer")
+        call WinManagerResumeAUs()
     endif
-  endfor
-
-  " Okay, everything is good, delete or wipe the buffers.
-  call s:BEDeleteBuffer(_bufNbrs, a:type)
-
-  " Reactivate winmanager autocommand activity.
-  if exists("b:displayMode") && b:displayMode == "winmanager"
-    call WinManagerForceReSize("BufExplorer")
-    call WinManagerResumeAUs()
-  endif
 endfunction
 
 " BEDeleteBuffer {{{1
 function! s:BEDeleteBuffer(bufNbr, mode)
-  " This routine assumes that the buffer to be removed is on the current line.
-  try
-    if a:mode == "wipe"
-      exe "bwipe" a:bufNbr
-    else
-      exe "bdelete" a:bufNbr
-    endif
+    " This routine assumes that the buffer to be removed is on the current line.
+    try
+        if a:mode == "wipe"
+            exe "bwipe" a:bufNbr
+        else
+            exe "bdelete" a:bufNbr
+        endif
 
-    setlocal modifiable
+        setlocal modifiable
 
-    " Remove each of the lines beginning with the buffer numbers we are removing
-    " Regex: ^\s*\(10\|20\)\>
-    "        ^ - Starting at the beginning of the string
-    "        \s* - optional whitespace
-    "        \(10\|20\) - either a 10 or a 20
-    "        \> - end of word (so it can't make 100 or 201)
-    exec 'silent! g/^\s*\('.substitute(a:bufNbr, ' ', '\\|', 'g').'\)\>/d_'
-    setlocal nomodifiable
+        " Remove each of the lines beginning with the buffer numbers we are removing
+        " Regex: ^\s*\(10\|20\)\>
+        "        ^ - Starting at the beginning of the string
+        "        \s* - optional whitespace
+        "        \(10\|20\) - either a 10 or a 20
+        "        \> - end of word (so it can't make 100 or 201)
+        exec 'silent! g/^\s*\('.substitute(a:bufNbr, ' ', '\\|', 'g').'\)\>/d_'
+
+        setlocal nomodifiable
 
-    call s:BEDeleteBufferListing(a:bufNbr)
-  catch
-    call s:BEError(v:exception)
-  endtry
+        call s:BEDeleteBufferListing(a:bufNbr)
+    catch
+        call s:BEError(v:exception)
+    endtry
 endfunction
 
 " BEClose {{{1
-function! s:BEClose()
-  " Get only the listed buffers.
-  let listed = filter(copy(s:MRUList), "buflisted(v:val)")
-
-  " If we needed to split the main window, close the split one.
-  if (s:splitMode != "")
-    exec "wincmd c"
-  endif
+function! s:BEClose(mode)
+    " Get only the listed buffers.
+    let listed = filter(copy(s:MRUList), "buflisted(v:val)")
+
+    " If we needed to split the main window, close the split one.
+"  if (s:splitMode)
+"  if (s:splitMode != "")
+    if (s:splitMode != "" && a:mode == "quit")
+        exec "wincmd c"
+    endif
 
-  if len(listed) == 0
-    exe "enew"
-  else
-    for b in reverse(listed[0:1])
-      exec "keepjumps silent b ".b
-    endfor
-  endif
+    if len(listed) == 0
+        exe "enew"
+    else
+        for b in reverse(listed[0:1])
+            exec "keepjumps silent b ".b
+        endfor
+    endif
 endfunction
 
 " BEToggleSplitOutPathName {{{1
 function! s:BEToggleSplitOutPathName()
-  let g:bufExplorerSplitOutPathName = !g:bufExplorerSplitOutPathName
-  call s:BERebuildBufferList()
-  call s:BEUpdateHelpStatus()
+    let g:bufExplorerSplitOutPathName = !g:bufExplorerSplitOutPathName
+    call s:BERebuildBufferList()
+    call s:BEUpdateHelpStatus()
 endfunction
 
 " BEToggleShowRelativePath {{{1
 function! s:BEToggleShowRelativePath()
-  let g:bufExplorerShowRelativePath = !g:bufExplorerShowRelativePath
-  call s:BERebuildBufferList()
-  call s:BEUpdateHelpStatus()
+    let g:bufExplorerShowRelativePath = !g:bufExplorerShowRelativePath
+    call s:BERebuildBufferList()
+    call s:BEUpdateHelpStatus()
 endfunction
 
 " BEToggleShowUnlisted {{{1
 function! s:BEToggleShowUnlisted()
-  let g:bufExplorerShowUnlisted = !g:bufExplorerShowUnlisted
-  let num_bufs = s:BERebuildBufferList(g:bufExplorerShowUnlisted == 0)
-  call s:BEUpdateHelpStatus()
+    let g:bufExplorerShowUnlisted = !g:bufExplorerShowUnlisted
+    let num_bufs = s:BERebuildBufferList(g:bufExplorerShowUnlisted == 0)
+    call s:BEUpdateHelpStatus()
 endfunction
 
 " BEToggleFindActive {{{1
 function! s:BEToggleFindActive()
-  let g:bufExplorerFindActive = !g:bufExplorerFindActive
-  call s:BEUpdateHelpStatus()
+    let g:bufExplorerFindActive = !g:bufExplorerFindActive
+    call s:BEUpdateHelpStatus()
 endfunction
 
 " BEToggleShowTabBuffer {{{1
 function! s:BEToggleShowTabBuffer()
-  let g:bufExplorerShowTabBuffer = !g:bufExplorerShowTabBuffer
-  call s:BEDisplayBufferList()
+    let g:bufExplorerShowTabBuffer = !g:bufExplorerShowTabBuffer
+    call s:BEDisplayBufferList()
 endfunction
 
 " BEToggleOnlyOneTab {{{1
 function! s:BEToggleOnlyOneTab()
-  let g:bufExplorerOnlyOneTab = !g:bufExplorerOnlyOneTab
-  call s:BEDisplayBufferList()
+    let g:bufExplorerOnlyOneTab = !g:bufExplorerOnlyOneTab
+    call s:BEDisplayBufferList()
 endfunction
 
 " BERebuildBufferList {{{1
 function! s:BERebuildBufferList(...)
-  setlocal modifiable
+    setlocal modifiable
 
-  let curPos = getpos('.')
+    let curPos = getpos('.')
 
-  if a:0
-    " Clear the list first.
-    exec "keepjumps ".s:firstBufferLine.',$d "_'
-  endif
+    if a:0
+        " Clear the list first.
+        exec "keepjumps ".s:firstBufferLine.',$d "_'
+    endif
 
-  let num_bufs = s:BEBuildBufferList()
+    let num_bufs = s:BEBuildBufferList()
 
-  call setpos('.', curPos)
+    call setpos('.', curPos)
 
-  setlocal nomodifiable
+    setlocal nomodifiable
 
-  return num_bufs
+    return num_bufs
 endfunction
 
 " BEUpdateHelpStatus {{{1
 function! s:BEUpdateHelpStatus()
-  setlocal modifiable
+    setlocal modifiable
 
-  let text = s:BEGetHelpStatus()
-  call setline(s:firstBufferLine - 2, text)
+    let text = s:BEGetHelpStatus()
+    call setline(s:firstBufferLine - 2, text)
 
-  setlocal nomodifiable
+    setlocal nomodifiable
 endfunction
 
 " BEMRUCmp {{{1
 function! s:BEMRUCmp(line1, line2)
-  return index(s:MRUList, str2nr(a:line1)) - index(s:MRUList, str2nr(a:line2))
+    return index(s:MRUList, str2nr(a:line1)) - index(s:MRUList, str2nr(a:line2))
 endfunction
 
 " BESortReverse {{{1
 function! s:BESortReverse()
-  let g:bufExplorerReverseSort = !g:bufExplorerReverseSort
-
-  call s:BEReSortListing()
+    let g:bufExplorerReverseSort = !g:bufExplorerReverseSort
+    call s:BEReSortListing()
 endfunction
 
 " BESortSelect {{{1
 function! s:BESortSelect()
-  let g:bufExplorerSortBy = get(s:sort_by, index(s:sort_by, g:bufExplorerSortBy) + 1, s:sort_by[0])
-
-  call s:BEReSortListing()
+    let g:bufExplorerSortBy = get(s:sort_by, index(s:sort_by, g:bufExplorerSortBy) + 1, s:sort_by[0])
+    call s:BEReSortListing()
 endfunction
 
 " BEReverseSortSelect {{{1
 function! s:BEReverseSortSelect()
-  let g:bufExplorerSortBy = get(s:sort_by, (index(s:sort_by, g:bufExplorerSortBy) + len(s:sort_by) - 1) % len(s:sort_by), s:sort_by[0])
-
-  call s:BEReSortListing()
+    let g:bufExplorerSortBy = get(s:sort_by, (index(s:sort_by, g:bufExplorerSortBy) + len(s:sort_by) - 1) % len(s:sort_by), s:sort_by[0])
+    call s:BEReSortListing()
 endfunction
 
 " BEReSortListing {{{1
 function! s:BEReSortListing()
-  setlocal modifiable
+    setlocal modifiable
 
-  let curPos = getpos('.')
+    let curPos = getpos('.')
 
-  call s:BESortListing()
-  call s:BEUpdateHelpStatus()
+    call s:BESortListing()
+    call s:BEUpdateHelpStatus()
 
-  call setpos('.', curPos)
+    call setpos('.', curPos)
 
-  setlocal nomodifiable
+    setlocal nomodifiable
 endfunction
 
 " BESortListing {{{1
@@ -1022,35 +1050,35 @@ endfunction
 
 " BEMRUListShow {{{1
 function! s:BEMRUListShow()
-  echomsg "MRUList=".string(s:MRUList)
+    echomsg "MRUList=".string(s:MRUList)
 endfunction
 
 " BEError {{{1
 function! s:BEError(msg)
-  echohl ErrorMsg | echo a:msg | echohl none
+    echohl ErrorMsg | echo a:msg | echohl none
 endfunction
 
 " BEWarning {{{1
 function! s:BEWarning(msg)
-  echohl WarningMsg | echo a:msg | echohl none
+    echohl WarningMsg | echo a:msg | echohl none
 endfunction
 
 " GetTabNbr {{{1
 function! s:BEGetTabNbr(bufNbr)
-  " Searching buffer bufno, in tabs.
-  for i in range(tabpagenr("$"))
-    if index(tabpagebuflist(i + 1), a:bufNbr) != -1
-      return i + 1
-    endif
-  endfor
+    " Searching buffer bufno, in tabs.
+    for i in range(tabpagenr("$"))
+        if index(tabpagebuflist(i + 1), a:bufNbr) != -1
+            return i + 1
+        endif
+    endfor
 
-  return 0
+    return 0
 endfunction
 
 " GetWinNbr" {{{1
 function! s:BEGetWinNbr(tabNbr, bufNbr)
-  " window number in tabpage.
-  return index(tabpagebuflist(a:tabNbr), a:bufNbr) + 1
+    " window number in tabpage.
+    return index(tabpagebuflist(a:tabNbr), a:bufNbr) + 1
 endfunction
 
 " Winmanager Integration {{{1
@@ -1062,19 +1090,19 @@ call s:BESet("g:bufExplorerMaxHeight", 25) " Handles dynamic resizing of the win
 " This is to figure out how this plugin was called. In a standalone fashion
 " or by winmanager.
 function! BufExplorer_Start()
-  let b:displayMode = "winmanager"
-  call StartBufExplorer("e")
+    let b:displayMode = "winmanager"
+    call StartBufExplorer("e")
 endfunction
 
 " Returns whether the display is okay or not.
 function! BufExplorer_IsValid()
-  return 0
+    return 0
 endfunction
 
 " Handles dynamic refreshing of the window.
 function! BufExplorer_Refresh()
-  let b:displayMode = "winmanager"
-  call StartBufExplorer("e")
+    let b:displayMode = "winmanager"
+    call StartBufExplorer("e")
 endfunction
 
 function! BufExplorer_ReSize()

-- 
vim-scripts packaging



More information about the pkg-vim-maintainers mailing list