aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authoritepechi / いてぺち <72330683+itepechi@users.noreply.github.com>2022-08-02 21:40:25 +0900
committerGitHub <noreply@github.com>2022-08-02 12:40:25 +0000
commitabb8b5756ac2d3b007adef2d05a018e4d9a1fa47 (patch)
treebdcc66a5dc66b6d52206ed813dc257459a7ee1da /lua
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar.gz
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar.bz2
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar.lz
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar.xz
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.tar.zst
nvim-treesitter-abb8b5756ac2d3b007adef2d05a018e4d9a1fa47.zip
fix: node_incremental for incremental selection jumping around (#3257)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/incremental_selection.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/incremental_selection.lua b/lua/nvim-treesitter/incremental_selection.lua
index 1bacd07f8..5deaaf84e 100644
--- a/lua/nvim-treesitter/incremental_selection.lua
+++ b/lua/nvim-treesitter/incremental_selection.lua
@@ -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