Skip to content

Commit

Permalink
fix keymap retrigger in operator mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MurdeRM3L0DY committed Jan 19, 2023
1 parent 4739c2d commit e8903ba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lua/lazy/core/handler/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,27 @@ function M.retrigger(keys)
c = type(c) == "number" and vim.fn.nr2char(c) or c
pending = pending .. c
end

local op = vim.v.operator
if op and op ~= "" and vim.api.nvim_get_mode().mode:find("o") then
-- we have to "<esc>" to ensure we're in normal mode
keys = "<esc>" .. op .. keys
end
local feed = keys .. pending
feed = M.replace_special(feed)
if vim.v.count ~= 0 then
feed = vim.v.count .. feed
end
vim.api.nvim_input(feed)

vim.schedule(function()
if op == "c" then
-- offset col + 1 due to "<esc>" from insert mode
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
vim.api.nvim_win_set_cursor(0, { row, col + 1 })
end

vim.api.nvim_input(feed)
end)
end

---@param value string|LazyKeys
Expand Down

0 comments on commit e8903ba

Please sign in to comment.