Use a better check for existence of the NERDTree buffer.
If the user wipes out or deletes (:bw or :bd) the NERDTree buffer, there is still a tab variable that hangs onto the name of that now-missing buffer. Checking only that variable is not enough to decide whether to create a new NERDTree or use the existing one. Fortunately, there already is a function with a more complete check: ExistsForTab()
This commit is contained in:
parent
e47e588705
commit
dc349a072a
@ -185,7 +185,7 @@ function! s:Creator._createTreeWin()
|
|||||||
let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright "
|
let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright "
|
||||||
let splitSize = g:NERDTreeWinSize
|
let splitSize = g:NERDTreeWinSize
|
||||||
|
|
||||||
if !exists('t:NERDTreeBufName')
|
if !g:NERDTree.ExistsForTab()
|
||||||
let t:NERDTreeBufName = self._nextBufferName()
|
let t:NERDTreeBufName = self._nextBufferName()
|
||||||
silent! exec splitLocation . 'vertical ' . splitSize . ' new'
|
silent! exec splitLocation . 'vertical ' . splitSize . ' new'
|
||||||
silent! exec "edit " . t:NERDTreeBufName
|
silent! exec "edit " . t:NERDTreeBufName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user