Reputation: 3784
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.
Upvotes: 3
Views: 134
Reputation: 3784
Looked up arglist
per Alligator's advice. Ended up with the following:
if argc() > 0 && isdirectory(argv(0))
autocmd VimEnter * silent NERDTree
endif
Upvotes: 3