配置vim-diff以在将其用于svn-diff时显示不同的颜色

时间:2011-01-21 10:39:02

标签: svn vim vimdiff

我已将'vimdiff'设置为我的默认svn-diff工具,方法是在~/.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

但是,vimdiff将所有难看的颜色都显示出差异。我有黑色背景和绿色字体颜色,如何修改vimdiff以显示此差异的自定义颜色?我想要一个更愉快的经历。

1 个答案:

答案 0 :(得分:10)

您可以在colorscheme文件中定义颜色。 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

在编辑colorscheme文件之前,您可以通过以下方式定义vim会话中的颜色来开始实验:

:highlight DiffDelete ctermfg=black ctermbg=yellow 

找到颜色后,将它们放在colroscheme中,然后开心。或者只是将突出显示声明放在“vimrc”中。取决于你喜欢什么。

顺便说一句,你也可以在做差异时切换你的颜色方案。例如,如果您在进行差异时喜欢不同的颜色。这是通过以下方式完成的:

if &diff
    colorscheme some_other_scheme
endif

祝好运实验