I would like to use Macvim's diff mode for file comparison in the SVN application called "Versions" for OS X. How would I write a script that launches Macvim in diff mode for such file comparisons?

I currently use the following to do SVN diffs from Command line, but nothing I try seems to work for creating a script for use with Versions:

In my ~/.bash_profile:

alias svn_diff='svn diff --diff-cmd ~/bin/svndiff'

A script I have in my ~/bin directory:

 cat ~/bin/svndiff 
\#!/bin/bash
shift 5
mvim -d "$@"
link|improve this question

50% accept rate
The backslash in \#!/bin/bash doesn't seem right :) – slhck Jan 27 at 12:10
feedback

1 Answer

Did you see the following page?

http://versionsapp.com/documentation/versions_wf_comp_customscripts.html

This should give you some hints. If not, I'll look into it later, and edit my answer.

Edit: Here are detailed instructions.

  1. Copy the following script to "~/Library/Application Support/Versions/Compare Scripts" after naming it, e.g. MacVim.sh (beware that you need the extension for the script to be recognized) . I assume that mvimdiff is an alias to the mvim script provided with MacVim and that it's in your PATH. If not, adjust accordingly.
    #!/bin/bash
    mvimdiff "$@"

The quotes around $@ are to address files with spaces in them (very common on a Mac).

  1. You should then be able to see, after restarting versions, the "MacVim" item in the "File Comparison:" dropdown, right at the bottom, above "More Comparison Scripts Online...".

That's it. I've tested it and it works.

link|improve this answer
Yes, I've looked at it. The link to example files doesn't work, there's no explanation of which shell language I can use (any of them ? what are the path restrictions?). I've tried hacking my example (above) into something that would work here, but it doesn't show up. I could really just use a simple example that works instead of a bunch of prose explaining how it theoretically works. – noneme Jan 28 at 0:27
@noneme: I've edited my post with a working example. – Karolos Jan 28 at 13:05
@noneme: Did you get it working? – Karolos Feb 11 at 23:04
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.