Skip to content

Commit

Permalink
Merge pull request #98 from tartansandal/master
Browse files Browse the repository at this point in the history
Use independent variable to track window splitting.
  • Loading branch information
jlanzarotta authored Jan 28, 2022
2 parents b5c9014 + 3772d40 commit a49af60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/bufexplorer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ let s:originBuffer = 0
let s:running = 0
let s:sort_by = ["number", "name", "fullpath", "mru", "extension"]
let s:splitMode = ""
let s:didSplit = 0
let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'}

" Setup the autocommands that handle the MRUList and other stuff. {{{2
Expand Down Expand Up @@ -361,6 +362,7 @@ function! s:Cleanup()

let s:running = 0
let s:splitMode = ""
let s:didSplit = 0

delmarks!
endfunction
Expand Down Expand Up @@ -453,6 +455,9 @@ function! BufExplorer()

" Restore the original settings.
let [&splitbelow, &splitright] = [_splitbelow, _splitright]

" Remember that a split was triggered
let s:didSplit = 1
endif

if !exists("b:displayMode") || b:displayMode != "winmanager"
Expand Down Expand Up @@ -1039,7 +1044,7 @@ function! s:Close()
endif

" If we needed to split the main window, close the split one.
if s:splitMode != "" && bufwinnr(s:originBuffer) != -1
if s:didSplit == 1 && bufwinnr(s:originBuffer) != -1
execute "wincmd c"
endif

Expand Down

0 comments on commit a49af60

Please sign in to comment.