VIM set spell in file .git/COMMIT_EDITMSG

Viewed 5222

I want to "set spell" automatically when i am editing the commit text in git. From the % I see that it is writing to a filename called .git/COMMIT_EDITMSG. How do I update my .vimrc to automatically set spell on when editing that file. something on the lines

if ( filename has a word COMMIT)

set spell

fi

6 Answers

You can add 'set spell' to your .vimrc file to make Vim automatically spell check all documents including your git commit messages. Vim is smart enough to spell check comments and strings while ignoring your source code.

Depending on your colorscheme, this can be annoying though to see variable names in your comments and strings highlighted as misspelled words.

See this stackoverflow question for more details on spell checking.

Related