]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(matchit): include minor improvement from chrisbra/matchit
authorJon Parise <jon@indelible.org>
Tue, 13 Jan 2026 19:40:40 +0000 (19:40 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 13 Jan 2026 19:40:40 +0000 (19:40 +0000)
In particular, documentation update from
related: chrisbra/matchit#55

Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/matchit/autoload/matchit.vim
runtime/pack/dist/opt/matchit/doc/matchit.txt

index 904c2cce1f04383f7397272ec4fa976887c61045..1e660ffd3e0ec8bd0904c78009396088c31a18af 100644 (file)
@@ -1,6 +1,6 @@
 "  matchit.vim: (global plugin) Extended "%" matching
 "  autload script of matchit plugin, see ../plugin/matchit.vim
-"  Last Change: Jan 06, 2025
+"  Last Change: Jan 09, 2026
 
 " Neovim does not support scriptversion
 if has("vimscript-4")
@@ -71,9 +71,8 @@ function matchit#Match_wrapper(word, forward, mode) range
 
   " Check for custom match function hook
   if exists("b:match_function")
-    let MatchFunc = b:match_function
     try
-      let result = call(MatchFunc, [a:forward])
+      let result = call(b:match_function, [a:forward])
       if !empty(result)
         call cursor(result)
         return s:CleanUp(restore_options, a:mode, startpos)
index 0d505f8557f68d84383cd9fb250d062b8007370a..e82bacdeb03bd46f0c166d4a0ed1cca12debe0a0 100644 (file)
@@ -282,8 +282,8 @@ Python example (simplified): >
          let pattern = get(s:keywords, keyword, '')
          if empty(pattern) | return [] | endif
 
-         let flags = a:forward ? 'nW' : 'nbW'
-         let [lnum, col] = searchpos('^\s*\%(' . pattern . '\)\>', flags, 0, 0,
+         " Forward-only. Backwards left as an exercise for the reader.
+         let [lnum, col] = searchpos('^\s*\%(' . pattern . '\)\>', 'nW' 0, 0,
          \                            'indent(".") != ' . indent('.'))
          return lnum > 0 ? [lnum, col] : []
        endfunction