Vim Tips Wiki
Advertisement

Obsolete tip

This tip has been merged into another tip.
See VimTip416 for the current tip.

Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip416.


Tip 678 Printable Monobook Previous Next

created March 15, 2004 · complexity basic · author jimi · version 6.0


I was having problems getting the diff utility to work running version 6.2 of Vim from within Windows. I loaded SFU 3.5, Services for Unix, onto Windows XP SP1, to try and take advantage of the included diff utility. Basically what I have found is that it works out of the box, so long as you do not specify the "icase" parameter with diffopt.

That is, if you have:

diffopt=filler,context:2,icase,iwhite

you will receive E97: Cannot create diffs. However, if you simply remove the icase parameter and have:

diffopt=filler,context:2,iwhite

Diff will work just fine with SFU 3.5, no special functions or scripts required. Unless, of cource, you want to ignore case.

Comments

I don't know anything about SFU, but to get diff to work under Windows (XP SP1) I just had to add another set of double quotes around the diff command in vimrc inside the MyDiff() function. So, an extra one just before the C of the C: drive and at the end of the string.

silent execute '!""C:\Program Files\vim\vim62\diff" -a ' . opt . '"' . v:fname_in . '" "' . v:fname_new . '" > "' . v:fname_out . '""'

In my config, also the icase clause works. Maybe, this solution works for you too.


Here are my settings for vim/win98.

It only works with gnu diff.exe (get it from google search). Gnu diff is a necessity for serious work anyway, All other diffs don't support the heavy duty options. Note that shell quotes are different for command.com/win98,cmd.exe/nt.

On linux and other unixes, 'vim -d' should work out of the box because of bash/sh/gnu-diff.

> ver
windows 98
> cat _vimrc
 set shell=command.com shellquote="" shellxquote="" shellpipe=>
 set shellredir=>
 set diffexpr="" diffopt=filler,iwhite,icase,context:6

>diff.exe -v1
GNU diff version 2.3

> vim -od x y
> vim -V -od x y ... to see how diff is called, if you have problems.

The first entry on VimTip416 saved my day!


Advertisement