Vim syntax highlighting for commit messages
Parking this info here for my future-self to reference.
Create a vim file, mine is at ~/gitcommithighlight.vim
:highlight OverLength ctermbg=red ctermfg=white guibg=red " First line must be 50 characters or less :let w:m1=matchadd('OverLength', '\%1l\%>50v.\+', -1) " Second line must be blank :let w:m1=matchadd('OverLength', '\%2l\%>0v.\+', -1) " All other lines must be be 72 characters or less :let w:m2=matchadd('OverLength', '\%>2l\%>72v.\+', -1)
Set git’s editor to vim and make it source the above file:git config --global core.editor "$(which vim) -S ~/gitcommithighlight.vim"