When I run hg commit, Mercurial generates a file for my commit message that looks like this :
hg commit
HG: Enter commit message. Lines beginning with \'
There are many ways to do this. Some are even listed on the official wiki. This expands on @Ry4an answer. You can add this to your ~/.hgrc
~/.hgrc
[ui] editor = function hgvi { hg status --unknown | sed 's/^/HG: /g' >> "$1"; vi "$1"; }; hgvi