What is the best way to spellcheck in gVim? Is there an add-on or something? I would like it to offer corrections as well.
-
299% of the time, Vim has the feature you want built in. Add-ons are rarely necessary :) – rmeador Mar 12 '09 at 20:38
4 Answers
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|.
I don't put :set spell
in my .vimrc because when I'm coding there are just too many variable names in my comments that get flagged. If there is a certain file type you want checked use an autocommand in your .vimrc. Or just turn it on manually when you need it.

- 17,502
- 10
- 52
- 59
-
2You 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 Mar 12 '09 at 20:38
-
4On gvim, put the cursor on a misspelled word and right-click. A list of suggestions will be shown at the context menu. – Denilson Sá Maia Sep 13 '09 at 01:25
-
1Great, I'm amazed that when I set :set spelllang=ru, it offered to download missing spell files and after it worked! I love Vim – Kee Aug 23 '11 at 03:04
-
1I put the following in my `.vimrc` to be able to toggle spell checking; `nnoremap
s :set spell! `. (the ` ` key defaults to `\`) -
"smart enough to only spellcheck comments and string literals". What about the cases when you use English in a variable name, and you want to make sure you've spelled it right... – Isaac Kleinman Aug 21 '13 at 22:11
-
Is it not possible to automatically move through all errors correcting them like `aspell -c`? – Ciro Santilli OurBigBook.com Jan 18 '14 at 09:16
-
`:set spelloptions=camel` is also useful for spellchecking camelCase and PascalCase words – Micah Lindstrom Jul 06 '23 at 22:50
-
"If it's source code, gvim is smart enough to only spellcheck comments and string literals. ... I don't put `:set spell` in my .vimrc because when I'm coding there are just too many variable names in my comments that get flagged." Isn't that a contradiction? If it's flagging variable names, then it's not checking only comments and string literals. – pyansharp Jul 24 '23 at 20:20
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.

- 71,150
- 28
- 166
- 168
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.
-
2Clever, but Vim beat you to the punch. Then again, who's surprised? – Keith Pinson Nov 14 '12 at 03:28
-
@Kazark in Vim is not possible to automatically move through all errors correcting them like `aspell -c` does? – Ciro Santilli OurBigBook.com Jan 18 '14 at 09:17
-
2@cirosantilli `]s` jumps to the next error and `[s` jumps to the previous error. – Keith Pinson Jan 18 '14 at 16:35
-
@Kazark I knew about those commands, but then if you have a large file with many errors to correct you have to `]sz=` for each word which is a bit inconvenient. – Ciro Santilli OurBigBook.com Jan 18 '14 at 18:18