I'm using Nerd-tree for vim. Whenever I use :NERDTreeToggle key, it opens up two directory windows instead of one, like soenter image description here

It's only when I type :qon one of the windows does it become like this enter image description here How do I get it to only open one window on pressing the nerd-toggle key? Here's the content of my .vimrc(not created by me).

3 Answers 3


I found this answer. Putting this code in my .vimrc file helped solve the issue, now I only get one directory window instead of two.
au VimEnter * NERDTree


Just comment out the lines from 80 to 94 and things will be fine.

As, it looks to me, the reason for this is because of opening NERDTreeFind , a new directory window is opened.


on line 94 of your .vimrc replace BufEnter with BufRead like so

autocmd BufEnter * call SyncTree()

autocmd BufRead * call SyncTree()

With this line you don't need to have NERDTree always open when opening a file (which is what your current answer - au VimEnter * NERDTree does)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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