2

I want to stop Vim from spell checking inside LaTeX comments. In my .vimrc I have the line:

syntax match Comment /%/ contains=@NoSpell

It does not work, but if I reload .vimrc with :so ~/.vimrc it works. What the heck?

3
  • Do you still have something open in your question? How can we help you further? Otherwise maybe could you accept one of the answers using the v button next to the arrow voting buttons. It allow the question to rest :-) Commented Mar 9 at 20:30
  • I just recently learned that I need to accept answers. :) It's done. Commented Mar 13 at 4:34
  • Thanks Daniel! It helps others knowing that the answer solve the original problem indeed :-) Commented Mar 13 at 5:13

1 Answer 1

3

When you load your LaTeX file the $VIMRUNTIME/syntax/tex.vim is executed and it overrides your syntax statement.

I would add a ~/.vim/after/syntax/tex.vim with the following content:

syn match Comment /%.*$/ contains=@NoSpell containedin=texComment

Maybe could you be interested by this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.