backport feat(treesitter): expand selection to sibling node (#39323)

Problem:
Can't expand treesitter-incremental-selection to the next and previous
sibling nodes.

Solution:
Pressing `]N` in visual mode will expand the selection to the next
sibling node, and `[N` will do the same with the previous node.

Co-authored-by: altermo <107814000+altermo@users.noreply.github.com>
This commit is contained in:
Justin M. Keyesandaltermo authored and GitHub committed 2026-04-22 21:40:12 +00:00
1 parent fd1b193d51
commit b46688feee
5 files changed
+107 -14

No files matched your search

@@ -64,6 +64,16 @@ describe('treesitter incremental-selection', function()
treeselect('select_parent')
eq('foo(1)\nbar(2)\n', get_selected())
set_lines('quux(1,foo,bar,baz,qux,2)')
feed('<esc>fbve')
eq('bar', get_selected())
treeselect('select_grow_next')
eq('bar,baz', get_selected())
treeselect('select_grow_prev')
eq('foo,bar,baz', get_selected())
end)
it('repeat', function()
@@ -89,6 +99,14 @@ describe('treesitter incremental-selection', function()
treeselect('select_child', 2)
eq('2', get_selected())
feed('<esc>F1')
treeselect('select_grow_next', 2)
eq('1,2,3', get_selected())
feed('<esc>f4v')
treeselect('select_grow_prev', 2)
eq('2,3,4', get_selected())
end)
it('history', function()