Question

I have configured Git to use Vimdiff as its diff/merge tool on a Windows machine. It works, but the colors are messed up. First, it won't show any syntax highlighting, no matter how much I tell it to turn the syntax on and set the filetype. Second, the colorscheme is obnoxious, but when I do :colorscheme and hit CTRL-D, I do not see the usual list of colorschemes. None of the default ones are there, only ones that I installed myself.

The weird thing is that my colorscheme is fine, and I have all the expected colorschemes available, and syntax highlighting works, when I launch Vim directly from the command prompt, i.e. not through Git.

This makes it unnecessarily painful to review changes, and it is especially annoying when I'm trying to show a diff to a coworker. They are nearly unreadable. This has been bothering me for months and I can't figure it out.

Is there something different about having Git start Vim from just launching Vim? How do I fix this so can get my Vims behaving consistently?

Was it helpful?

Solution

Finally, after months, I figured it out. I thought I should share my findings in case anyone else was fighting the same battle.

Git for Windows comes packaged with its own versions of a number of programs. Apparently, Vim is among them. Doing a :echo $VIM shows that when Vim is started by Git, it is pointing to C:/Program Files (x86)/Git/share/vim. This Vim install seems different than my full Windows Vim install.

At this point you could solve the problem several ways, conceivably. One would be to repoint the VIM environment variable. Instead, I changed the path above to be a symbolic link to my actual Vim install:

C:\Program Files (x86)\Git\share>mklink /D "C:\Program Files (x86)\Git\share\vim" "C:\Program Files (x86)\Vim\"
symbolic link created for C:\Program Files (x86)\Git\share\vim <<===>> C:\Program Files (x86)\Vim\

Now the syntax highlighting is working, the colorscheme looks good, and it is much easier to review code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top