TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the Vim-Latex environment for writing french documents. The problem is that when I comment a line containing a command, the spell checking tool highlights the command as a spelling mistake.

Is it possible to set the spell check tool in a way that it ignore commented lines?

share|improve this question
Welcome to TeX.sx! – Peter Jansson Apr 4 '13 at 15:22
up vote 6 down vote accepted

there is an option for that, you just have to add

let g:tex_comment_nospell=1

in your .vimrc.

About the internals, this variable is used in the file /usr/share/vim/vim73/syntax/tex.vim in my installation.

[Edit for older versions]

Checking vim source tree in older versions, this variable appears from revision 1073, which is after vim 7.0 and 7.1. As stated by the diff, this modification introduces the lines

if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
    syn cluster texCommentGroup contains=texTodo,@Spell
    syn cluster texCommentGroup contains=texTodo,@NoSpell

so maybe adding

:autocmd BufEnter *.tex syntax cluster texCommentGroup contains=texTodo,@NoSpell

in your .vimrc would do the trick, at least it works on vim 7.3. If this does not work, you could try to get a more recent syntax file and put it into .vim/syntax/tex.vim

share|improve this answer
It doesn't work on my computer. May it be related to the fact that i'm using Vim 7.0? I hope it's not because I can't upgrade to 7.3 (professional computer without root access...) – GuillaumeM Apr 8 '13 at 13:24
I checked the source tree, and indeed, the variable only appears in tex.vim from vim 7.2. – Vincent Nivoliers Apr 8 '13 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.