Fix expression resolving timing

This commit is contained in:
hrsh7th
2022-01-15 22:56:01 +09:00
parent ec972710d3
commit 243d5f4a12

View File

@@ -186,18 +186,12 @@ keymap.feed_map = function(map)
rhs = keymap.t(map.rhs) rhs = keymap.t(map.rhs)
end end
rhs = keymap.expression(rhs) if not map.noremap and string.find(rhs, lhs, 1, true) == 1 then
rhs = string.gsub(rhs, '^' .. vim.pesc(lhs), '')
if map.noremap then vim.api.nvim_feedkeys(keymap.expression(rhs), 'itm', true)
vim.api.nvim_feedkeys(rhs, 'itn', true) vim.api.nvim_feedkeys(lhs, 'itn', true)
else else
if string.find(rhs, lhs, 1, true) == 1 then vim.api.nvim_feedkeys(keymap.expression(rhs), 'it' .. (map.noremap and 'n' or 'm'), true)
rhs = string.gsub(rhs, '^' .. vim.pesc(lhs), '')
vim.api.nvim_feedkeys(rhs, 'itm', true)
vim.api.nvim_feedkeys(lhs, 'itn', true)
else
vim.api.nvim_feedkeys(rhs, 'itm', true)
end
end end
end end