up vote 0 down vote favorite
1
share [g+] share [fb]

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.

link|improve this question
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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