Navigation

SubEthaEdit and Mercurial diffs

Wednesday, November 19th, 2008

I’m a big fan of both SubEthaEdit, a text editor for Mac OS X, and Mercurial, a distributed version control system written in Python.

One of the best parts about SubEthaEdit is the command-line utility it comes with, see. At least 20 times a day I type

hg diff | see

to diff all of the files in the current Mercurial repository and show the output in a SubEthaEdit window.

Unfortunately, SubEthaEdit doesn’t by default apply any syntax highlighting to these documents. Fortunately, it’s a pretty simple fix.

Go to the “Modes” pane in the SubEthaEdit preferences and “Content matches” trigger with the value ^diff --git a/. Here’s a screenshot:

That’s all there is to it! Now you can have beautiful Mercurial diffs.

Comments

  1. Peter Hosey replied on November 19th, 2008:

    This is only if you have Git-style diffs turned on in your hgrc settings (which you should). It’s off by default.

    And, of course, the same solution applies to diffs from Git.