mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 17:30:08 -04:00
fix: node_incremental for incremental selection jumping around (#3257)
This commit is contained in:
parent
f7ac82c48e
commit
abb8b5756a
1 changed files with 6 additions and 1 deletions
|
|
@ -131,15 +131,20 @@ function M.attach(bufnr)
|
||||||
local config = configs.get_module "incremental_selection"
|
local config = configs.get_module "incremental_selection"
|
||||||
for funcname, mapping in pairs(config.keymaps) do
|
for funcname, mapping in pairs(config.keymaps) do
|
||||||
local mode
|
local mode
|
||||||
|
local rhs
|
||||||
if funcname == "init_selection" then
|
if funcname == "init_selection" then
|
||||||
mode = "n"
|
mode = "n"
|
||||||
|
rhs = M[funcname]
|
||||||
else
|
else
|
||||||
mode = "x"
|
mode = "x"
|
||||||
|
-- We need to move to command mode to access marks '< (visual area start) and '> (visual area end) which are not
|
||||||
|
-- properly accessible in visual mode.
|
||||||
|
rhs = string.format(":lua require'nvim-treesitter.incremental_selection'.%s()<CR>", funcname)
|
||||||
end
|
end
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
mode,
|
mode,
|
||||||
mapping,
|
mapping,
|
||||||
M[funcname],
|
rhs,
|
||||||
{ buffer = bufnr, silent = true, noremap = true, desc = FUNCTION_DESCRIPTIONS[funcname] }
|
{ buffer = bufnr, silent = true, noremap = true, desc = FUNCTION_DESCRIPTIONS[funcname] }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue