开发者

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

开发者 https://www.devze.com 2023-02-05 18:01 出处:网络
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

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 ple开发者_如何学Goasant experience with the same.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消