How can I see the file or directory transferred to Vim from the command line?

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

+3
source share
1 answer

Viewed arglistfor Alligator advice. Ends with the following:

if argc() > 0 && isdirectory(argv(0))
    autocmd VimEnter * silent NERDTree
endif
+3
source

Source: https://habr.com/ru/post/1772345/


All Articles