forked from andymass/vim-matchup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathts_engine.vim
More file actions
53 lines (39 loc) · 1.19 KB
/
Copy pathts_engine.vim
File metadata and controls
53 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
" vim match-up - even better matching
"
" Maintainer: Andy Massimino
" Email: a@normed.space
"
let s:save_cpo = &cpo
set cpo&vim
function! s:forward(fn, ...)
let l:ret = luaeval(
\ 'require"treesitter-matchup.internal".' . a:fn . '(unpack(_A))',
\ a:000)
return l:ret
endfunction
function! matchup#ts_engine#is_enabled(bufnr) abort
if !has('nvim-0.9.0')
return 0
endif
return +s:forward('is_enabled', a:bufnr)
endfunction
function! matchup#ts_engine#get_delim(opts) abort
call matchup#perf#tic('ts_engine.get_delim')
let l:res = s:forward('get_delim', bufnr('%'), a:opts)
if l:res is 0 | return | endif
if empty(l:res)
call matchup#perf#toc('ts_engine.get_delim', 'fail')
return {}
endif
let l:res.get_matching = function('matchup#ts_engine#get_matching')
call matchup#perf#toc('ts_engine.get_delim', 'done')
return l:res
endfunction
function! matchup#ts_engine#get_matching(down, _) dict abort
call matchup#perf#tic('ts_engine.get_matching')
let l:list = s:forward('get_matching', self, a:down, bufnr('%'))
call matchup#perf#toc('ts_engine.get_matching', 'done')
return l:list
endfunction
let &cpo = s:save_cpo
" vim: fdm=marker sw=2