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?
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?
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.