mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-23 08:46:52 +08:00
Open NERDTreeFind tree at CWD if current file is below it.
This commit is contained in:
parent
4dd1bc9ef6
commit
b3b394c329
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue
Block a user