Vim syntax highlighting for GIT and Cogito

Coloured GVim

If you use GIT or Cogito like I do every day, you might find useful to have the commit messages highlighted inside Vim (of course I assume you use Vim :-)).

First of all, copy these two syntax file into your ~/.vim/syntax/ directory:

Then add these two lines in your ~/.vimrc:
au BufNewFile,BufRead /tmp/gitci* setlocal textwidth=75 fileencoding=utf-8 encoding=utf-8 filetype=cogito
au BufNewFile,BufRead COMMIT_EDITMSG setlocal textwidth=75 fileencoding=utf-8 encoding=utf-8 filetype=gitcommit

This will load the correct syntax file and set the encoding of the message to UTF-8, which is the recommended encoding for GIT commit messages.

That’s all.