Composing Mercurial commit messages in TextMate
![]()
Using the -m flag can be a timesaver, but for several reasons I prefer to
write my commit messages in a text editor:
- Spell-checking
- Familiar keyboard navigation
- No need to escape quotation marks
TextMate is particularly well suited to my needs due to its built-in Markdown highlighting and previewing – yes, I write commit messages in Markdown!
To set TextMate as Mercurial's editor, add editor = mate -w to the [ui]
section of your ~/.hgrc file.
Next time you do
hg commitTextMate will open a temporary file you write your commit message into. Type your message, save the file and then close the window to finish the commit. The-wflag on thematecommand tells TextMate not to return control to the command line until the editor window has been closed.
Update —
To use TextMate as your git editor, run the following command:
git config --global core.editor "mate -w"
This adds editor = mate -w to the [core] section of your ~/.gitconfig
file.