mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 20:03:48 -05:00
ensure all secondary nerd tree buf names are unique
This commit is contained in:
@@ -1982,8 +1982,7 @@ endfunction " >>>
|
|||||||
"FUNCTION: s:checkForBrowse(dir) {{{2
|
"FUNCTION: s:checkForBrowse(dir) {{{2
|
||||||
"inits a secondary nerd tree in the current buffer if appropriate
|
"inits a secondary nerd tree in the current buffer if appropriate
|
||||||
function! s:checkForBrowse(dir)
|
function! s:checkForBrowse(dir)
|
||||||
if !exists("b:NERDTreeProcessed") && a:dir != '' && isdirectory(a:dir)
|
if a:dir != '' && isdirectory(a:dir)
|
||||||
let b:NERDTreeProcessed = 1
|
|
||||||
call s:initNerdTreeInPlace(a:dir)
|
call s:initNerdTreeInPlace(a:dir)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -2066,7 +2065,7 @@ function! s:initNerdTree(name)
|
|||||||
call b:NERDTreeRoot.putCursorHere(0, 0)
|
call b:NERDTreeRoot.putCursorHere(0, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:initNerdTreeInPlace(name) {{{2
|
"FUNCTION: s:initNerdTreeInPlace(dir) {{{2
|
||||||
function! s:initNerdTreeInPlace(dir)
|
function! s:initNerdTreeInPlace(dir)
|
||||||
try
|
try
|
||||||
let path = s:Path.New(a:dir)
|
let path = s:Path.New(a:dir)
|
||||||
@@ -2074,6 +2073,11 @@ function! s:initNerdTreeInPlace(dir)
|
|||||||
call s:echo("Invalid directory name:" . a:name)
|
call s:echo("Invalid directory name:" . a:name)
|
||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
"we need a unique name for each secondary tree buffer to ensure they are
|
||||||
|
"all independent
|
||||||
|
exec "silent edit " . s:nextBufferName()
|
||||||
|
|
||||||
let b:NERDTreeRoot = s:TreeDirNode.New(path)
|
let b:NERDTreeRoot = s:TreeDirNode.New(path)
|
||||||
call b:NERDTreeRoot.open()
|
call b:NERDTreeRoot.open()
|
||||||
|
|
||||||
@@ -2167,6 +2171,13 @@ function! s:initNerdTreeMirror()
|
|||||||
call s:renderView()
|
call s:renderView()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
" FUNCTION: s:nextBufferName() {{{2
|
||||||
|
" returns the buffer name for the next nerd tree
|
||||||
|
function! s:nextBufferName()
|
||||||
|
let name = s:NERDTreeBufName . s:next_buffer_number
|
||||||
|
let s:next_buffer_number += 1
|
||||||
|
return name
|
||||||
|
endfunction
|
||||||
" FUNCTION: s:tabpagevar(tabnr, var) {{{2
|
" FUNCTION: s:tabpagevar(tabnr, var) {{{2
|
||||||
function! s:tabpagevar(tabnr, var)
|
function! s:tabpagevar(tabnr, var)
|
||||||
let currentTab = tabpagenr()
|
let currentTab = tabpagenr()
|
||||||
|
|||||||
Reference in New Issue
Block a user