2020-04-23 07:55:00 +02:00
|
|
|
function! s:visual_node(node_range)
|
|
|
|
|
let [l:cursor_start, l:cursor_end] = a:node_range
|
|
|
|
|
if !empty(l:cursor_start) && !empty(l:cursor_end)
|
|
|
|
|
call cursor(l:cursor_start[0]+1, l:cursor_start[1]+1)
|
|
|
|
|
normal v
|
|
|
|
|
call cursor(l:cursor_end[0]+1, l:cursor_end[1])
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! nvim_treesitter#select_node_incr()
|
|
|
|
|
call s:visual_node(luaeval('require"nvim-treesitter.textobj".node_incremental()'))
|
|
|
|
|
endfunction
|
|
|
|
|
|
2020-04-23 08:43:35 +02:00
|
|
|
function! nvim_treesitter#select_scope_incr()
|
|
|
|
|
call s:visual_node(luaeval('require"nvim-treesitter.textobj".scope_incremental()'))
|
2020-04-23 07:55:00 +02:00
|
|
|
endfunction
|