Enable Spell Check in Vim text editor

I use Vim for all system file editing,and also for writing scripts. Sometimes i’m logged into my server and as there is no desktop there are no gui apps, I use Vim to send out a quick tweet to twitter via Twitvim. I also compose Mutt emails with Vim, so therefore having a spell check is pretty handy.

To enable Spellcheck in Vim, you need to edit your Vim config file:
vim .vimrc

And add these lines with your language to it:

syn spell toplevel
set spell spelllang=en_us

Using multiple Languages:
As I use both English and Spanish, I created two copies of my .vimrc file and called them vispellen and vispelles (ENglish and ESpanish) and then wrote two little Bash script so I can type “ven” or “ves” in the Terminal to interchange the different config files.
ven script:

# This copies vispellen with English spell check to .vimrc
cp vispellen .vimrc

ves script:

# This copies vispelles with Spanish spell check to .vimrc
cp vispelles .vimrc

Very basic I know, but it works.

Vim Spellcheck command basics:

]s  move to the next mispelled word
[s   move to the previous mispelled word
zg   add a word to the dictionary
zug   undo the addition of a word to the dictionary
z=   view spelling suggestions for a mispelled word

More information:
Just type :help spell in Vim.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s