tags:

views:

125

answers:

2

I've been using VIM now for most of my editing for the last week or so and I'm loving the experience. However I have an issue.

I've setup my .vimrc file with NERD_tree and a few other goodies. This works well for when I'm coding. However on occasion I use vimdiff via git and this causes some problems. I don't need NERD_Tree open when I do this or many of the other things I've setup in my .vimrc file.

Here's my question. Is there a way to check what is calling my .vimrc file and have it execute different code depending on the caller? Specifically how do I test to see if vimdiff is the caller? Or am I going about this entirely the wrong way?

+7  A: 

Excerpt from the VIM manual called up by typing in :h diff

if &diff
   setup for diff mode
else
   setup for non-diff mode
endif
Daniel Bruce
+1  A: 

Definitely you want to use Daniel Bruce's solution -- I suspect you always want a different configuration for vimdiff than for vim, whether git is in the picture or not.

But if you want particular behaviour for vimdiff when used with git as opposed to standalone, you can instead use a wrapper script for your gitconfig [diff] external, and the script could select a different rc file altogether.

Zac Thompson