fixed the issue with the matchit plugin#177
Conversation
|
Thanks @ivangeorgiew -- I hope this gets merged. Further discussion here: chrisbra/matchit#11 |
|
I confirm this PR fixes a big issue with the FYI, the filetype is often set on events |
|
FWIW, the official javascript ftplugin from the Vim upstream repository does not setup diff --git a/after/ftplugin/jsx.vim b/after/ftplugin/jsx.vim
index f9329fc..6ff94d9 100644
--- a/after/ftplugin/jsx.vim
+++ b/after/ftplugin/jsx.vim
@@ -9,11 +9,8 @@
" modified from html.vim
if exists("loaded_matchit")
let b:match_ignorecase = 0
- let s:jsx_match_words = '(:),\[:\],{:},<:>,' .
+ let b:match_words = '(:),\[:\],{:},<:>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
- let b:match_words = exists('b:match_words')
- \ ? b:match_words . ',' . s:jsx_match_words
- \ : s:jsx_match_words
endif
setlocal suffixesadd+=.jsx |
|
Oh, and BTW, instead of |
|
I agree! Actually it was like that before #142. (note that |
True, the original code looks much nicer. However, because of how packages are loaded, vim-jsx's Nevertheless, going by my Vim dotfiles history, I've apparently run into this issue as well some time after #142 was merged. I don't understand how exactly the filetype gets set multiple times, but it does cause |
|
I don't even understand why an official filetype plugin needs to make use of the
Better would be a guard, that actually checks the content of the |
Fair point, that's pretty much where my gripe originates from. Besides, the
Oh, that's a shame. Seems like improvements now live on in individual forks. |
I don't really know how it happens, but in some cases the filetype is set multiple times and the code that sets
b:match_wordsexecutes for each instance. This leads to theb:match_wordsbeing duplicated, when the number of duplicates reaches 10, there is a regex error that there are beyond 10 references and '%' breaks. You can see how I fixed this in the PR