vim spell checking - comments only in LaTeX files

Jakub M. picture Jakub M. · May 2, 2011 · Viewed 9.8k times · Source

I use gvim to edit LaTex .tex file. I noticed that it checks spelling on the fly only for the commented text. If I have a mistake in a regular text - no underline. If I comment this text with % , the misspell is underlined immediately. What is wrong? Is there any strange option turned on?

Answer

sehe picture sehe · May 2, 2011

The latex ft plugin conveniently defines this behaviour.

SpellChecker : Spell check text including LaTeX documents

Using latexmk, vim spell checking and vim latex-suite

There is an option that appears to come close:

:syntax spell [toplevel | notoplevel | default]

Update

Also

:he ft-tex-syntax

has very useful tidbits, like

Don't Want Spell Checking In Comments? ~

Some folks like to include things like source code in comments and so would
prefer that spell checking be disabled in comments in LaTeX files.  To do
this, put the following in your <.vimrc>: >
      let g:tex_comment_nospell= 1

You'll have to figure out whether you can use that/extrapolate from there