How about replacing
if exists("loaded_matchit") let b:match_words .= ',\\begin\s*\({\a\+\*\=}\):\\end\s*\1' endif " exists("loaded_matchit")
by
if exists("loaded_matchit") setlocal matchpairs-=<:> let b:match_words = &l:matchpairs . \ ',' . '\%(^\|[ (]\)\@<=\$\$\?' . ':' . '\$\?\$\%($\|[ ).\,;\:?!\-]\)' . \ ',' . '\%(^\s*\)\@<=\\begin{\w\+\*\?}' . ':' . '\%(^\s*\)\@<=\\end{\w\+\*\?}'
For example, the regex
\\begin\s*\({\a\+\*\=}\):\\end\s*\1
does not allow for indented environments such as
\begin{itemize} ... \end{itemize}
Regarding the matching of opening and closing $ ... $, this will never
be possible by a mere regex, but the above regex is a pragmatic
work-around that works if certain natural conventions are followed.
This mail was sent to Benji Fisher, the maintainer of the $VIMRUNTIME/ftplugin/tex.vim file the March 2, but yet no response.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
@Konfekt, are you willing to vouch for your younger self?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I've relatively recently updated this on Stack Exchange to read
let b:match_words = get(b:, 'match_words', &l:matchpairs) . \ ',' . '\%(^\|[ (/]\)\zs\\(' . ':' . '\\)\ze\%($\|[ )/.\,;\:?!\-]\)' . \ ',' . '\%(^\|[ (/]\)\zs\\\[' . ':' . '\\\]\ze\%($\|[ )/.\,;\:?!\-]\)' . \ ',' . '\%(^\|[ (/]\)\zs\$[^$ ]' . ':' . '[^$ ]\zs\$\ze\%($\|[ )/.\,;\:?!\-]\)' . \ ',' . '\%(^\|[ (/]\)\zs\$\$' . ':' . '\$\$\ze\%($\|[ )/.\,;\:?!\-]\)' . \ ',' . '^\s*\zs\\begin{\([^} \t]\+\)}' . ':' . '\%(^\s*\)\zs\\end{\1}'
and it has been working well for all my purposes. Here's a supposedly more reliable full-fledged plugin even older than this thread. I didn't yet receive a reply by @benjifisher though. I vouch for its inclusion into ftplugin/tex.vim. Thank you for reviving this @dkearns
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()