vim-patch:e9f8e0f: runtime(matchit): Update matchit plugin (#40085)

e9f8e0fcbe

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-06-02 20:17:33 +08:00
committed by GitHub
parent 772cfcf267
commit dcf36e613b
3 changed files with 8 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
" matchit.vim: (global plugin) Extended "%" matching
" autload script of matchit plugin, see ../plugin/matchit.vim
" Last Change: Jan 09, 2026
" Last Change: June 01, 2026
" Neovim does not support scriptversion
if has("vimscript-4")
@@ -124,7 +124,7 @@ function matchit#Match_wrapper(word, forward, mode) range
let s:all = substitute(s:all, s:notslash .. '\zs\\\(:\|,\)', '\1', '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')
let s:all = substitute(s:all, s:notslash .. '\zs\\(', '\\%(', 'g')
let s:all = '\%(' .. s:all .. '\)'
if exists("b:match_debug")
let b:match_pat = s:pat
@@ -340,8 +340,8 @@ fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline)
if table[d] != "-"
let backref = substitute(a:matchline, a:prefix .. word .. a:suffix,
\ '\' .. table[d], "")
" Are there any other characters that should be escaped?
let backref = escape(backref, '*,:')
" escape magic pattern metacharacters and matchit special characters [,:]
let backref = escape(backref, '\.*[^$~,:')
execute s:Ref(ini, d, "start", "len")
let ini = strpart(ini, 0, start) .. backref .. strpart(ini, start+len)
let tailBR = substitute(tailBR, s:notslash .. '\zs\\' .. d,

View File

@@ -1,4 +1,4 @@
*matchit.txt* Extended |%| matching Last change: 2026 Jan 06
*matchit.txt* Extended |%| matching Last change: 2026 Jun 01
VIM REFERENCE MANUAL by Benji Fisher et al
@@ -197,14 +197,6 @@ can be defined in the |filetype-plugin| or autocommand that defines
The main variable is |b:match_words|. It is described in the section below on
supporting a new language.
*MatchError* *matchit-hl* *matchit-highlight*
MatchError is the highlight group for error messages from the script. By
default, it is linked to WarningMsg. If you do not want to be bothered by
error messages, you can define this to be something invisible. For example,
if you use the GUI version of Vim and your command line is normally white, you
can do >
:hi MatchError guifg=white guibg=white
<
*b:match_ignorecase*
If you >
:let b:match_ignorecase = 1

View File

@@ -1,7 +1,7 @@
" matchit.vim: (global plugin) Extended "%" matching
" Maintainer: Christian Brabandt
" Version: 1.21
" Last Change: 2024 May 20
" Version: 1.22
" Last Change: 2026 Jun 01
" Repository: https://github.com/chrisbra/matchit
" Previous URL:http://www.vim.org/script.php?script_id=39
" Previous Maintainer: Benji Fisher PhD <benji@member.AMS.org>
@@ -50,7 +50,7 @@ fun MatchEnable()
nnoremap <silent> <Plug>(MatchitNormalForward) :<C-U>call matchit#Match_wrapper('',1,'n')<CR>
nnoremap <silent> <Plug>(MatchitNormalBackward) :<C-U>call matchit#Match_wrapper('',0,'n')<CR>
xnoremap <silent> <Plug>(MatchitVisualForward) :<C-U>call matchit#Match_wrapper('',1,'v')<CR>
\:if col("''") != col("$") \| exe ":normal! m'" \| endif<cr>gv``
\:if line("''") != line(".") \|\| col("''") != col("$") \| exe ":normal! m'" \| endif<cr>gv``
xnoremap <silent> <Plug>(MatchitVisualBackward) :<C-U>call matchit#Match_wrapper('',0,'v')<CR>m'gv``
onoremap <silent> <Plug>(MatchitOperationForward) :<C-U>call matchit#Match_wrapper('',1,'o')<CR>
onoremap <silent> <Plug>(MatchitOperationBackward) :<C-U>call matchit#Match_wrapper('',0,'o')<CR>