Vim spell checking latex's newcommand definition

五迷三道 提交于 2019-12-11 04:34:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!