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. :)

Comments

  1. you can put it in the .vimrc to make it available everywhere

    nika@localhost /tmp/1 $ grep spell ~/.vimrc
    setlocal spell spelllang=ru_ru

    ReplyDelete
    Replies
    1. 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.

      Thanks for checking reading my post!

      Delete

Post a Comment

Popular posts from this blog

Development on Android NDK Tutorial - Gluing C++ Native Code to Java

Creating a Fake Refraction, Bubble Shader for your 2D Godot Game!

Godot Tutorial: How to read all files in EVERY sub directory (Breadth/Depth first Search)