I use Vim as my core editor for Git.
I've noticed that, whenever Git fires up Vim following a git commit (and assuming Vim's syntax option is enabled), some Vim settings other than my own are applied. In particular, my commit messages get highlighted in a way that I haven't defined anywhere (see below); I use the zenburn color scheme, but that's irrelevant to my question.

Note, for instance, how the branch name on line 5 is highlighted in a color that is different from that of the rest of the comments.
Additionally, settings that promote the official Git formatting guidelines (see this) are also applied:
textwidth is set to 72.
Don't get me wrong; I find those Vim settings very useful for writing commit messages. My questions are simply:
Here is a shell script that reproduces the situation:
#!/bin/bash
cd ~/Desktop
mkdir test_cmtmsg
cd test_cmtmsg
git init
touch test.txt
git add test.txt
git commit -m "inital commit"
# oops, made a mistake there
git commit --amend
Vim ships with a number of syntax definitions, including ones for use with Git. These are found at $VIMRUNTIME/syntax; specifically, the one for Git commit messages is $VIMRUNTIME/syntax/gitcommit.vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With