mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 14:58:07 +08:00
Unlet! the nt variable before letting it.
Some will have a "NERDTree" buffer variable and others will not. In the ones that do, getbufvar will return a dictionary. getbufvar will return an empty string from the other buffers. When looping through the buffers, let will throw an error if nt already exists and is a different type than what is trying to be put into it. This easily can be illustrated by these two statements: :let x = "" :let x = {} E706: Variable type mismatch for: x This commit gets rid of the variable before setting it so that the mismatch cannot occur.
This commit is contained in:
parent
84e7a77a7e
commit
4477078170
|
@ -24,10 +24,13 @@ function! nerdtree#checkForBrowse(dir)
|
|||
call g:NERDTreeCreator.CreateWindowTree(a:dir)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:reuseWin(dir) {{{2
|
||||
"finds a NERDTree buffer with root of dir, and opens it.
|
||||
function! s:reuseWin(dir) abort
|
||||
let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p"))
|
||||
|
||||
for i in range(1, bufnr("$"))
|
||||
unlet! nt
|
||||
let nt = getbufvar(i, "NERDTree")
|
||||
if empty(nt)
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue
Block a user