Ver Fonte

Merge pull request #15 from halfmanhalffish/halfmanhalffish

bug fix
jlanzarotta há 11 anos atrás
pai
commit
7af2c4e846
1 ficheiros alterados com 10 adições e 3 exclusões
  1. 10 3
      plugin/bufexplorer.vim

+ 10 - 3
plugin/bufexplorer.vim

@@ -112,6 +112,8 @@ let s:sort_by = ["number", "name", "fullpath", "mru", "extension"]
 let s:splitMode = ""
 let s:tabSpace = []
 let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'}
+let s:altBufferOnEntry = ""
+let s:activeBufferOnEntry = ""
 
 " Setup the autocommands that handle the MRUList and other stuff. {{{2
 autocmd VimEnter * call s:Setup()
@@ -683,6 +685,12 @@ function! s:BuildBufferList()
             endif
         endif
 
+        if buf.attributes =~ "%"
+            let s:activeBufferOnEntry = matchstr(buf.attributes, '[0-9]\+')
+        elseif buf.attributes =~ "#"
+            let s:altBufferOnEntry =  matchstr(buf.attributes, '[0-9]\+')
+        endif
+
         let line = buf.attributes." "
 
         " Are we to split the path and file name?
@@ -916,9 +924,8 @@ function! s:Close()
     else
         " Since there are buffers left to switch to, swith to the previous and
         " then the current.
-        for b in reverse(listed[0:1])
-            execute "keepjumps silent b ".b
-        endfor
+        execute "keepjumps silent b ".s:altBufferOnEntry
+        execute "keepjumps silent b ".s:activeBufferOnEntry
     endif
 
     " Clear any messages.