Translate

Tuesday, November 12, 2013

Spell checking on your Git commits with VIM!


Hey all!  This is a quick tip for all you guys using git version control, and the command line.  Have you wanted to get spell checking into a basic editor but wasn't sure how to get it in vim automatically (but maybe you don't want to enable it in your ~/.vimrc for everything)?

Lucky you, I have an easy solution.  To enable spell checking in vim for all your git commits, it's as easy as one command.  In bash type (or copy paste, I won't tell anyone you dirty cheater):


git config --global core.editor "vim -c \"setlocal spell spelllang=en_us\""




That's all there is to it.  All your commits on all your projects will now use vim with spell check on by default.  That's US English of course, for other languages please substitute your language type.

To get help on spell just type in vim:

:h spell

Here's some basic commands to get you started :

  • ]s next spell error
  • [s previous spell error
  • zg add word to spellfile (correct words list)
  • z= spell suggestions
  • :help spell for more details
So now at least you can look like you care about your commit comments.

Have fun and happy viming and git'ing. :)