{"id":2072,"date":"2014-04-10T19:28:10","date_gmt":"2014-04-11T02:28:10","guid":{"rendered":"http:\/\/arcanius.silverfir.net\/blog\/?p=2072"},"modified":"2014-04-11T00:18:50","modified_gmt":"2014-04-11T07:18:50","slug":"make-mercurial-use-vimdiff-the-same-way-git-does","status":"publish","type":"post","link":"https:\/\/arcanius.silverfir.net\/blog\/make-mercurial-use-vimdiff-the-same-way-git-does\/","title":{"rendered":"Make mercurial use vimdiff the same way git does"},"content":{"rendered":"<p>At work, one of my favorite pastimes is getting mercurial to behave more like git.<\/p>\n<p>Today, I decided to tackle merge conflict resolution using vimdiff.<\/p>\n<p>Git has great support for this. In my <tt>.gitconfig,<\/tt> I have the following lines:<\/p>\n<p><code>[diff]<br \/>\n  tool = vimdiff<\/code><\/p>\n<p>Git is smart enough to run vimdiff with four panes &#8212; base, local, remote, and output. The first three windows are at the top, and the output window is at the bottom. Since it&#8217;s vimdiff, everything is colorized so you know what is happening, and the output has all the merge markers so you know what you need to fix.<\/p>\n<p>Mercurial&#8217;s default seems to be a three-pane vimdiff view that has local, other, and base with no fourth pane to do the editing. This is, in my opinion, strictly worse.<\/p>\n<p>I thought it would be straightforward, but I was wrong since the <a href=\"http:\/\/mercurial.selenic.com\/wiki\/MergingWithVim\" title=\"Mercurial: Merging With Vim\">official documentation<\/a> is wrong in a few ways (I may edit it, since it&#8217;s a wiki, if it&#8217;s easy, after I finish this post).<\/p>\n<p>What I ended up with that actually works (using hg version 2.9.1 and vim 7.4) is adding the following to my .hgrc:<\/p>\n<p><code>[ui]<br \/>\nmerge=vimdiff<br \/>\n&nbsp;<br \/>\n[merge-tools]<br \/>\nvimdiff.executable = vim<br \/>\nvimdiff.args = -d -c \"wincmd J\" $output $local $other $base<br \/>\nvimdiff.premerge = keep<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>At work, one of my favorite pastimes is getting mercurial to behave more like git. Today, I decided to tackle merge conflict resolution using vimdiff. Git has great support for this. In my .gitconfig, I have the following lines: [diff] tool = vimdiff Git is smart enough to run vimdiff with four panes &#8212; base, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8],"class_list":["post-2072","post","type-post","status-publish","format-standard","hentry","category-everything","tag-technology"],"_links":{"self":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/2072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/comments?post=2072"}],"version-history":[{"count":8,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/2072\/revisions"}],"predecessor-version":[{"id":2080,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/2072\/revisions\/2080"}],"wp:attachment":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/media?parent=2072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/categories?post=2072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/tags?post=2072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}