I read http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/ and as Drew says you can add let NERDTreeHijackNetrw=1 and NERDTree will open up in the current window if I do :e .. However it seems to be a new instance of NERDTree every time it's opened because it does not remember which folders I had open before like it does if I run :NERDTreeToggle. Is it possible to have both? Have NERDTree open in the current window and remember where it was (reuse the same instance)?
I would really like this feature. Any ideas on how to accomplish this?
Every time NERDTree creates an instance via the NERDTreeHijackNetrw function is assigns it a unique buffer name i.e. NERD_tree_1, NERD_tree_2, etc. Why it's designed this way is not entirely clear to me, but as it turns out you can easily switch to the first instance by typing :buffer NERD_tree_1 without ever having to create a new one.
So instead of editing the NERDTree source, I just created a mapping that looks like this:
nnoremap <leader>e :buffer NERD_tree_1<CR>
Hope this helps.
I like this feature too!
Hi, I have added a simple proof of concept for this in this branch: https://github.com/scrooloose/nerdtree/tree/reuse-win-tree
Try it out and let me know how you get on :)
@PhilRunninger any thoughts on this? It seems like The Right Way (TM) to go - at least in theory.
I like the approach. I'm getting an error though. I think it's related to buffer 1 no longer being in my list as you loop through the list.
After entering :e .. for the second (maybe third) time...

Hmm, I cant reproduce this :-/
Can you give any more info about it?
:e .. opens a NERDTree:e .. again should open the same NERDTree buffer, but I get the error shown above.It happens on the let nt = getbufvar(i, "NERDTree") statement when nt exists from the previous loop iteration, and is an incompatible type. If it's already an empty string, it cannot be set to a dictionary, and vice versa.
I added a new commit to fix it, but I don't know if I did it the correct way.
I still cant reproduce this. Vimscript is awesome! But I've merged it back into master (with your fix). Thanks for testing/feedback :-)
I've been using nerdtree with :e . at work for a few days and its actually pretty awesome.
This is awesome. Any tips on how to do the same with NerdTreeFind ?
@juanibiapina https://github.com/hjdivad/dotfiles/commit/f030f34018a3013193e9e416c208195949798e3e might be close enough to want you want.
It relies on a mapping (in my case <leader>ne) and will make the opened NERDTree the implicit one for the tab (so it only really makes sense if you never want to use NERDTree on the sides) and finally NERDTReeFinds the buffer your window was editing.
You can likely tweak it according to your preferences.
I've actually rewritten most of NerdTree to work with splits properly: https://github.com/juanibiapina/vim-lighttree
Most helpful comment
I've actually rewritten most of NerdTree to work with splits properly: https://github.com/juanibiapina/vim-lighttree