Tip: #678 - Get diff to work with Windows SFU
Created: March 15, 2004 12:02 Complexity: basic Author: jimi Version: 6.0 Karma: 0/0 Imported from: Tip#678
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 _vimr 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.
snowkrash--AT--zonnet.nl , March 19, 2004 4:49
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.
- Mohsin.
http://www.cs.albany.edu/~mosh , March 20, 2004 12:34
- WinXP (sp1) - diff - GNU diffutils version 2.7
When I diff two files from xp-explorer I always get this:
Error detected while processing function <SNR>33_EditAll: line 6: E97: Cannot create diffs
Any hints?
nomail , March 22, 2004 8:57
Check your tmp, temp ENV variables in cmd.exe; even XP apps won't work if you change $TMP or $TEMP to C:/tmp, or to simply see what went wrong inside vim, do:
vim -V10 -d f1 f2 .. to see the messages, and then try vim -D -d f1 f2 .. to run in debug mode.
mosh , March 27, 2004 20:09
%tmp% was okay. It is now working though. The first entry on
Saved my day!
One thing that was really wiered was:
This is working:
silent execute '!"C:\program files\vim\vim62\diff" -a ' ....
and This is not working (gives E97:)
silent execute '!"C:\utils\diff" -a ' .....
Where I have the following:
C:\>c:\utils\diff -v diff - GNU diffutils version 2.7
C:\>c:\Progra~1\vim\vim62\diff -v diff - GNU diffutils version 2.7
I'm using cmd.exe