aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/ts_test.vim
blob: 15192d8ddadc719b66f40d288a99c94d00614b75 (plain) (blame)
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
let g:ts_test_path = expand("<sfile>:p:h:h")
let g:has_ts = v:false

func! TSTest()
  if g:has_ts
    return
  end
  " TODO: module!
  lua theparser = vim.treesitter.create_parser(0)
  lua require'treesitter_demo'
  let g:has_ts = v:true
endfunc

func! TSCursor()
  " disable matchparen
  NoMatchParen
  call TSTest()
  au CursorMoved <buffer> lua ts_cursor()
  au CursorMovedI <buffer> lua ts_cursor()
  map <buffer> <Plug>(ts-expand) <cmd>lua ts_expand_node()<cr>
endfunc

func! TSSyntax()
  " disable matchparen
  set syntax=
  call TSTest()
  lua ts_syntax()
endfunc

command! TSTest call TSTest()
command! TSCursor call TSCursor()
command! TSSyntax call TSSyntax()