Просмотр исходного кода

v7.4.19

- Merged all changes from github back into this version and tried to
sync
to the correct version number.
7.4.18 - Github
7.4.17 - Github.
7.4.16   August 14, 2017
- Thanks to Yubo Su for the patch that adds 'f, F, V, and v' commands.
With this change, the original 'f' command was remapped to 'a'.

The set of commands that can be used during exploring are:
F - Open selected buffer in another window above the current.
f - Open selected buffer in another window below the current.
V - Open the selected buffer in another window on the left of the
current.
v - Open the selected buffer in another window on the right of the
current.
jeff 8 лет назад
Родитель
Сommit
3c0b11f3dd
2 измененных файлов с 76 добавлено и 20 удалено
  1. 24 4
      doc/bufexplorer.txt
  2. 52 16
      plugin/bufexplorer.vim

+ 24 - 4
doc/bufexplorer.txt

@@ -1,7 +1,7 @@
-*bufexplorer.txt*              Buffer Explorer       Last Change: 01 May 2017
+*bufexplorer.txt*              Buffer Explorer       Last Change: 18 Sep 2017
 
 Buffer Explorer                                *buffer-explorer* *bufexplorer*
-                                Version 7.4.15
+                                Version 7.4.19
 
 Plugin for easily exploring (or browsing) Vim|:buffers|.
 
@@ -72,6 +72,8 @@ 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.
+ a             Toggles whether you are taken to the active window when
+               selecting a buffer or not.
  b             Fast buffer switching with b<any bufnum>.
  B             Works in association with the |ShowTabBuffer| option.  If
                |ShowTabBuffer| is set to 1, this toggles if BufExplorer is to
@@ -82,8 +84,8 @@ Commands to use once exploring:
  D             |:wipeout| the buffer under the cursor from the list.  When a
                buffer is wiped, it will not be shown when unlisted buffers are
                displayed.
- f             Toggles whether you are taken to the active window when
-               selecting a buffer or not.
+ F             Open selected buffer in another window above the current.
+ f             Open selected buffer in another window below the current.
  o             Opens the buffer that is under the cursor into the current
                window.
  p             Toggles the showing of a split filename/pathname.
@@ -99,6 +101,8 @@ Commands to use once exploring:
  t             Opens the buffer that is under the cursor in another tab.
  T             Toggles to show only buffers for this tab or not.
  u             Toggles the showing of "unlisted" buffers.
+ V             Open the selected buffer in another window on the left of the current.
+ v             Open the selected buffer in another window on the right of the current.
 
 Once invoked, Buffer Explorer displays a sorted list (MRU is the default
 sort method) of all the buffers that are currently opened. You are then
@@ -253,6 +257,22 @@ The default is 0, so that the size is set by Vim.
 ===============================================================================
 CHANGE LOG                                              *bufexplorer-changelog*
 
+7.4.19   September 18, 2017
+    - Merged all changes from github back into this version and tried to sync
+      to the correct version number.
+7.4.18 - Github
+7.4.17 - Github.
+7.4.16   August 14, 2017
+    - Thanks to Yubo Su for the patch that adds 'f, F, V, and v' commands.
+      With this change, the original 'f' command was remapped to 'a'.
+
+      The set of commands that can be used during exploring are:
+      F - Open selected buffer in another window above the current.
+      f - Open selected buffer in another window below the current.
+      V - Open the selected buffer in another window on the left of the
+          current.
+      v - Open the selected buffer in another window on the right of the
+          current.
 7.4.15   May 01, 2017
     - Finally applied the patch submitted by justfalter.  This patch is a
       backward-compatible fix for the "invalid tab range" bug.

+ 52 - 16
plugin/bufexplorer.vim

@@ -35,8 +35,8 @@
 "               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: Monday, 01 May 2017
+"   Maintainer: Jeff Lanzarotta (delux256-vim at outlook dot com)
+" Last Changed: Monday, 18 September 2017
 "      Version: See g:bufexplorer_version for version number.
 "        Usage: This file should reside in the plugin directory and be
 "               automatically sourced.
@@ -74,7 +74,7 @@ endif
 "1}}}
 
 " Version number
-let g:bufexplorer_version = "7.4.15"
+let g:bufexplorer_version = "7.4.19"
 
 " Plugin Code {{{1
 " Check for Vim version {{{2
@@ -497,13 +497,14 @@ function! s:MapKeys()
     nnoremap <script> <silent> <nowait> <buffer> <CR>          :call <SID>SelectBuffer()<CR>
     nnoremap <script> <silent> <nowait> <buffer> <F1>          :call <SID>ToggleHelp()<CR>
     nnoremap <script> <silent> <nowait> <buffer> <s-cr>        :call <SID>SelectBuffer("tab")<CR>
-    nnoremap <script> <silent> <nowait> <buffer> B             :call <SID>ToggleOnlyOneTab()<CR>
+    nnoremap <script> <silent> <nowait> <buffer> a             :call <SID>ToggleFindActive()<CR>
     nnoremap <script> <silent> <nowait> <buffer> b             :call <SID>SelectBuffer("ask")<CR>
     nnoremap <script> <silent> <nowait> <buffer> d             :call <SID>RemoveBuffer("delete")<CR>
     xnoremap <script> <silent> <nowait> <buffer> d             :call <SID>RemoveBuffer("delete")<CR>
     nnoremap <script> <silent> <nowait> <buffer> D             :call <SID>RemoveBuffer("wipe")<CR>
     xnoremap <script> <silent> <nowait> <buffer> D             :call <SID>RemoveBuffer("wipe")<CR>
-    nnoremap <script> <silent> <nowait> <buffer> f             :call <SID>ToggleFindActive()<CR>
+    nnoremap <script> <silent> <nowait> <buffer> f             :call <SID>SelectBuffer("split", "sb")<CR>
+    nnoremap <script> <silent> <nowait> <buffer> F             :call <SID>SelectBuffer("split", "st")<CR>
     nnoremap <script> <silent> <nowait> <buffer> m             :call <SID>MRUListShow()<CR>
     nnoremap <script> <silent> <nowait> <buffer> o             :call <SID>SelectBuffer()<CR>
     nnoremap <script> <silent> <nowait> <buffer> p             :call <SID>ToggleSplitOutPathName()<CR>
@@ -515,6 +516,8 @@ function! s:MapKeys()
     nnoremap <script> <silent> <nowait> <buffer> t             :call <SID>SelectBuffer("tab")<CR>
     nnoremap <script> <silent> <nowait> <buffer> T             :call <SID>ToggleShowTabBuffer()<CR>
     nnoremap <script> <silent> <nowait> <buffer> u             :call <SID>ToggleShowUnlisted()<CR>
+    nnoremap <script> <silent> <nowait> <buffer> v             :call <SID>SelectBuffer("split", "vr")<CR>
+    nnoremap <script> <silent> <nowait> <buffer> V             :call <SID>SelectBuffer("split", "vl")<CR>
 
     for k in ["G", "n", "N", "L", "M", "H"]
         execute "nnoremap <buffer> <silent>" k ":keepjumps normal!" k."<CR>"
@@ -620,10 +623,13 @@ function! s:CreateHelp()
         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, '" a : toggle find active buffer')
+        call add(header, '" b : Fast buffer switching with b<any bufnum>')
         call add(header, '" B : toggle if to save/use recent tab or not')
         call add(header, '" d : delete buffer')
         call add(header, '" D : wipe buffer')
-        call add(header, '" f : toggle find active buffer')
+        call add(header, '" F : open buffer in another window above the current')
+        call add(header, '" f : open buffer in another window below the current')
         call add(header, '" p : toggle splitting of file and path name')
         call add(header, '" q : quit')
         call add(header, '" r : reverse sort')
@@ -632,6 +638,8 @@ function! s:CreateHelp()
         call add(header, '" S : reverse cycle thru "sort by" fields')
         call add(header, '" T : toggle if to show only buffers for this tab or not')
         call add(header, '" u : toggle showing unlisted buffers')
+        call add(header, '" V : open buffer in another window on the left of the current')
+        call add(header, '" v : open buffer in another window on the right of the current')
     else
         call add(header, '" Press <F1> for Help')
     endif
@@ -813,16 +821,14 @@ function! s:SelectBuffer(...)
             return s:Close()
         endif
 
-        " Are we suppose to open the selected buffer in a tab?
+        " Get the tab number where this bufer is located in.
+        let tabNbr = s:GetTabNbr(_bufNbr)
+        " Are we supposed to open the selected buffer in a tab?
         if (a:0 == 1) && (a:1 == "tab")
-            " Yes, we are to open the selected buffer in a tab.
 
             " Restore [BufExplorer] buffer.
             execute "silent buffer!".s:originBuffer
 
-            " Get the tab number where this buffer is located in.
-            let tabNbr = s:GetTabNbr(_bufNbr)
-
             " Was the tab found?
             if tabNbr == 0
                 " _bufNbr is not opened in any tabs. Open a new tab with the
@@ -843,9 +849,42 @@ function! s:SelectBuffer(...)
                 " Focus window.
                 execute s:GetWinNbr(tabNbr, _bufNbr) . "wincmd w"
             endif
-        else
-            " No, the user did not ask to open the selected buffer in a tab.
+            " Are we supposed to open the selected buffer in a split?
+        elseif (a:0 == 2) && (a:1 == "split")
+            if g:bufExplorerFindActive
+                call s:Close()
+            endif
+            " Was the tab found?
+            if tabNbr != 0
+                " Yes, the buffer is located in a tab. Go to that tab instead of
+                " opening split
+                execute tabNbr . "tabnext"
+            else
+                "Nope, the buffer is not in a tab, open it accordingly
+                let _bufName = expand("#"._bufNbr.":p")
+                if (a:2 == "vl")
+                    execute _bufName ?
+                                \ "vert topleft sb ".escape(_bufName, " ") :
+                                \ "vert topleft sb "._bufNbr
+                elseif (a:2 == "vr")
+                    execute _bufName ?
+                                \ "vert belowright sb ".escape(_bufName, " ") :
+                                \ "vert belowright sb "._bufNbr
+                elseif (a:2 == "st")
+                    execute _bufName ?
+                                \ "topleft sb ".escape(_bufName, " ") :
+                                \ "topleft sb "._bufNbr
+                else " = sb
+                    execute _bufName ?
+                                \ "belowright sb ".escape(_bufName, " ") :
+                                \ "belowright sb "._bufNbr
+                endif
+            endif
 
+            " Switch to selected buffer
+            execute "keepalt silent b!" _bufNbr
+            " Default, open in current window
+        else
             " Are we suppose to move to the tab where the active buffer is?
             if exists("g:bufExplorerChgWin")
                 execute g:bufExplorerChgWin."wincmd w"
@@ -854,9 +893,6 @@ function! s:SelectBuffer(...)
                     call s:Close()
                 endif
 
-                " Get the tab number where this buffer is located in.
-                let tabNbr = s:GetTabNbr(_bufNbr)
-
                 " Was the tab found?
                 if tabNbr != 0
                     " Yes, the buffer is located in a tab. Go to that tab number.