teerapap
teerapap

Reputation: 5423

How to set "hg diff" output shows in gvim?

I use mercurial and I want to see modified change in Vim or GVim. Normally there is hg diff which show the modified changes in diff format. but I want to see it in Vim as the original version and modified version side-by-side.

I try extdiff in ExtdiffExtension but it doesn't work and gvim open some blank file.

I know there is gvim -d localfile otherfile but I don't know how to config mercurial.

Upvotes: 18

Views: 9334

Answers (4)

rcs
rcs

Reputation: 68849

Check this: Using vimdiff to view single diffs

hg cat <filename> | vim - -c  ":vert diffsplit <filename>" -c "map q :qa!<CR>";

Upvotes: 4

Kurt
Kurt

Reputation: 2403

On OSX when using MacVim (and homebrew):

cd /usr/local/bin
ln -s mvim gvimdiff

edit~/.hgrc

[extdiff]
cmd.gdiff = gvimdiff
opts.gdiff = -f

then to use:

hg gdiff somefile.cpp

Upvotes: 0

permanuno
permanuno

Reputation: 429

If you're fine with vim, I'm been using this in my ~/.hgrc for months without problems

[extensions]
hgext.extdiff =

[extdiff]
cmd.vimdiff =

[alias]
vi  = vimdiff
vim = vimdiff

Then you just use

hg vimdiff somefile

The [alias] section is optional, but it's nice to have.

I'm using v1.4.2, FWIW.

Upvotes: 31

Jerome
Jerome

Reputation: 8447

I can't help you for the vim part, but in mercurial, to get the content of a file in the parent changest, you'll do hg cat path/to/my/file.ext

Upvotes: 1

Related Questions