How can I see the file or directory named passed to Vim from the command line?
Question
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.
Solution
Looked up arglist
per Alligator's advice. Ended up with the following:
if argc() > 0 && isdirectory(argv(0))
autocmd VimEnter * silent NERDTree
endif
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow