In a recent question, I asked how 开发者_运维百科to make vimdiff ignore the extra spaces when comparing. Following the answer and some further reading, I tried to do the following:
.1. Locate _vimrc
and find the MyDiff()
function definition. It contains the line:
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
.2. Duplicate the function as MyDiff2()
in _vimrc
, while changing that line to:
if &diffopt =~ 'iwhite' | let opt = opt . '--ignore-all-space ' | endif
.3. Open gVim with two files in Diff mode, then:
:set diffexpr=MyDiff2()
:set diffopt+=iwhite
:call MyDiff2()
and also:
:diffupdate
I expected this to make vimdiff ignore differences like:
r3=r2;
vs r3 = r2;
, but it does not. Why is that?
My settings are as following:
diffexpr=MyDiff2()
diffopt=filler,iwhite,icase
OK, it seems like I found a solution that works, following this question. Instead of using --ignore-all-space
, I used -w
and now it looks like gVim ignores the differences between r3=r2;
and r3 = r2;
.
精彩评论