Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure vim-diff to show different colors when using it for svn-diff

Tags:

vim

svn

vimdiff

I have set up 'vimdiff' as my default svn-diff tool by adding below line to ~/.subversion/config

diff-cmd = /home/ravikirn/svndiff/diffwrap.sh

diffwrap.sh

!/bin/sh

# Configure your favorite diff program here.
DIFF="/usr/local/bin/vimdiff"

# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}

# Call the diff command (change the following line to make sense for 
# your merge program).

$DIFF $LEFT $RIGHT

But, vimdiff puts all ugly colors to display the diff. I have black background and green font color, how can I modify vimdiff to show custom colors for this diff ? I want a more pleasant experience with the same.

like image 406
Ravikiran Avatar asked Jan 21 '11 10:01

Ravikiran


1 Answers

You can define colors in your colorscheme file. There are a couple of group highlights for vimdiff:

DiffAdd     diff mode: Added line
DiffChange  diff mode: Changed line
DiffDelete  diff mode: Deleted line
DiffText    diff mode: Changed text within a changed line

Before you edit your colorscheme file, you can start experiment, by defining colors in a vim session, by doing like :

:highlight DiffDelete ctermfg=black ctermbg=yellow 

After you found your colors, place them in your colroscheme, and be happy. Or just place your highlight declarations inside "vimrc". Depends what you prefer.

Btw, you also can switch your colorscheme when doing diff. For example if you prefer different color when diffing. This is done by this :

if &diff
    colorscheme some_other_scheme
endif

Good luck with experiments

like image 148
nemisj Avatar answered Sep 26 '22 17:09

nemisj