mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Allow switching regexp engine for filetypes
This commit is contained in:
@@ -74,6 +74,9 @@ function! s:setup_match_words()
|
||||
|
||||
" the syntax method is too slow for latex
|
||||
let b:match_skip = 'r:\\\@<!\%(\\\\\)*%'
|
||||
|
||||
" the old regexp engine is a bit faster '\%#=1'
|
||||
let b:matchup_regexpengine = 1
|
||||
endfunction
|
||||
|
||||
if get(g:, 'vimtex_enabled',
|
||||
|
||||
@@ -456,6 +456,11 @@ function! s:init_delim_regexes() abort " {{{1
|
||||
" use a flag for b:match_ignorecase
|
||||
let l:ic = get(b:, 'match_ignorecase', 0) ? '\c' : '\C'
|
||||
|
||||
" if a particular engine is specified, use that for the patterns
|
||||
" (currently only applied to delim_re TODO)
|
||||
let l:eng = string(get(b:, 'matchup_regexpengine', 0))
|
||||
let l:eng = l:eng > 0 ? '\%#='.l:eng : ''
|
||||
|
||||
for l:k in keys(s:sidedict)
|
||||
let l:re.delim_tex._engine_info.has_zs[l:k]
|
||||
\ = l:re.delim_tex[l:k] =~# g:matchup#re#zs
|
||||
@@ -465,7 +470,7 @@ function! s:init_delim_regexes() abort " {{{1
|
||||
else
|
||||
" since these patterns are used in searchpos(),
|
||||
" be explicit about regex mode (set magic mode and ignorecase)
|
||||
let l:re.delim_tex[l:k] = '\m' . l:ic . l:re.delim_tex[l:k]
|
||||
let l:re.delim_tex[l:k] = l:eng . '\m' . l:ic . l:re.delim_tex[l:k]
|
||||
endif
|
||||
|
||||
let l:re.delim_all[l:k] = l:re.delim_tex[l:k]
|
||||
|
||||
Reference in New Issue
Block a user