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
Have fun and happy viming and git'ing. :)
you can put it in the .vimrc to make it available everywhere
ReplyDeletenika@localhost /tmp/1 $ grep spell ~/.vimrc
setlocal spell spelllang=ru_ru
Yes, very true. However, I didn't want spell checking on by default on all documents/code, but I knew I ALWAYS wanted it for git commits. Definitely, if you want it always on, for all things, put it in your ~/.vimrc.
DeleteThanks for checking reading my post!