问题
My problem is simple and I hope the solution too: vim-spell plugin doesn't colorize the incorrect words in \newcommand
's definition in LaTeX files:
\newcommand{\mycommand}{Helllo World}
The Helllo
will not be red. When I delete the parentheses around Helllo world
it's marked as a bad word.
回答1:
I was trying to solve a problem related with spelling in latex files and I got help in the vim_use group. Please read the messages in google groups interface to get the full details.
Try adding the following to your ~/.vim/after/ftplugin/tex.vim file:
syn region texMyCmdSpell matchgroup=texStatement
\ start='\\newcommand{.*{' end='}$'
\ contains=@Spell
\ containedin=texCmdBody
This seems to work for me. The start pattern is just defined by a new command, the end pattern by }
followed a a newline.
来源:https://stackoverflow.com/questions/13553342/vim-spell-checking-latexs-newcommand-definition