Commits

Audrius Kažukauskas  committed 47a8627

Upgrade to BufExplorer 7.3.5.

  • Participants
  • Parent commits 37323b2

Comments (0)

Files changed (3)

File doc/bufexplorer.txt

-*bufexplorer.txt*              Buffer Explorer       Last Change: 28 Jan 2013
+*bufexplorer.txt*              Buffer Explorer       Last Change: 08 Feb 2013
 
 Buffer Explorer                                *buffer-explorer* *bufexplorer*
-                                Version 7.3.4
+                                Version 7.3.5
 
 Plugin for easily exploring (or browsing) Vim|:buffers|.
 
                                                  *g:bufExplorerShowDirectories*
 Directories usually show up in the list from using a command like ":e .".
 To control whether to show directories in the buffer list or not, use: >
+  let g:bufExplorerShowDirectories=0   " Do not show directories.
   let g:bufExplorerShowDirectories=1   " Show directories.
-  let g:bufExplorerShowDirectories=0   " Don't show directories.
 The default is to show directories.
 
+                                                      *g:bufExplorerShowNoName*
+To control whether to show "No Name" buffers or not, use: >
+  let g:bufExplorerShowNoName=0        " Do not "No Name" buffers.
+  let g:bufExplorerShowNoName=1        " Show "No Name" buffers.
+The default is to NOT show "No Name buffers.
+
                                                 *g:bufExplorerShowRelativePath*
 To control whether to show absolute paths or relative to the current
 directory, use: >
 ===============================================================================
 CHANGE LOG                                              *bufexplorer-changelog*
 
+7.3.5    February 08, 2013
+    * 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
+      '"'.
 7.3.4    January 28, 2013
     * Thanks go out to John Szakmeister for finding and fixing a bug in the
       RebuildBufferList method.  The keepjumps line that clears the list could
 g:bufExplorerFuncRef	bufexplorer.txt	/*g:bufExplorerFuncRef*
 g:bufExplorerReverseSort	bufexplorer.txt	/*g:bufExplorerReverseSort*
 g:bufExplorerShowDirectories	bufexplorer.txt	/*g:bufExplorerShowDirectories*
+g:bufExplorerShowNoName	bufexplorer.txt	/*g:bufExplorerShowNoName*
 g:bufExplorerShowRelativePath	bufexplorer.txt	/*g:bufExplorerShowRelativePath*
 g:bufExplorerShowTabBuffer	bufexplorer.txt	/*g:bufExplorerShowTabBuffer*
 g:bufExplorerShowUnlisted	bufexplorer.txt	/*g:bufExplorerShowUnlisted*

File plugin/bufexplorer.vim

 " Name Of File: bufexplorer.vim
 "  Description: Buffer Explorer Vim Plugin
 "   Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com)
-" Last Changed: Monday, 28 Jan 2013
+" Last Changed: Friday, 08 Feb 2013
 "      Version: See g:bufexplorer_version for version number.
 "        Usage: This file should reside in the plugin directory and be
 "               automatically sourced.
 "2}}}
 
 " Version number
-let g:bufexplorer_version = "7.3.4"
+let g:bufexplorer_version = "7.3.5"
 
 " Check for Vim version {{{2
 if v:version < 700
         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
 
     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 != "")
         " Save off the original settings.
 
     call s:SetupSyntax()
     call s:MapKeys()
+
+"NEW
+    " 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.
+    keepjumps 1,$d _
+"NEW
+
     call setline(1, s:CreateHelp())
     call s:BuildBufferList()
     call cursor(s:firstBufferLine, 1)
     " Loop over each line in the buffer.
     for buf in split(bufoutput, '\n')
         let bits = split(buf, '"')
-        let b = {"attributes": bits[0], "line": substitute(bits[2], '\s*', '', '')}
+
+        " Use first and last components after the split on '"', in case a
+        " filename with an embedded '"' is present.
+        let b = {"attributes": bits[0], "line": substitute(bits[-1], '\s*', '', '')}
+
+        let name = bufname(str2nr(b.attributes))
+        let b["hasNoName"] = empty(name)
+        if b.hasNoName
+            let name = "[No Name]"
+        endif
 
         for [key, val] in items(s:types)
-            let b[key] = fnamemodify(bits[1], val)
+            let b[key] = fnamemodify(name, val)
         endfor
 
         if getftype(b.fullname) == "dir" && g:bufExplorerShowDirectories == 1
             continue
         endif
 
-        " Ignore buffers with no name.
-        if empty(bufname(str2nr(buf.attributes))) == 1
+        " Skip "No Name" buffers if we are not to show them.
+        if (!g:bufExplorerShowNoName && buf.hasNoName)
             continue
         endif
 
 
     let curPos = getpos('.')
 
-    if a:0 && (line('$') >= s:firstBufferLine)
+    if a:0 && a:000[0] && (line('$') >= s:firstBufferLine)
         " Clear the list first.
-        exec "keepjumps ".s:firstBufferLine.',$d "_'
+        exec "keepjumps ".s:firstBufferLine.',$d _'
     endif
 
     let num_bufs = s:BuildBufferList()
 call s:Set("g:bufExplorerShowRelativePath", 0)      " Show listings with relative or absolute paths?
 call s:Set("g:bufExplorerShowTabBuffer", 0)         " Show only buffer(s) for this tab?
 call s:Set("g:bufExplorerShowUnlisted", 0)          " Show unlisted buffers?
+call s:Set("g:bufExplorerShowNoName", 0)            " Show "No Name" buffers?
 call s:Set("g:bufExplorerSortBy", "mru")            " Sorting methods are in s:sort_by:
 call s:Set("g:bufExplorerSplitBelow", &splitbelow)  " Should horizontal splits be below or above current window?
 call s:Set("g:bufExplorerSplitOutPathName", 1)      " Split out path and file name?