|
5 | 5 | " Contributors: Ricardo Catalinas Jiménez <[email protected]>
|
6 | 6 | " Eduardo Lopez (http://github.com/tapichu)
|
7 | 7 | " Arvid Bjurklint (http://github.com/slarwise)
|
8 |
| -" Last Update: 2021-Nov-22 |
| 8 | +" Paweł Zacharek (http://github.com/subc2) |
| 9 | +" Last Update: 2022-Sep-28 |
9 | 10 | " License: Vim license
|
10 | 11 | " URL: https://github.com/vim-erlang/vim-erlang-runtime
|
11 | 12 |
|
@@ -57,7 +58,7 @@ setlocal suffixesadd=.erl,.hrl
|
57 | 58 | let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
|
58 | 59 | let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
|
59 | 60 |
|
60 |
| -let s:erlang_fun_begin = '^\a\w*(.*$' |
| 61 | +let s:erlang_fun_begin = '^\l[A-Za-z0-9_@]*(.*$' |
61 | 62 | let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
|
62 | 63 |
|
63 | 64 | if !exists('*GetErlangFold')
|
@@ -99,6 +100,23 @@ let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
|
99 | 100 | \ . " comments< commentstring< formatoptions< suffixesadd< include<"
|
100 | 101 | \ . " define<"
|
101 | 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 |
| 119 | + |
102 | 120 | let &cpo = s:cpo_save
|
103 | 121 | unlet s:cpo_save
|
104 | 122 |
|
|
0 commit comments