tags:

views:

995

answers:

4

What is the best way to spellcheck in gvim? Is there an add-on or something?

Update:

I would like it to offer corrections as well.

+17  A: 

Use :set spell to turn on spell-checking. If it's source code, gvim is smart enough to only spellcheck comments and string literals.

:help spell will give you all the details. Here are some excerpts:

To search for the next misspelled word:

]s           Move to next misspelled word after the cursor.
             A count before the command can be used to repeat.
             'wrapscan' applies.

[s           Like "]s" but search backwards, find the misspelled
             word before the cursor.  
Finding suggestions for bad words:

z=           For the word under/after the cursor, suggest correctly
             spelled words.
To add words to your own word list:

zg           Add word under the cursor as a good word

Also see :help set spelllang for information on changing your dictionary to include other regions, languages, or word sets (for example, medical jargon).

gvim must be compiled with |+syntax|.

Thanks to rmeador's comments for much of the above goodness.

Eric Johnson
You forgot to mention how to turn on spellcheck, but those commands will be useful once it's on. Use ":set spell" to turn it on. note that if it's source code, it's smart enough to only spellcheck comments and string literals :)
rmeador
On gvim, put the cursor on a misspelled word and right-click. A list of suggestions will be shown at the context menu.
Denilson Sá
+3  A: 

Do :set spell to turn on spell-checking. See :h spell for help and info about how spell-checking works and how to use different languages and dictionaries and such.

Brian Carper
+2  A: 

Just a note: you need vim 7 to get spell checking... That shouldn't be a problem, though, because it's been around long enough that even Debian stable uses it.

David Wolever
A: 

I started using

aspell

which comes with Cygwin (http://www.cygwin.com/). (It's a package, but the default install plus manually-added aspell is pretty tiny and quick to download.)

When I want to spell check the current file, I use a function defined in my .vimrc (or _vimrc) that saves the file, runs aspell on it, then reloads the file:

:function! SpellCheck()
:   w!
:   !c:\prog\cygwin\bin\aspell.exe --dont-backup check "%"
:   e! %
:endfunction

to use this function I just do:

:call SpellCheck()

It goes through the file just like Microsoft Word would, I exit, and then the file is reloaded with corrections.

Running aspell externally without having to move my mouse is integrated enough for me. I've never liked on-the-fly spell checking. I find it and things like IntelliSense distracting.