Reputation: 311
Spell check in vim is nice enough to not highlight things inside of a math environment when writing LaTeX. This is convenient, but I make some very common typos like "theat" instead of "theta" that would be nice to catch automatically. Is there a way to get the words in the explicit list of 'bad words' to be highlighted regardless of their context?
Note that I still don't want to check whether everything is good within a math environment, just that it is not explicitly bad.
Upvotes: 1
Views: 629
Reputation: 172550
To enable spell checking for a syntax group, you'd have to add contains=@Spell
, e.g. for the texStatement
group, that would be:
:syn match texStatement "\\\a\+" contains=@Spell
But with that, you'd still have to add all "good" statements to your spell file. If you just want to highlight certain "bad" words, you can define a contained match:
:syn match texBadStatement "theat" containedin=texStatement
And then link to the error or bad spell highlighting:
:hi link texBadStatement SpellBad
Put those commands into ~/.vim/after/syntax/tex.vim
to make them persistent.
I'm not a Latex specialist. If the texStatement
group is wrong, you need to find out which syntax group causes the highlighting. :syn list
shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin.
Upvotes: 1