tags:

views:

46

answers:

1

I'd like to set up my .vimrc so that NERDTree is open whenever vim (or MacVim) is called from the command line with a directory argument, but closed when vim is called with a file argument. I looked through the list of vim's built-in variables but couldn't find anything that looked promising.

+2  A: 

Looked up arglist per Alligator's advice. Ended up with the following:

if argc() > 0 && isdirectory(argv(0))
    autocmd VimEnter * silent NERDTree
endif
John Debs