Is there a way to make NERDTree expand to display the current file's directory - without messing with the working directory or changing the tree root?

So when working with baz.ext, it should look like this without manually having to expand the respective trees:

/ # project root
|+.../
|~foo/
| |~bar/
| | |-...
| | |-baz.ext # current file
| | `-...
|+.../
link|improve this question

80% accept rate
feedback

1 Answer

up vote 2 down vote accepted

Vim: How to synchronize NERDTree with current opened tab file path?

the map <leader>r :NERDTreeFind<cr> answer works for me.

link|improve this answer
though I can't upvote it without a 15 reputation ;) – pferdefleisch Nov 11 '11 at 9:22
Wow, how could I miss that - thanks a lot! – AnC Nov 11 '11 at 11:02
woohoo! I can upvote. And you have received a present for your kindness. I just had an upvote party! – pferdefleisch Nov 11 '11 at 12:28
Actually, turns out this wasn't quite what I'd hoped for: The tree does not expand, but rather uses the current file's directory as root. (So in the example above, I'd just see the bar directory.) Since there doesn't seem to be an easy solution to this, the above's still good enough though. – AnC Nov 14 '11 at 8:38
1  
With the latest version, NERDTreeFind does exactly what I want: github.com/scrooloose/nerdtree/pull/72 - so I guess you were prescient, pferdefleisch... – AnC Jan 4 at 14:33
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.