Reputation: 3273
I would like NERDTree to open on startup when I start vim without any arguments, but I don't want it to open when I use foo | vim -
I have autocmd VimEnter * if !argc() | NERDTree | endif
in my vimrc already, but of course this still opens it with vim -
Upvotes: 1
Views: 600
Reputation: 172520
You can use the StdinReadPre
event to set a flag to detect this:
autocmd StdinReadPre * let g:isReadingFromStdin = 1
autocmd VimEnter * if !argc() && !exists('g:isReadingFromStdin') | NERDTree | endif
Upvotes: 3