Last Updated: February 25, 2016
·
974
· oz123

Never get caught with badly spelled git commit message

If you use VIM, and you are not a native English speaker - or worse: you are an English speaker - having commit messages with badly spelled words, is just embaressing.
Ofcourse you can use spell mode always, but sometimes having all those highlighted words when reading your own code is distracting. Hence, you end up, coding with spell mode shutdown.
But do you really want to turn spell manually every time you write a commit message? You like sparing your time right? So, here is a small addition to your vimrc:

" force spell when doing a git commit 
if  bufname("%")=="COMMIT_EDITMSG"
    set spell 
    set spelllang=en 
endif

That's it, you will never commit a message again with badly spelled words!

2 Responses
Add your response

i'd rather go with autocmd :

autocmd FileType gitcommit setlocal spell
autocmd FileType gitcommit setlocal spelllang=en
over 1 year ago ·

SWEET!

over 1 year ago ·