generated from nvim-treesitter/module-template
-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Labels
NEXTissues and PRs relating to the 1.0 refactor on `main`issues and PRs relating to the 1.0 refactor on `main`bugSomething isn't workingSomething isn't working
Description
Describe the bug
In the main
branch, now you need to set {expr = true}
when mapping the ;
, ,
repeat functions, so that you can also configure repeat for builtins f
,F
,t
,T
.
-- Repeat movement with ; and ,
-- ensure ; goes forward and , goes backward regardless of the last direction
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next, { expr = true })
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous, { expr = true })
By doing this, moves that make use of :normal
commands return error.
To Reproduce
Steps to reproduce the behavior:
- configure mapping for
repeat_last_move_next
andrepeat_last_move_previous
- try a repeatable action, for example "go to next start of
@function.outer
" (e.g.]m
) - try to repeat with
;
,,
Expected behavior
The action should be repeated without errors.
** What happens **
E5108: Error executing lua: vim/_editor.lua:0: nvim_exec2(), line 1: Vim(normal):E523: Not allowed here
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...ter-textobjects/lua/nvim-treesitter-textobjects/move.lua:16: in function 'goto_node'
...ter-textobjects/lua/nvim-treesitter-textobjects/move.lua:135: in function <...ter-textobjects/lua/nvim-treesitter-textobjects/move.lua:41>
Output of nvim --version
NVIM v0.11.1
Build type: Release
LuaJIT 2.1.1744318430
** Additional info **
When I was trying to make my own repetable function work, I noticed that wrapping with vim.schedule()
bypasses the issue:
local diag_move = require('nvim-treesitter-textobjects.repeatable_move').make_repeatable_move(function(opts)
if opts.forward then
-- schedule() prevents Vim(normal):E523: Not allowed here
-- that would arise because ; , are mapped with { expr = true }
vim.schedule(function() vim.diagnostic.jump({count = 1}) end)
else
vim.schedule(function() vim.diagnostic.jump({count = -1}) end)
end
end)
ybc37 and liskin
Metadata
Metadata
Assignees
Labels
NEXTissues and PRs relating to the 1.0 refactor on `main`issues and PRs relating to the 1.0 refactor on `main`bugSomething isn't workingSomething isn't working