Reputation: 11113
I've recently picked up emacs as a general editor to replace gedit and vim. The one thing I miss terribly about vim is the git syntax highlighting. I have tried git-el, apparently with no luck.
The vim git-commit highlighting features a "subject line" highlight for the first fifty characters of the first line of the commit message, "error" highlights for the second line, comments, and red and green highlighting for added or removed files (which are themselves written in the precomposed comments.)
Is there a similarly functional syntax highlighting for emacs, and if so, how would I install it?
Upvotes: 5
Views: 1821
Reputation: 7447
2019 update:
The answers presented here are 5 and 7 year old and it took me some time to figure out how to get various git highlightings without magit
. Most links now lead to the magit repo and it is not particularly clear from there what the list of git-related packages currently is, nor whether they are on Melpa.
The EmacsWiki page does give the information, but with all the history of the movements of those various packages and their minor change of names, it is not totally easy to follow and see where things are now and what they are called.
So I thought that I would post a summary of these packages.
They are all on Melpa and any of these packages can be installed independently of the others, so you can pick and choose what you need.
git-commit
gitignore-mode
gitattributes-mode
gitconfig-mode
The package which answers the question is thus currently called git-commit
and it is on Melpa.
Upvotes: 3
Reputation: 189908
"Git Commit Mode" on EmacsWiki has an overview of mainly historical interest. The (presently somewhat argumentative) page seems to argue that you should use Magit. All roads ultimately lead to git-modes which is allegedly now the default for Magit, too.
(My Ubuntu 14.04 magit
does not seem to include it, still. Installing git-commit-mode
from Marmalade quickly fixed that.)
A lot of random dot.emacs files in Google seem to include a diff-mode
specification for COMMIT_EDITMSG
. I don't really see why -- the buffer does not contain a diff, and diff mode disables some useful text editing functions. If you have nothing else out of the box, specifying log-edit-mode
would make more sense.
Upvotes: 0
Reputation: 45177
I don't really do emacs but I did some quick searching and found git-modes and magit. I imagine that would get you started down the right road.
Upvotes: 4