mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
really fix the previous buffer issue when closing a tree win
So :bprev was failing to jump back to the right buffer. I dont fully understand this yet, but I'm fairly sure this is because there is a magic <directory> buffer that we delete when creating a wintree :-/ Anyway, we are explicitly storing the prev buffer again - and updating it when reusing treewins. It's worky, but there may be a superior way...
This commit is contained in:
@@ -37,6 +37,7 @@ function! s:reuseWin(dir) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if nt.isWinTree() && nt.root.path.equals(path)
|
if nt.isWinTree() && nt.root.path.equals(path)
|
||||||
|
call nt.setPreviousBuf(bufnr("#"))
|
||||||
exec "buffer " . i
|
exec "buffer " . i
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -186,6 +186,10 @@ function! s:NERDTree.previousBuf()
|
|||||||
return self._previousBuf
|
return self._previousBuf
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:NERDTree.setPreviousBuf(bnum)
|
||||||
|
let self._previousBuf = a:bnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.render() {{{1
|
"FUNCTION: s:NERDTree.render() {{{1
|
||||||
"A convenience function - since this is called often
|
"A convenience function - since this is called often
|
||||||
function! s:NERDTree.render()
|
function! s:NERDTree.render()
|
||||||
|
|||||||
Reference in New Issue
Block a user