make the NERDTreeMirror handler smarter

This commit is contained in:
Martin Grenfell 2008-12-17 20:21:06 +13:00
parent 589036f5c9
commit 402fea6902

View File

@ -1817,19 +1817,27 @@ function! s:initNerdTreeMirror()
let trees[treeRoot.path.strForOS(0)] = i let trees[treeRoot.path.strForOS(0)] = i
endfor endfor
let bufferName = ''
if len(keys(trees)) > 1
let options = insert(keys(trees), 'Select a tree to mirror:', 0) let options = insert(keys(trees), 'Select a tree to mirror:', 0)
let i = 1 let i = 1
while i < len(options) while i < len(options)
let options[i] = i . ' ' . options[i] let options[i] = i . ' ' . options[i]
let i += 1 let i += 1
endwhile endwhile
let choice = inputlist(options) let choice = inputlist(options)
if choice < 1 || choice > len(options) if choice < 1 || choice > len(options) || choice == ''
throw "NERDTree.InvalidInput" return
endif endif
let bufferName = trees[keys(trees)[choice-1]] let bufferName = trees[keys(trees)[choice-1]]
elseif len(keys(trees)) == 1
let bufferName = values(trees)[0]
else
return s:initNerdTree('')
endif
if s:treeExistsForTab() if s:treeExistsForTab()
if s:isTreeOpen() if s:isTreeOpen()