Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vimdiff and MacVim

I'd like to run vimdiff on MacVim. Is there an easy way I'd be able to do it?

like image 967
Antonio Avatar asked Oct 28 '09 02:10

Antonio


People also ask

What is Vimdiff?

Description. Vimdiff starts Vim on two (or three or four) files. Each file gets its own window. The differences between the files are highlighted. This is a nice way to inspect changes and to move changes from one version to another version of the same file.

What is Vimdiff in Linux?

Vimdiff is a Linux command that can edit two, three, or four versions of a file with Vim and show their differences.


2 Answers

  • From the terminal

If you have the mvim script installed (it is in the dmg, just put it somewhere in your PATH), you can just type in a shell:

 mvim -d file1 file2 

You can alias this to mvimdiff if you like.

  • From within macvim

In macvim, like in vim , you can also use:

 :e file1 :diffsplit file2 or :vert diffsplit file2 

The second option gives you a vertical diff, which is usually more readable

like image 144
LeMiz Avatar answered Sep 17 '22 21:09

LeMiz


If you symlink gvimdiff to mvim then mvim will start with -d etc. Vim and Mvim both look at what executable name they've been started with to determine how they behave. That how gvim and vim can be both the same executable on linux and it's the same on OSX.

like image 25
Benj Avatar answered Sep 19 '22 21:09

Benj