Curtis Free

Husband · Dad · Geek

About | Blog | Code

Blog

How to (help) prevent commit message misspellings in Vim @ 14 Mar 2015

Some time ago, I was responsible for this:

Best commit message ever: "Remove paccidental character" - @curtisafree

Kelsey Francis

But it's actually not difficult to avoid simple misspellings and typos in Git commit messages thanks to Vim's built-in spellchecker.

Add the following to your Vim config (~/.vimrc) to enable this feature specifically for Git commits:

" ensure Vim can work with filetypes
filetype plugin on

" assuming this is correct for you, of course
set spelllang=en_us

" enable spellcheck for Git commits
autocmd FileType gitcommit setlocal spell

There's a lot more you can do with Vim's spellchecker; see :help spell for more information.