Open NERDTreeFind tree at CWD if current file is below it.

This commit is contained in:
Benjamin Geiger 2011-06-15 17:26:21 -04:00 committed by Martin Grenfell
parent 4dd1bc9ef6
commit b3b394c329

View File

@ -2562,7 +2562,18 @@ function! s:findAndRevealPath()
endtry
if !s:treeExistsForTab()
call s:initNerdTree(p.getParent().str())
try
let cwd = s:Path.New(getcwd())
catch /^NERDTree.InvalidArgumentsError/
call s:echo("current directory does not exist.")
let cwd = p.getParent()
endtry
if p.isUnder(cwd)
call s:initNerdTree(cwd.str())
else
call s:initNerdTree(p.getParent().str())
endif
else
if !p.isUnder(s:TreeFileNode.GetRootForTab().path)
call s:initNerdTree(p.getParent().str())