cannot use diff

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

cannot use diff

Bouckaert, Hugo
Hi
 
I am fairly new to vim so this may be a stupid question. I am trying to
use diff with gvim on Windows and read the documentation but I can't get
it to work.
 
I am putting two files in diff mode with one file already open:
 
:diffthis
:vsplit file2
:diffthis
 
When I use it, all I see in the vertically split files is a fold at the
very top.  When I click on the utmost left + sign  (there is another +
sign not in the margin but that does not do anything) then both files
simply unfold and show but without any highlighting of the lines that
are different. When the fold is closed, next to the fold it lists only
the first line that is different. That's all I can do.
 
There is an additional margin for each file when they are in diff mode
which has dashes (--) next to each line but clicking on those dashes
does not do anything either.
 
What I would like to do is to compare two files in a vertical split with
the lines that are different highlighted and perhaps the "extra" lines
in one file matched by spaces in the other. Then of course it would be
nice to merge differences and the like. But simply showing the different
lines would be already very useful. Is this possible?
 
Note that my _vimrc file has a function for diff that was there already.
Perhaps this is doing the wrong thing and preventing me from using diff?

 
Here is the function in my _vimrc file:
 
set efm=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
 
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  silent execute '!C:\Vim\vim63\diff ' . opt . arg1 . ' ' . arg2 . ' > '
. arg3
endfunction
 
If I need this function, I am actually not sure how to start it. If it
is OK to use, how would one make use of the function to compare two
files?
 
Thanks
 
Hugo  
 
 
Hugo Bouckaert
Oracle Analyst / Programmer
Two's Complement Computing
--------------------------------------------------
This email and any attachments may be confidential or legally
privileged. If you received this message in error or are not the
intended recipient, you should destroy the e-mail message and any
attachments or copies, and you are prohibited from retaining,
distributing, disclosing or using any information contained herein.
Please inform us of the erroneous delivery by return e-mail. Thank you
for your cooperation.
 
 
Hugo Bouckaert
Oracle Analyst / Programmer
Two's Complement Computing
--------------------------------------------------
This email and any attachments may be confidential or legally
privileged. If you received this message in error or are not the
intended recipient, you should destroy the e-mail message and any
attachments or copies, and you are prohibited from retaining,
distributing, disclosing or using any information contained herein.
Please inform us of the erroneous delivery by return e-mail. Thank you
for your cooperation.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Vim List" <[hidden email]>
Sent: Tuesday, August 16, 2005 4:24 AM
Subject: cannot use diff


> Hi
>
> I am fairly new to vim so this may be a stupid question. I am trying to
> use diff with gvim on Windows and read the documentation but I can't get
> it to work.
>
> I am putting two files in diff mode with one file already open:
>
> :diffthis
> :vsplit file2
> :diffthis
>
> When I use it, all I see in the vertically split files is a fold at the
> very top.  When I click on the utmost left + sign  (there is another +
> sign not in the margin but that does not do anything) then both files
> simply unfold and show but without any highlighting of the lines that
> are different. When the fold is closed, next to the fold it lists only
> the first line that is different. That's all I can do.
[...]

To use diff mode with Vim you need an external "diff" program which produces
what Vim expects of it. Unix usually has it, Windows usually not. The one I
use under Windows comes from the GnuWin32 project at
http://www.sourceforge.net/

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: cannot use diff

Bouckaert, Hugo
In reply to this post by Bouckaert, Hugo
Hi Tony

I think I have a windows diff utility, although "man diff" (which
returns some instructions) does not tell me whether it is the GnuWin32
diff you are referring to:

C:\>diff
Usage: diff [-befhHimnNrsw] [-c[n]] [-C n] [-Dname] [-M mark] file1
file2

Assuming I have a valid Windows diff utility, how would I use it with
gvim?

Thanks

Hugo  
 

-----Original Message-----
From: Tony Mechelynck [mailto:[hidden email]]
Sent: Tuesday, 16 August 2005 11:18 AM
To: Bouckaert, Hugo; Vim List
Subject: Re: cannot use diff

----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Vim List" <[hidden email]>
Sent: Tuesday, August 16, 2005 4:24 AM
Subject: cannot use diff


> Hi
>
> I am fairly new to vim so this may be a stupid question. I am trying
to
> use diff with gvim on Windows and read the documentation but I can't
get
> it to work.
>
> I am putting two files in diff mode with one file already open:
>
> :diffthis
> :vsplit file2
> :diffthis
>
> When I use it, all I see in the vertically split files is a fold at
the
> very top.  When I click on the utmost left + sign  (there is another +
> sign not in the margin but that does not do anything) then both files
> simply unfold and show but without any highlighting of the lines that
> are different. When the fold is closed, next to the fold it lists only
> the first line that is different. That's all I can do.
[...]

To use diff mode with Vim you need an external "diff" program which
produces
what Vim expects of it. Unix usually has it, Windows usually not. The
one I
use under Windows comes from the GnuWin32 project at
http://www.sourceforge.net/

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Vim List"
<[hidden email]>
Sent: Tuesday, August 16, 2005 5:50 AM
Subject: RE: cannot use diff


> Hi Tony
>
> I think I have a windows diff utility, although "man diff" (which
> returns some instructions) does not tell me whether it is the GnuWin32
> diff you are referring to:
>
> C:\>diff
> Usage: diff [-befhHimnNrsw] [-c[n]] [-C n] [-Dname] [-M mark] file1
> file2
>
> Assuming I have a valid Windows diff utility, how would I use it with
> gvim?
>
> Thanks
>
> Hugo

- It must be in the PATH
- gvim invokes it itself
- What you do is:
    = either "gvim -d file1 file2" (without quotes) at the Dos prompt
    = or the following inside Vim:

        :e file1
        :diffsplit file2

or

        :e file1
        :diffthis
        :vsplit file2
        :diffthis

The version I have (which resides in C:\Program Files\GnuWin32\bin) says the
following as answer to "diff --version" (the first 2 lines are the prompt,
including the command-line)

mar. 16/08/2005        5:01:10
C:\DOCUME~1\Tony\MIJNDO~1>diff --version
diff (GNU diffutils) 2.8.7
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



If you have something else, you can always get this (or maybe a later
version of the same).
Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: cannot use diff

Bouckaert, Hugo
In reply to this post by Bouckaert, Hugo
Hi Tony

I found a diff utility under my cygwin installation which looks very
similar to the one you mention:

$ diff --version
diff - GNU diffutils version 2.7-cygwin-990830

And so I have set the function MyDiff in my _vimrc file to that utility:

function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  silent execute '!C:\cygwin\bin\diff ' . opt . arg1 . ' ' . arg2 . ' >
' . arg3
endfunction

Higher up in my _vimrc file I have a line:

set diffexpr=MyDiff()

So I assume that the function diffexpr is then set to use this.

However, if I do what you say:]

   :e file1
   :diffthis
   :vsplit file2
   :diffthis

I seem to be in diff more, but after executing :diffthis on one of the
files it is exactly as before: a fold at the very top that looks like
this:

+    1 +-- 9 lines select distinct etc...

Where "select distinct" etc is the top line in my file.

That top fold is the only thing I get. If I click on the utmost left +
sign I get to see the whole file in the editor, but no highlighting of
lines that are different to the other file in the other split window.

Am I missing something fundamental here?      

Thanks

Hugo  

-----Original Message-----
From: Tony Mechelynck [mailto:[hidden email]]
Sent: Tuesday, 16 August 2005 12:23 PM
To: Bouckaert, Hugo; Vim List
Subject: Re: cannot use diff

----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Vim List"
<[hidden email]>
Sent: Tuesday, August 16, 2005 5:50 AM
Subject: RE: cannot use diff


> Hi Tony
>
> I think I have a windows diff utility, although "man diff" (which
> returns some instructions) does not tell me whether it is the GnuWin32
> diff you are referring to:
>
> C:\>diff
> Usage: diff [-befhHimnNrsw] [-c[n]] [-C n] [-Dname] [-M mark] file1
> file2
>
> Assuming I have a valid Windows diff utility, how would I use it with
> gvim?
>
> Thanks
>
> Hugo

- It must be in the PATH
- gvim invokes it itself
- What you do is:
    = either "gvim -d file1 file2" (without quotes) at the Dos prompt
    = or the following inside Vim:

        :e file1
        :diffsplit file2

or

        :e file1
        :diffthis
        :vsplit file2
        :diffthis

The version I have (which resides in C:\Program Files\GnuWin32\bin) says
the
following as answer to "diff --version" (the first 2 lines are the
prompt,
including the command-line)

mar. 16/08/2005        5:01:10
C:\DOCUME~1\Tony\MIJNDO~1>diff --version
diff (GNU diffutils) 2.8.7
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.



If you have something else, you can always get this (or maybe a later
version of the same).
Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: cannot use diff

Bouckaert, Hugo
In reply to this post by Bouckaert, Hugo

Problem solved!

Not setting diffexpr to any custom function as in

set diffexpr=MyDiff()

Which is the MyDiff () function listed below, solved the problem. That
function must have been pre vim 6.3 and made diff unworkable.

Thanks Tony for your suggestions. Much appreciated.  

Cheers

Hugo  

-----Original Message-----
From: Bouckaert, Hugo
Sent: Tuesday, 16 August 2005 12:47 PM
To: Tony Mechelynck; Vim List
Subject: RE: cannot use diff

Hi Tony

I found a diff utility under my cygwin installation which looks very
similar to the one you mention:

$ diff --version
diff - GNU diffutils version 2.7-cygwin-990830

And so I have set the function MyDiff in my _vimrc file to that utility:

function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  silent execute '!C:\cygwin\bin\diff ' . opt . arg1 . ' ' . arg2 . ' >
' . arg3 endfunction

Higher up in my _vimrc file I have a line:

set diffexpr=MyDiff()

So I assume that the function diffexpr is then set to use this.

However, if I do what you say:]

   :e file1
   :diffthis
   :vsplit file2
   :diffthis

I seem to be in diff more, but after executing :diffthis on one of the
files it is exactly as before: a fold at the very top that looks like
this:

+    1 +-- 9 lines select distinct etc...

Where "select distinct" etc is the top line in my file.

That top fold is the only thing I get. If I click on the utmost left +
sign I get to see the whole file in the editor, but no highlighting of
lines that are different to the other file in the other split window.

Am I missing something fundamental here?      

Thanks

Hugo  

-----Original Message-----
From: Tony Mechelynck [mailto:[hidden email]]
Sent: Tuesday, 16 August 2005 12:23 PM
To: Bouckaert, Hugo; Vim List
Subject: Re: cannot use diff

----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Vim List"
<[hidden email]>
Sent: Tuesday, August 16, 2005 5:50 AM
Subject: RE: cannot use diff


> Hi Tony
>
> I think I have a windows diff utility, although "man diff" (which
> returns some instructions) does not tell me whether it is the GnuWin32

> diff you are referring to:
>
> C:\>diff
> Usage: diff [-befhHimnNrsw] [-c[n]] [-C n] [-Dname] [-M mark] file1
> file2
>
> Assuming I have a valid Windows diff utility, how would I use it with
> gvim?
>
> Thanks
>
> Hugo

- It must be in the PATH
- gvim invokes it itself
- What you do is:
    = either "gvim -d file1 file2" (without quotes) at the Dos prompt
    = or the following inside Vim:

        :e file1
        :diffsplit file2

or

        :e file1
        :diffthis
        :vsplit file2
        :diffthis

The version I have (which resides in C:\Program Files\GnuWin32\bin) says
the following as answer to "diff --version" (the first 2 lines are the
prompt, including the command-line)

mar. 16/08/2005        5:01:10
C:\DOCUME~1\Tony\MIJNDO~1>diff --version diff (GNU diffutils) 2.8.7
Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and
Len Tower.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.



If you have something else, you can always get this (or maybe a later
version of the same).
Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
In reply to this post by Bouckaert, Hugo
----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Vim List"
<[hidden email]>
Sent: Tuesday, August 16, 2005 6:46 AM
Subject: RE: cannot use diff


> Hi Tony
>
> I found a diff utility under my cygwin installation which looks very
> similar to the one you mention:
>
> $ diff --version
> diff - GNU diffutils version 2.7-cygwin-990830
>
> And so I have set the function MyDiff in my _vimrc file to that utility:
>
> function MyDiff()
>  let opt = '-a --binary '
>  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
>  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
>  let arg1 = v:fname_in
>  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
>  let arg2 = v:fname_new
>  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
>  let arg3 = v:fname_out
>  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
>  silent execute '!C:\cygwin\bin\diff ' . opt . arg1 . ' ' . arg2 . ' >
> ' . arg3
> endfunction
>
> Higher up in my _vimrc file I have a line:
>
> set diffexpr=MyDiff()
>
> So I assume that the function diffexpr is then set to use this.
>
> However, if I do what you say:]
>
>   :e file1
>   :diffthis
>   :vsplit file2
>   :diffthis
>
> I seem to be in diff more, but after executing :diffthis on one of the
> files it is exactly as before: a fold at the very top that looks like
> this:
>
> +    1 +-- 9 lines select distinct etc...
>
> Where "select distinct" etc is the top line in my file.
>
> That top fold is the only thing I get. If I click on the utmost left +
> sign I get to see the whole file in the editor, but no highlighting of
> lines that are different to the other file in the other split window.
>
> Am I missing something fundamental here?
>
> Thanks
>
> Hugo

To use any program from the Cygwin distribution you need cygwin1.dll in your
PATH. In addition, most cygwin programs don't understand paths with
backslashes, spaces, or a drive letter and colon in them (what is
"C:\Program Files\vim\vim63\vimrc_example.vim" to Vim is
/cygdrive/c/Program\ Files/vim/vim63/vimrc_example.vim on the command-line
to a cygwin program). The GnuWin32 (and unxutils and...) programs, on the
contrary, are self-contained and understand Dos-like paths. For that reason
it is not always obvious how to "harmoniously" call cygwin and non-cygwin
programs from one another. If you don't have a diff utility other than
Cygwin's, or if the one you have doesn't work with Vim, I suggest that you
browse to http://www.sourceforge.net/ , find the GnuWin32 project, download
the package containing the diff program, install it to "C:\Program
Files\GnuWin32", and add "C:\Program Files\GnuWin32\bin" near the start of
your Windows PATH. Then retry and see if it works.

The PATH is a semicolon-separated list of directories. Where to set it
depends on your Windows version. In 9x it is in C:\AUTOEXEC.BAT; in NT/2K/XP
it is in "Control Panel -> System -> Advanced -> Environment variables" and
there are two sets. Use "System variables" to make the GnuWin32 programs
accessible to every user of the machine.


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
In reply to this post by Bouckaert, Hugo
----- Original Message -----
From: "Bouckaert, Hugo" <[hidden email]>
To: "Bouckaert, Hugo" <[hidden email]>; "Tony Mechelynck"
<[hidden email]>; "Vim List" <[hidden email]>
Sent: Tuesday, August 16, 2005 7:43 AM
Subject: RE: cannot use diff


>
> Problem solved!
>
> Not setting diffexpr to any custom function as in
>
> set diffexpr=MyDiff()
>
> Which is the MyDiff () function listed below, solved the problem. That
> function must have been pre vim 6.3 and made diff unworkable.
>
> Thanks Tony for your suggestions. Much appreciated.
>
> Cheers
>
> Hugo

Well, I'm happy to know you got it working. :-)

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: cannot use diff

Gareth Oakes
In reply to this post by Bouckaert, Hugo
> > Problem solved!
> >
> > Not setting diffexpr to any custom function as in
> >
> > set diffexpr=MyDiff()
> >
> > Which is the MyDiff () function listed below, solved the
> problem. That
> > function must have been pre vim 6.3 and made diff unworkable.
> >
> > Thanks Tony for your suggestions. Much appreciated.
> >
> > Cheers
> >
> > Hugo
>
> Well, I'm happy to know you got it working. :-)

I'm running Vim 6.3 under WinXP and I found the same thing.  Once I
comment out the "set diffexpr=MyDiff()" line, then the diff commands
work as expected.

Being a dumb user I haven't bothered looking in the help system about
why this is the case :)  Perhaps diff not working makes sense as a
default to someone, but my expectation would have been for diff to work
"out the box" with a default install.

Just my 2c.

Cheers,
Gareth
Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
----- Original Message -----
From: "Gareth Oakes" <[hidden email]>
To: "Vim List" <[hidden email]>
Sent: Tuesday, August 16, 2005 10:55 AM
Subject: RE: cannot use diff


>> > Problem solved!
>> >
>> > Not setting diffexpr to any custom function as in
>> >
>> > set diffexpr=MyDiff()
>> >
>> > Which is the MyDiff () function listed below, solved the
>> problem. That
>> > function must have been pre vim 6.3 and made diff unworkable.
>> >
>> > Thanks Tony for your suggestions. Much appreciated.
>> >
>> > Cheers
>> >
>> > Hugo
>>
>> Well, I'm happy to know you got it working. :-)
>
> I'm running Vim 6.3 under WinXP and I found the same thing.  Once I
> comment out the "set diffexpr=MyDiff()" line, then the diff commands
> work as expected.
>
> Being a dumb user I haven't bothered looking in the help system about
> why this is the case :)  Perhaps diff not working makes sense as a
> default to someone, but my expectation would have been for diff to work
> "out the box" with a default install.
>
> Just my 2c.
>
> Cheers,
> Gareth

Well, I don't know where that line comes from. In all my versions of Vim
(6.3.000 for Cygwin, 6.3.086 for Windows [both with 6.3.081 runtime files],
7.00aa.0130 for Windows), ":verbose set diffexpr?" returns a null result
(the option is set to the empty string -- which, according to the help, is
the default -- and no script has changed it). AFAIK, it does work "out of
the box", but if you "take it apart and put it back together the wrong way",
you're on your own.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: cannot use diff

Keith W. Roberts
 

> -----Original Message-----
> From: Tony Mechelynck [mailto:[hidden email]]
> Sent: Tuesday, August 16, 2005 3:59 PM
> To: Gareth Oakes; Vim List
> Subject: Re: cannot use diff
>
> ----- Original Message -----
> From: "Gareth Oakes" <[hidden email]>
> To: "Vim List" <[hidden email]>
> Sent: Tuesday, August 16, 2005 10:55 AM
> Subject: RE: cannot use diff
>
>
> >> > Problem solved!
> >> >
> >> > Not setting diffexpr to any custom function as in
> >> >
> >> > set diffexpr=MyDiff()
> >> >
> >> > Which is the MyDiff () function listed below, solved the
> >> problem. That
> >> > function must have been pre vim 6.3 and made diff unworkable.
> >> >
> >> > Thanks Tony for your suggestions. Much appreciated.
> >> >
> >> > Cheers
> >> >
> >> > Hugo
> >>
> >> Well, I'm happy to know you got it working. :-)
> >
> > I'm running Vim 6.3 under WinXP and I found the same thing.  Once I
> > comment out the "set diffexpr=MyDiff()" line, then the diff commands
> > work as expected.
> >
> > Being a dumb user I haven't bothered looking in the help
> system about
> > why this is the case :)  Perhaps diff not working makes sense as a
> > default to someone, but my expectation would have been for
> diff to work
> > "out the box" with a default install.
> >
> > Just my 2c.
> >
> > Cheers,
> > Gareth
>
> Well, I don't know where that line comes from. In all my
> versions of Vim
> (6.3.000 for Cygwin, 6.3.086 for Windows [both with 6.3.081
> runtime files],
> 7.00aa.0130 for Windows), ":verbose set diffexpr?" returns a
> null result
> (the option is set to the empty string -- which, according to
> the help, is
> the default -- and no script has changed it). AFAIK, it does
> work "out of
> the box", but if you "take it apart and put it back together
> the wrong way",
> you're on your own.
>
> Best regards,
> Tony.
>

According to several prior posts, cygwin does some screwy setup, so that
might be where is comes from.  In a full cygwin environment, that might work
fine.

-Keith


Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

adah
In reply to this post by Bouckaert, Hugo
Tony Mechelynck wrote:

> > I'm running Vim 6.3 under WinXP and I found the same thing.  Once I
> > comment out the "set diffexpr=MyDiff()" line, then the diff commands
> > work as expected.
> >
> > Being a dumb user I haven't bothered looking in the help system
> > about why this is the case :)  Perhaps diff not working makes sense
> > as a default to someone, but my expectation would have been for diff
> > to work "out the box" with a default install.
> >
> > Just my 2c.
> >
> > Cheers, Gareth
>
> Well, I don't know where that line comes from. In all my versions of
> Vim (6.3.000 for Cygwin, 6.3.086 for Windows [both with 6.3.081
> runtime files], 7.00aa.0130 for Windows), ":verbose set diffexpr?"
> returns a null result (the option is set to the empty string -- which,
> according to the help, is the default -- and no script has changed
> it). AFAIK, it does work "out of the box", but if you "take it apart
> and put it back together the wrong way", you're on your own.

If I am not mistaken, gVim for Windows will create a default _vimrc if
it is not already existent, and THAT file contains a function named
MyDiff and the line "set diffexpr=MyDiff()".

Best regards,

Yongwei
Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

A.J.Mechelynck
----- Original Message -----
From: <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, August 17, 2005 4:16 AM
Subject: Re: cannot use diff


> Tony Mechelynck wrote:
>
>> > I'm running Vim 6.3 under WinXP and I found the same thing.  Once I
>> > comment out the "set diffexpr=MyDiff()" line, then the diff commands
>> > work as expected.
>> >
>> > Being a dumb user I haven't bothered looking in the help system
>> > about why this is the case :)  Perhaps diff not working makes sense
>> > as a default to someone, but my expectation would have been for diff
>> > to work "out the box" with a default install.
>> >
>> > Just my 2c.
>> >
>> > Cheers, Gareth
>>
>> Well, I don't know where that line comes from. In all my versions of
>> Vim (6.3.000 for Cygwin, 6.3.086 for Windows [both with 6.3.081
>> runtime files], 7.00aa.0130 for Windows), ":verbose set diffexpr?"
>> returns a null result (the option is set to the empty string -- which,
>> according to the help, is the default -- and no script has changed
>> it). AFAIK, it does work "out of the box", but if you "take it apart
>> and put it back together the wrong way", you're on your own.
>
> If I am not mistaken, gVim for Windows will create a default _vimrc if
> it is not already existent, and THAT file contains a function named
> MyDiff and the line "set diffexpr=MyDiff()".
>
> Best regards,
>
> Yongwei

ah, that could be it. I remember a checkbox in the installer, asking me if I
want a new vimrc to be created. Of course, since I already have one that
suits me, nowadays I always uncheck that kind of option. I remember that
when I first started using Vim, I looked at the vimrc, found it only partly
to my liking, and finally decided to rewrite it from (not totally) scratch.
What I recommend is to _not_ use the default vimrc created by the installer,
but to start with the "stub" that I gave in the abbreviations thread a few
minutes ago and build from there. (I intentionally don't include mswin.vim,
IMHO it creates more problems than it solves.)

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: cannot use diff

Bram Moolenaar

Tony Mechelynck wrote:

[Yongwei]
> > If I am not mistaken, gVim for Windows will create a default _vimrc if
> > it is not already existent, and THAT file contains a function named
> > MyDiff and the line "set diffexpr=MyDiff()".

That's right, the code is in src/dosinst.c.  This assumes you are using
the diff.exe that comes with the installer.  If there is another
diff.exe earlier in the path it might break.  Vim can detect that it
doesn't work, but currently doesn't find an alternate diff.exe for you.

[Tony]
> ah, that could be it. I remember a checkbox in the installer, asking me if I
> want a new vimrc to be created. Of course, since I already have one that
> suits me, nowadays I always uncheck that kind of option. I remember that
> when I first started using Vim, I looked at the vimrc, found it only partly
> to my liking, and finally decided to rewrite it from (not totally) scratch.
> What I recommend is to _not_ use the default vimrc created by the installer,
> but to start with the "stub" that I gave in the abbreviations thread a few
> minutes ago and build from there. (I intentionally don't include mswin.vim,
> IMHO it creates more problems than it solves.)

What the installer creates is something that newbies should be happy
with.  If you know Vim then you better write your own _vimrc.

--
hundred-and-one symptoms of being an internet addict:
72. Somebody at IRC just mentioned a way to obtain full motion video without
    a PC using a wireless protocol called NTSC, you wonder how you never
    heard about it

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///