feat(treesitter): expand selection to sibling node #38938

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.
This commit is contained in:
altermo
2026-04-22 23:10:24 +02:00
committed by GitHub
parent 28ba068372
commit 451811b1be
5 changed files with 107 additions and 15 deletions

View File

@@ -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()