开发者

Activating alternate Diff mode via a function call in Vim/gVim

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

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;.

0

精彩评论

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