Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "$@"
share|improve this question
    
The backslash in \#!/bin/bash doesn't seem right :) – slhck Jan 27 '12 at 12:10

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.

share|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. – aoeu Jan 28 '12 at 0:27
    
@noneme: I've edited my post with a working example. – Karolos Jan 28 '12 at 13:05
    
@noneme: Did you get it working? – Karolos Feb 11 '12 at 23:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .