Curtis Free's Blog

About Blog Config DB Projects Scripts Wishlist A geek with .

How to (help) prevent commit message misspellings in Vim

Some time ago, I was responsible for this:

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.