mirror of
https://github.com/neovim/neovim.git
synced 2026-07-15 05:40:34 +00:00
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:
@@ -466,6 +466,14 @@ do
|
||||
require 'vim.treesitter._select'.select_next(vim.v.count1)
|
||||
end, { desc = 'Select next node' })
|
||||
|
||||
vim.keymap.set({ 'x' }, '[N', function()
|
||||
require 'vim.treesitter._select'.select_grow_prev(vim.v.count1)
|
||||
end, { desc = 'Select expand previous node' })
|
||||
|
||||
vim.keymap.set({ 'x' }, ']N', function()
|
||||
require 'vim.treesitter._select'.select_grow_next(vim.v.count1)
|
||||
end, { desc = 'Select expand next node' })
|
||||
|
||||
vim.keymap.set({ 'x', 'o' }, 'an', function()
|
||||
if vim.treesitter.get_parser(nil, nil, { error = false }) then
|
||||
require 'vim.treesitter._select'.select_parent(vim.v.count1)
|
||||
|
||||
Reference in New Issue
Block a user