How to add NERDTree to your .vimrc

chutsu picture chutsu · Sep 19, 2009 · Viewed 72.7k times · Source

How do I add NERDTree to my .vimrc?

Answer

Douglas Mayle picture Douglas Mayle · Sep 19, 2009

Okay, the previous version was a bit terse, but the answer you're looking for is to add the line below into your ~/.vimrc file. It tells Vim that you want to setup a command to run when Vim starts, but since it depends on various plugins to be loaded, you don't want to run it until all initialization is finished:

autocmd VimEnter * NERDTree

If, however, you're annoyed by the fact that the cursor always starts in the NERDTree window, you can add a second autocommand that will move the cursor into the main window:

autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p