runtime(fish): Add matchit support to filetype plugin

Commit: 
https://github.com/vim/vim/commit/ce4fbda99285c991df3c1f26e248c88bc938ba9e
Author: Phạm Bình An <[email protected]>
Date:   Fri Mar 20 21:29:57 2026 +0000

    runtime(fish): Add matchit support to filetype plugin
    
    closes: https://github.com/vim/vim/issues/19701
    
    Co-authored-by: Doug Kearns <[email protected]>
    Signed-off-by: Phạm Bình An <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/ftplugin/fish.vim b/runtime/ftplugin/fish.vim
index 55d7ea8dd..685ff4d17 100644
--- a/runtime/ftplugin/fish.vim
+++ b/runtime/ftplugin/fish.vim
@@ -5,10 +5,15 @@
 " Last Change:  February 1, 2023
 "               2023 Aug 28 by Vim Project (undo_ftplugin)
 "               2024 May 23 by Riley Bruins <[email protected]> 
('commentstring')
+"               2026 Mar 16 by Phạm Bình An (add matchit support)
 
 if exists("b:did_ftplugin")
     finish
 endif
+
+let s:saved_cpo = &cpo
+set cpo-=C
+
 let b:did_ftplugin = 1
 
 setlocal iskeyword=@,48-57,_,192-255,-,.
@@ -17,3 +22,20 @@ setlocal commentstring=#\ %s
 setlocal formatoptions+=crjq
 
 let b:undo_ftplugin = "setl cms< com< fo< isk<"
+
+" Define patterns for the matchit plugin
+if exists("loaded_matchit") && !exists("b:match_words")
+  let b:match_words =
+      \ 
'\<\%(else\s\+\)\@<!if\>\|\<\%(switch\|begin\|function\|while\|for\)\>:' ..
+      \ '\<else\%(\s\+if\)\?\>\|\<case\>:' ..
+      \ '\<end\>'
+
+  let b:match_ignorecase = 0
+  let b:match_skip = "S:keyword"
+
+  let b:undo_ftplugin ..= " | unlet! b:match_words b:match_ignorecase 
b:match_skip"
+endif
+
+" Restore 'cpo' to its original value
+let &cpo = s:saved_cpo
+unlet s:saved_cpo

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1w3hPx-00FJK9-R3%40256bit.org.

Raspunde prin e-mail lui