The first line of a Git commit message is expected to be a concise summary. Git convention recommends limiting this line to 50 characters. In Vim, text after the 50th character often changes color (e.g., from red to black), visually signaling that you're exceeding the recommended length. This is just a helpful cue and not enforced by Git.
The second line is expected to be completely blank. This separates the summary from the detailed description. If you add text to this line, Vim highlights it with a red background and white text to catch your attention — a visual warning that the line should be empty.
From the third line onward, you can write a more detailed description of your commit. Vim typically shows this text in default colors unless certain keywords or formatting rules are used.
These colors come from Vim's syntax highlighting for gitcommit
filetype. You can check or customize this behavior:
:set filetype? " Check that it's set to gitcommit
:verbose set syntax? " See the syntax file used
To visually mark the 50-character limit, add this to your .vimrc
:
autocmd FileType gitcommit setlocal colorcolumn=50
Or, to disable syntax highlighting in Git commit messages:
git config --global core.editor "vim -c 'syntax off'"