I want to use vim conceal feature with the highlighting of matching begin/end latex environment (vimtex plugin). When I use the following code
syn match texStatement '\\begin{itemize}' contained conceal cchar=-
syn match texStatement '\\end{itemize}' contained conceal cchar=-
with set conceallevel=2
, I get the \begin{itemize}
and \end{itemize}
concealed into -
. But when I hover on \begin{itemize}
the matching \end{itemize}
(concealed in -
) does not get highlighted.
So I added the transparent argument
syn match texStatement `\\begin{itemize}` transparent contained conceal cchar=-
syn match texStatement `\\end{itemize}` transparent contained conceal cchar=-
Now I get the highlighting of matching parentheses but the \\begin{itemize}
and \\end{itemize}
are not completely concealed, instead they get concealed into {itemize}
.
I don't know how to use the contained and contains arguments to get around this.