mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -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"
|
||||
for funcname, mapping in pairs(config.keymaps) do
|
||||
local mode
|
||||
local rhs
|
||||
if funcname == "init_selection" then
|
||||
mode = "n"
|
||||
rhs = M[funcname]
|
||||
else
|
||||
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
|
||||
vim.keymap.set(
|
||||
mode,
|
||||
mapping,
|
||||
M[funcname],
|
||||
rhs,
|
||||
{ buffer = bufnr, silent = true, noremap = true, desc = FUNCTION_DESCRIPTIONS[funcname] }
|
||||
)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue