How do I force vim to highlight the following environment:
\begin{dmath*}
2 + 2
\end{dmath*}
the same way as
\begin{equation*}
2 + 2
\end{equation*}
?
i.e I want the dmath
environments (in its plain and starred versions) to be highlighted the same ways as the equation
(plain and starred) environment.
I pasted your question into Vim, :setf tex
, and then used the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin to find out that the corresponding syntax group name is texMathZoneES
.
Then I opened $VIMRUNTIME/syntax/tex.vim
and searched for it. I didn't find that directly, but something like this:
call TexNewMathZone("E","equation",1)
Then I looked up :help ft-tex-syntax
(completed from the command-line via <C-D>
), and found under :help tex-math
a nice documentation. With that, I created the following solution:
call TexNewMathZone("M","dmath",1)
You can put that into ~/.vim/after/syntax/tex.vim
, as suggested, to make it permanent. Easy, isn't it?!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With