Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have configured NerdTree to open up when i start VIM by using Pathogen and placing NERDTree in my .vim/bundle directory. I have installed NERDTreeTabs the same way.

I don't want NERDTree to open though, when i am either opening a single file or creating a new file. How can i do this?

share|improve this question
Why don't you show us how you configured it to open automatically? – romainl Oct 23 '12 at 16:02
See my edit, no config at all. Just including it via pathogen. – Patrick Oscity Oct 27 '12 at 9:26

The general "always open NERDTree" behavior is added by NERDTreeTabs, and you can disable it by adding the following line to your .gvimrc file:

let g:nerdtree_tabs_open_on_gui_startup = 0

(There's also an equivalent option for console startup, but it already defaults to 0.)

Then, from the NERDTree README:

Q. How can I open a NERDTree automatically when vim starts up if no files were specified?

A. Stick this in your vimrc

autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

Note: This may not be a 100% perfect solution-- for example, new tabs will be opened without a NERDTree window. It might be possible to fix that by replacing the NerdTree with NERDTreeTabsToggle above, but doing that causes vim to show an error about trailing characters, and I don't know why that is.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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