Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-open NERDTree in vim

Does someone know how to force .vimrc to auto-open NERDTree each time vim is invoked? The operation system is *nix.

like image 446
varnie Avatar asked Nov 18 '09 22:11

varnie


People also ask

How do I open a NERDTree file?

If you want to use NERDTree, you can open NERDTree (type :NERDTree ), navigate to your file, and then press t with cursor on the file name. This will open specific file in new tab.

How do you switch windows in NERDTree?

(1) Thus, if your edit window is to the right of the NERDTree window, you would use: ctrl + W l to go to right window and ctrl + W h to go to left window. or ctrl + w twice to toggle between the two.


2 Answers

 au VimEnter *  NERDTree 

in your vimrc should do it

:he autocmd.txt for background

like image 94
michael Avatar answered Sep 19 '22 09:09

michael


You can also only open Nerd Tree when there was no file on the command line:

function! StartUp()     if 0 == argc()         NERDTree     end endfunction  autocmd VimEnter * call StartUp() 

Taken from a blog post by Ovid.

like image 44
zoul Avatar answered Sep 19 '22 09:09

zoul