Browse Source

Merge pull request #29 from PhilRunninger/master

(Partially) Fixes: Erroneous listing of [BufExplorer] in buffer list
jlanzarotta 11 năm trước cách đây
mục cha
commit
870ff7e468
1 tập tin đã thay đổi với 10 bổ sung5 xóa
  1. 10 5
      plugin/bufexplorer.vim

+ 10 - 5
plugin/bufexplorer.vim

@@ -268,7 +268,7 @@ function! s:ShouldIgnore(buf)
     endif
 
     " Ignore the BufExplorer buffer.
-    if fnamemodify(bufname(a:buf), ":t") == s:name
+    if fnamemodify(bufname(a:buf), ":t") == s:BufExplorerName()
         return 1
     endif
 
@@ -344,22 +344,27 @@ endfunction
 
 " ToggleBufExplorer {{{2
 function! ToggleBufExplorer()
-    if exists("s:running") && s:running == 1
-        call BufExplorer()
+    if exists("s:running") && s:running == 1 && bufname(winbufnr(0)) == s:BufExplorerName()
         call s:Close()
     else
         call BufExplorer()
     endif
 endfunction
 
-" BufExplorer {{{2
-function! BufExplorer()
+" BufexplorerName {{{2
+function! s:BufExplorerName()
     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
+    return name
+endfunction
+
+" BufExplorer {{{2
+function! BufExplorer()
+    let name = s:BufExplorerName()
 
     " Make sure there is only one explorer open at a time.
     if s:running == 1