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'm running Mercurial from the command line on Windows XP. I've got the extdiff plugin. I wanted

hg vimdiff

to use Vim's DirDiff command. I've tried putting

cmd.vimdiff = gvim
opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'

In my Mercurial.ini. If I do hg vimdiff then gvim opens with a file name '+next'. I think the problem is to do with quoting and pathnames specific to windows. I've tried a number of permutations of backslashes and single and double quotes (not entirely randomly) but with no luck.

I've solved my problem for now by making a separate script to invoke gvim i.e.

cmd.vimdiff = c:\python25\python.exe
opts.vimdiff = c:\test\

and being

import sys
import os

os.system('gvim -c "DirDiff %s %s"' % (sys.argv[1],sys.argv[2]))

But if anyone knows the secret incantation to make it work direct from the command line let me know and I'll maybe try and get the documentation updated.

share|improve this question
The accepted answer links to a blogger account that is private and the answer is no longer visible. Would you mind posting the solution? – Ken Smith Feb 5 '15 at 23:17
up vote 2 down vote accepted

The problem is caused by a sort of bug of vim when calling a function with f-args and the args are strings ending with '\'. The solution is to remove the trailing '\' for each arg.

I have a more compact solution here:

Using vimdiff with mercurial

share|improve this answer

You must log in to answer this question.

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