Install vim-git plugin (dopuskh3/vim-git add fancy color for commit message title) but the official plugin is fine too.
If you use Vundle:
Bundle "dopuskh3/vim-git"
From here:
https://gist.github.com/dopuskh3/bcf437f0f0c1293c9b2d
Use the following setup to validate commit message with the following constraints:
- Title must starts with an infinitive word
- No empty description
- Line length to 50 for commit title
- Line length to 72 for commit description
- No more than one empty line between commit title and description
- ~ other rules may come ~
autocmd Filetype gitcommit set makeprg=python\ /path/to/git-validate-commit.py\ %
autocmd Filetype gitcommit set efm=%l:%c:%m
autocmd BufWritePost COMMIT_EDITMSG make
An example of the perfect commit message will be great !