Skip to content

Commit 232e093

Browse files
author
MurdeRM3L0DY
committed
fix keymap retrigger in operator mode
1 parent 4739c2d commit 232e093

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lua/lazy/core/handler/keys.lua

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,27 @@ function M.retrigger(keys)
3838
c = type(c) == "number" and vim.fn.nr2char(c) or c
3939
pending = pending .. c
4040
end
41+
4142
local op = vim.v.operator
4243
if op and op ~= "" and vim.api.nvim_get_mode().mode:find("o") then
44+
-- we have to "<esc>" because "c" enters insert mode inherently
4345
keys = "<esc>" .. op .. keys
4446
end
4547
local feed = keys .. pending
4648
feed = M.replace_special(feed)
4749
if vim.v.count ~= 0 then
4850
feed = vim.v.count .. feed
4951
end
50-
vim.api.nvim_input(feed)
52+
53+
vim.schedule(function()
54+
if op == "c" then
55+
-- offset col + 1 due to "<esc>" from insert mode
56+
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
57+
vim.api.nvim_win_set_cursor(0, { row, col + 1 })
58+
end
59+
60+
vim.api.nvim_input(feed)
61+
end)
5162
end
5263

5364
---@param value string|LazyKeys

0 commit comments

Comments
 (0)