Skip to content

Commit 9f225a6

Browse files
committed
ftplugin: Make match-it support conform to best practices
When I pushed 6ea8b85 to Vim, the reviewers asked to do some improvements in vim/vim#13713. This commit contains those improvements.
1 parent ac88ebf commit 9f225a6

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

ftplugin/erlang.vim

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
" Eduardo Lopez (http://github.com/tapichu)
77
" Arvid Bjurklint (http://github.com/slarwise)
88
" Paweł Zacharek (http://github.com/subc2)
9-
" Last Update: 2022-Sep-28
9+
" Last Update: 2023-Dec-20
1010
" License: Vim license
1111
" URL: https://github.com/vim-erlang/vim-erlang-runtime
1212

@@ -96,26 +96,22 @@ if !exists('*ErlangFoldText')
9696
endfunction
9797
endif
9898

99+
" The following lines enable the macros/matchit.vim plugin for extended
100+
" matching with the % key.
101+
let b:match_ignorecase = 0
102+
let b:match_words =
103+
\ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' .
104+
\ ':\<\%(after\|catch\|else\|of\)\>' .
105+
\ ':\<end\>,' .
106+
\ '^\l[A-Za-z0-9_@]*' .
107+
\ ':^\%(\%(\t\| \{' . shiftwidth() .
108+
\ '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$'
109+
let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom'
110+
99111
let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
100112
\ . " comments< commentstring< formatoptions< suffixesadd< include<"
101113
\ . " define<"
102-
103-
" The following lines enable the macros/matchit.vim plugin for
104-
" extended matching with the % key.
105-
if exists("loaded_matchit")
106-
let s:sw = &sw
107-
if exists('*shiftwidth')
108-
let s:sw = shiftwidth()
109-
endif
110-
111-
let b:match_words =
112-
\ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' .
113-
\ ':\<\%(after\|catch\|else\|of\)\>' .
114-
\ ':\<end\>,' .
115-
\ '^\l[A-Za-z0-9_@]*' .
116-
\ ':^\%(\%(\t\| \{' . s:sw . '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$'
117-
let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom'
118-
endif
114+
\ . " | unlet b:match_ignorecase b:match_words b:match_skip"
119115

120116
let &cpo = s:cpo_save
121117
unlet s:cpo_save

0 commit comments

Comments
 (0)