3

I know that I can ignore white space in vimdiff by se diffopt+=iwhte

but I also want to ignore newline character in vimdiff. How can I do it?

e.g.

if (a>b){
bar()`

would not be shown diff with

if(a>b){bar()

Thanks,

ravi
  • 3,304
  • 6
  • 25
  • 27

1 Answers1

1

To really omit the added lines, you will have to write a custom diff function, cp. :help diff-diffexpr.

If you just don't want to see the added lines (because they're too visually distracting), you can modify the DiffAdd highlight group to show white-on-white (or black-on-black in the console) text (or any other low-contrast coloring, in a similar way:

:highlight DiffAdd ctermfg=black ctermbg=NONE guifg=bg guibg=NONE
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • @ravi: So, you've clarified that you don't want to ignore added lines, just the newline character. My first part of the answer still stands: You need to find a diff tool that supports this. Note that such an implementation may be slower than a vanilla diff, because it also has to take joined lines into account. – Ingo Karkat May 16 '12 at 07:17