This implements what you want (taken from the diffexpr
docs with -b
changed to -w
):
set diffopt+=iwhite
set diffexpr=DiffW()
function DiffW()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-w " " swapped vim's -b with -w
endif
silent execute "!diff -a --binary " . opt .
\ v:fname_in . " " . v:fname_new . " > " . v:fname_out
endfunction
… I’m still looking for a better diffexpr helper with respect to handling which lines map to which (GNU diff, even with -w
instead of -b
, is rather baffled by combining extra whitespace with minor edits like commented lines). Maybe diffchar?