nvim-treesitter-textobjects
nvim-treesitter-textobjects copied to clipboard
"move" key mapping doesn't work
I changed the key mapping of goto_next_start
and goto_previous_start
, but it doesn't work. ]m
and [m
is still the key to jump between functions where I want ]]
and [[
.
require 'nvim-treesitter.configs'.setup {
textobjects = {
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer",
},
},
},
}
--
output of nvim --version
:
NVIM v0.7.0-dev+914-g7717f38d3
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=1 -I/data/download/neovim/build/config -I/data/download/neovim/src -I/data/download/neovim/.deps/usr/include -I/usr/include -I/data/download/neovim/build/src/nvim/auto -I/data/download/neovim/build/include
Features: +acl +iconv +tui
Hi, what file are you using to test this?
Also, you can check the output of
:map [[
:map ]]
to verify if the mappings are set
I'm trying to move to the next parameter, apparently it's not working.
- Press
v
- Press
pi
=>@parameter.inner
- Press
]]
https://user-images.githubusercontent.com/16160544/152068893-8e43da43-f83e-430b-a07d-58effa80b1a1.mp4
My config:
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@parameter.inner',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
I rebuilt my configure files from scratch, and I think I found the reason. When I removed the ray-x/go.nvim
plugin, the "move" mapping works. When I reinstall the ray-x/go.nvim
plugin, the mapping doesn't work again, even when I want to move in .cpp files. So I think there is something in the ray-x/go.nvim
stop "move" mapping from working.
setup ray-x/go.nvim
before treesitter works for me
Closing as completed.