Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

[extdiff]
cmd.vimdiff = c:\python25\python.exe
opts.vimdiff = c:\test\gvimdiff.py

and gvimdiff.py 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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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