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