summaryrefslogtreecommitdiffstats
path: root/runtime/pack/dist/opt/matchit/autoload/matchit.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/pack/dist/opt/matchit/autoload/matchit.vim')
-rw-r--r--runtime/pack/dist/opt/matchit/autoload/matchit.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/pack/dist/opt/matchit/autoload/matchit.vim b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
index dc2aba6..aa97748 100644
--- a/runtime/pack/dist/opt/matchit/autoload/matchit.vim
+++ b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
@@ -1,6 +1,6 @@
" matchit.vim: (global plugin) Extended "%" matching
" autload script of matchit plugin, see ../plugin/matchit.vim
-" Last Change: Jan 24, 2022
+" Last Change: May 20, 2024
" Neovim does not support scriptversion
if has("vimscript-4")
@@ -87,9 +87,9 @@ function matchit#Match_wrapper(word, forward, mode) range
let s:last_mps = &mps
" quote the special chars in 'matchpairs', replace [,:] with \| and then
" append the builtin pairs (/*, */, #if, #ifdef, #ifndef, #else, #elif,
- " #endif)
+ " #elifdef, #elifndef, #endif)
let default = escape(&mps, '[$^.*~\\/?]') .. (strlen(&mps) ? "," : "") ..
- \ '\/\*:\*\/,#\s*if\%(n\=def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
+ \ '\/\*:\*\/,#\s*if\%(n\=def\)\=:#\s*else\>:#\s*elif\%(n\=def\)\=\>:#\s*endif\>'
" s:all = pattern with all the keywords
let match_words = match_words .. (strlen(match_words) ? "," : "") .. default
let s:last_words = match_words
@@ -101,6 +101,8 @@ function matchit#Match_wrapper(word, forward, mode) range
let s:pat = s:ParseWords(match_words)
endif
let s:all = substitute(s:pat, s:notslash .. '\zs[,:]\+', '\\|', 'g')
+ " un-escape \, to ,
+ let s:all = substitute(s:all, '\\,', ',', 'g')
" Just in case there are too many '\(...)' groups inside the pattern, make
" sure to use \%(...) groups, so that error E872 can be avoided
let s:all = substitute(s:all, '\\(', '\\%(', 'g')
@@ -112,6 +114,8 @@ function matchit#Match_wrapper(word, forward, mode) range
let s:patBR = substitute(match_words .. ',',
\ s:notslash .. '\zs[,:]*,[,:]*', ',', 'g')
let s:patBR = substitute(s:patBR, s:notslash .. '\zs:\{2,}', ':', 'g')
+ " un-escape \, to ,
+ let s:patBR = substitute(s:patBR, '\\,', ',', 'g')
endif
" Second step: set the following local variables:
@@ -534,6 +538,8 @@ fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
else
let currpat = substitute(current, s:notslash .. a:branch, '\\|', 'g')
endif
+ " un-escape \, to ,
+ let currpat = substitute(currpat, '\\,', ',', 'g')
while a:string !~ a:prefix .. currpat .. a:suffix
let tail = strpart(tail, i)
let i = matchend(tail, s:notslash .. a:comma)