Taking inspiration from @husB's comment, I copied the matchit.vim file from another computer I have access to with vim 81 installed and copied on this present computer with vim 82. Now, everything seems to work.
In case anyone is interested or hoping it can be useful to someone, I post here the differences between the matchit.vim files in the two versions (notice the date of last change)
" Last Change: Jun 10, 2021 | " Last Change: 2019 Oct 24
" Neovim does not support scriptversion | le s:last_mps = ""
if has("vimscript-4") <
scriptversion 4 <
endif <
<
let s:last_mps = "" <
let restore_options ..= (&ic ? " " : " no") .. "ignorecase" | let restore_options .= (&ic ? " " : " no") . "ignorecase"
let restore_options = " ve=" .. &ve .. restore_options | let restore_options = " ve=" . &ve . restore_options
> " If this function was called from Visual mode, make sure that the cursor
> " is at the correct end of the Visual range:
> if a:mode == "v"
> execute "normal! gv\<Esc>"
> elseif a:mode == "o" && mode(1) !~# '[vV]'
> exe "norm! v"
> endif
" if a count has been applied, use the default [count]% mode (see :h N%) | " Use default behavior if called with a count.
exe "normal! " .. v:count .. "%" | exe "normal! " . v:count . "%"
if a:mode =~# "v" && mode(1) =~# 'ni' <
exe "norm! gv" <
elseif a:mode == "o" && mode(1) !~# '[vV]' <
exe "norm! v" <
" If this function was called from Visual mode, make sure that the cursor <
" is at the correct end of the Visual range: <
elseif a:mode == "v" <
execute "normal! gv\<Esc>" <
let startpos = [line("."), col(".")] <
endif <
let default = escape(&mps, '[$^.*~\\/?]') .. (strlen(&mps) ? "," : "") .. | let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
let match_words = match_words .. (strlen(match_words) ? "," : "") .. default | let match_words = match_words . (strlen(match_words) ? "," : "") . default
if match_words !~ s:notslash .. '\\\d' | if match_words !~ s:notslash . '\\\d'
let s:all = substitute(s:pat, s:notslash .. '\zs[,:]\+', '\\|', 'g') | let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g')
let s:all = '\%(' .. s:all .. '\)' | let s:all = '\%(' . s:all . '\)'
let s:patBR = substitute(match_words .. ',', | let s:patBR = substitute(match_words.',',
\ s:notslash .. '\zs[,:]*,[,:]*', ',', 'g') | \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
let s:patBR = substitute(s:patBR, s:notslash .. '\zs:\{2,}', ':', 'g') | let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g')
" Make sure macros abort properly <
"exe "norm! \<esc>" <
call feedkeys("\e", 'tni') <
let prefix = (curcol ? '^.*\%' .. (curcol + 1) .. 'c\%(' : '^\%(') | let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(')
let suffix = (suf ? '\)\%' .. (endcol + 1) .. 'c.*$' : '\)$') | let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$')
let i = matchend(group, s:notslash .. ",") | let i = matchend(group, s:notslash . ",")
let i = matchend(groupBR, s:notslash .. ":") | let i = matchend(groupBR, s:notslash . ":")
let i = matchend(group, s:notslash .. ":") | let i = matchend(group, s:notslash . ":")
let j = matchend(group, '.*' .. s:notslash .. ":") | let j = matchend(group, '.*' . s:notslash . ":")
let mid = substitute(strpart(group, i,j-i-1), s:notslash .. '\zs:', '\\|', 'g') | let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g')
let ini = substitute(ini, s:notslash .. '\zs\\\(:\|,\)', '\1', 'g') | let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let mid = substitute(mid, s:notslash .. '\zs\\\(:\|,\)', '\1', 'g') | let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let fin = substitute(fin, s:notslash .. '\zs\\\(:\|,\)', '\1', 'g') | let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let ini = substitute(ini, s:notslash .. '\zs\\(', '\\%(', 'g') | let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g')
let mid = substitute(mid, s:notslash .. '\zs\\(', '\\%(', 'g') | let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g')
let fin = substitute(fin, s:notslash .. '\zs\\(', '\\%(', 'g') | let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g')
if a:forward && matchline =~ prefix .. fin .. suffix | if a:forward && matchline =~ prefix . fin . suffix
\ || !a:forward && matchline =~ prefix .. ini .. suffix | \ || !a:forward && matchline =~ prefix . ini . suffix
if a:forward && matchline =~ prefix .. fin .. suffix | if a:forward && matchline =~ prefix . fin . suffix
\ || !a:forward && matchline !~ prefix .. ini .. suffix | \ || !a:forward && matchline !~ prefix . ini . suffix
let skip = "r:" .. b:match_comment | let skip = "r:" . b:match_comment
let b:match_tail = (strlen(mid) ? mid .. '\|' : '') .. fin | let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin
execute "if " .. skip .. "| let skip = '0' | endif" | execute "if " . skip . "| let skip = '0' | endif"
" add virtualedit=onemore, to make it work even when the match ends the | " add virtualedit=onemore, to make it work even when the match ends the " line
" line <
let eolmark=1 " flag to set a mark on eol (since we cannot move there) | set ve=onemore
let final_position = "call cursor(" .. line(".") .. "," .. col(".") .. ")" | let final_position = "call cursor(" . line(".") . "," . col(".") . ")"
if exists('eolmark') && eolmark | return s:CleanUp(restore_options, a:mode, startpos, mid.'\|'.fin)
call setpos("''", [0, line('.'), col('$'), 0]) " set mark on the eol <
endif <
return s:CleanUp(restore_options, a:mode, startpos, mid .. '\|' .. fin) <
if a:matchline !~ a:prefix .. | if a:matchline !~ a:prefix .
\ substitute(a:group, s:notslash .. '\zs:', '\\|', 'g') .. a:suffix | \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix
let i = matchend(a:groupBR, s:notslash .. ':') | let i = matchend(a:groupBR, s:notslash . ':')
let i = matchend(word, s:notslash .. ":") | let i = matchend(word, s:notslash . ":")
if tailBR =~ s:notslash .. '\\' .. d | if tailBR =~ s:notslash . '\\' . d
let table = table .. d | let table = table . d
let table = table .. "-" | let table = table . "-"
let backref = substitute(a:matchline, a:prefix .. word .. a:suffix, | let backref = substitute(a:matchline, a:prefix.word.a:suffix,
\ '\' .. table[d], "") | \ '\'.table[d], "")
let ini = strpart(ini, 0, start) .. backref .. strpart(ini, start+len) | let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len)
let tailBR = substitute(tailBR, s:notslash .. '\zs\\' .. d, | let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d,
return ini .. ":" .. tailBR | return ini . ":" . tailBR
let groups = substitute(a:groups .. ",", s:notslash .. '\zs[,:]*,[,:]*', ',', 'g | let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
let groups = substitute(groups, s:notslash .. '\zs:\{2,}', ':', 'g') | let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g')
let i = matchend(groups, s:notslash .. ':') | let i = matchend(groups, s:notslash . ':')
let j = matchend(groups, s:notslash .. ',') | let j = matchend(groups, s:notslash . ',')
let tail = strpart(groups, i, j-i-1) .. ":" | let tail = strpart(groups, i, j-i-1) . ":"
let parsed = parsed .. ini | let parsed = parsed . ini
let i = matchend(tail, s:notslash .. ':') | let i = matchend(tail, s:notslash . ':')
let i = matchend(tail, s:notslash .. ':') | let i = matchend(tail, s:notslash . ':')
let parsed = parsed .. ":" .. s:Resolve(ini, word, "word") | let parsed = parsed . ":" . s:Resolve(ini, word, "word")
let parsed = parsed .. "," | let parsed = parsed . ","
let group = '\%(' .. a:pat .. '\)' | let group = '\%(' . a:pat . '\)'
let prefix = (a:start ? '\(^.*\%<' .. (a:start + 2) .. 'c\)\zs' : '^') | let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^')
let suffix = (a:start+1 < len ? '\(\%>' .. (a:start+1) .. 'c.*$\)\@=' : '$') | let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$')
if a:string !~ prefix .. group .. suffix | if a:string !~ prefix . group . suffix
return prefix .. group .. suffix | return prefix . group . suffix
let index = matchend(match, s:notslash .. '\\(') | let index = matchend(match, s:notslash . '\\(')
let index = matchend(match, s:notslash .. '\\(\|\\)') - 1 | let index = matchend(match, s:notslash . '\\(\|\\)') - 1
return "let " .. a:1 .. "=" .. start .. "| let " .. a:2 .. "=" .. len | return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len
let foo = substitute(a:string, '[^' .. a:pattern .. ']', "a:1", "g") | let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g")
let foo = substitute(foo, '[^' .. a:2 .. ']', "", "g") | let foo = substitute(foo, '[^' . a:2 . ']', "", "g")
let i = matchend(word, s:notslash .. '\\\d') - 1 | let i = matchend(word, s:notslash . '\\\d') - 1
let table = strpart(table, 0, s) .. (w+b) .. strpart(table, s+1) | let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1)
let backref = strpart(backref, 0, start) .. ":" .. table[s] | let backref = strpart(backref, 0, start) . ":". table[s]
\ .. strpart(backref, start+len) | \ . strpart(backref, start+len)
let word = strpart(word, 0, i-1) .. backref .. strpart(word, i+1) | let word = strpart(word, 0, i-1) . backref . strpart(word, i+1)
let i = matchend(word, s:notslash .. '\\\d') - 1 | let i = matchend(word, s:notslash . '\\\d') - 1
let word = substitute(word, s:notslash .. '\zs:', '\\', 'g') | let word = substitute(word, s:notslash . '\zs:', '\\', 'g')
return table .. word | return table . word
let tail = (a:patterns =~ a:comma .. "$" ? a:patterns : a:patterns .. a:comma) | let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma)
let i = matchend(tail, s:notslash .. a:comma) | let i = matchend(tail, s:notslash . a:comma)
let alttail = (a:1 =~ a:comma .. "$" ? a:1 : a:1 .. a:comma) | let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma)
let j = matchend(alttail, s:notslash .. a:comma) | let j = matchend(alttail, s:notslash . a:comma)
let currpat = substitute(current, s:notslash .. a:branch, '\\|', 'g') | let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
while a:string !~ a:prefix .. currpat .. a:suffix | while a:string !~ a:prefix . currpat . a:suffix
let i = matchend(tail, s:notslash .. a:comma) | let i = matchend(tail, s:notslash . a:comma)
let currpat = substitute(current, s:notslash .. a:branch, '\\|', 'g') | let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
let j = matchend(alttail, s:notslash .. a:comma) | let j = matchend(alttail, s:notslash . a:comma)
let current = current .. a:comma .. strpart(alttail, 0, j-1) | let current = current . a:comma . strpart(alttail, 0, j-1)
amenu &Matchit.t&able :echo '0:' .. b:match_table .. ':9'<CR> | amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR>
let default = escape(&mps, '[$^.*~\\/?]') .. (strlen(&mps) ? "," : "") .. | let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
let match_words = match_words .. (strlen(match_words) ? "," : "") .. default | let match_words = match_words . (strlen(match_words) ? "," : "") . default
if match_words !~ s:notslash .. '\\\d' | if match_words !~ s:notslash . '\\\d'
let s:all = '\%(' .. substitute(s:pat, '[,:]\+', '\\|', 'g') .. '\)' | let s:all = '\%(' . substitute(s:pat, '[,:]\+', '\\|', 'g') . '\)'
let s:patBR = substitute(match_words .. ',', | let s:patBR = substitute(match_words.',',
\ s:notslash .. '\zs[,:]*,[,:]*', ',', 'g') | \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
let s:patBR = substitute(s:patBR, s:notslash .. '\zs:\{2,}', ':', 'g') | let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g')
let openlist = split(s:pat .. ',', s:notslash .. '\zs:.\{-}' .. s:notslash .. ', | let openlist = split(s:pat . ',', s:notslash . '\zs:.\{-}' . s:notslash . ',')
let midclolist = split(',' .. s:pat, s:notslash .. '\zs,.\{-}' .. s:notslash .. | let midclolist = split(',' . s:pat, s:notslash . '\zs,.\{-}' . s:notslash . ':')
call map(midclolist, {-> split(v:val, s:notslash .. ':')}) | call map(midclolist, {-> split(v:val, s:notslash . ':')})
call map(openlist, {i,v -> v =~# s:notslash .. '\\|' ? '\%(' .. v .. '\)' : v} | call map(openlist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v})
call map(middlelist, {i,v -> v =~# s:notslash .. '\\|' ? '\%(' .. v .. '\)' : v} | call map(middlelist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v})
call map(closelist, {i,v -> v =~# s:notslash .. '\\|' ? '\%(' .. v .. '\)' : v} | call map(closelist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v})
let skip = "r:" .. b:match_comment | let skip = "r:" . b:match_comment
let openpat = substitute(open, '\%(' .. s:notslash .. '\)\@<=\\(', '\\%(', 'g') | let openpat = substitute(open, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g')
let closepat = substitute(close, '\%(' .. s:notslash .. '\)\@<=\\(', '\\%(', 'g' | let closepat = substitute(close, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g')
let middlepat = substitute(middle, '\%(' .. s:notslash .. '\)\@<=\\(', '\\%(', ' | let middlepat = substitute(middle, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g'
execute "if " .. skip .. "| let skip = '0' | endif" | execute "if " . skip . "| let skip = '0' | endif"
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .. | let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .
\ strpart(skip,2) .. "'" | \ strpart(skip,2) . "'"
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .. | let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .
\ strpart(skip,2) .. "'" | \ strpart(skip,2) . "'"
matchit#Match_wrapper[161]..<SNR>71_ParseSkip
. This tells me the error is from the matchit plugin, which can be found in "{vim-installation-directory}/pack/dist/opt/matchit/autoload/matchit.vim", and in particular,s:ParseSkip
at the end of that file. This matchit plugin is maintained (upstream) in github.com/chrisbra/matchit. Perhaps you could file an issue there :)