1

I have this in my .vimrc:

autocmd VimEnter * if !argc() | NERDTree | se nu  | se rnu | endif

Also, I have an alias in my .bashrc:

alias fv='find "$PWD" -maxdepth 1 | vim -R -'

After I run fv in command line - It opens vim with NERDTree opened in it. Is there a way to not open NERDTree when I run vim with -R option?

3

Instead of just asking if there are no arguments, you could also ask if the buffer is empty. If you substitute !argc() in your autocmd by

!argc() && bufnr('$') == 1 && line('$') == 1 && getline(1) == '' 

you should get the desired result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.