diff --git a/lua/better_escape.lua b/lua/better_escape.lua index f0f1a24..4798886 100644 --- a/lua/better_escape.lua +++ b/lua/better_escape.lua @@ -134,16 +134,42 @@ local function map_keys() vim.api.nvim_feedkeys(t(second_key), "in", false) return end - vim.api.nvim_input(undo_key[mode] or "") + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes( + undo_key[mode] or "", + true, + false, + true + ), + "n", + false + ) vim.api.nvim_input( ("setlocal %smodified"):format( bufmodified and "" or "no" ) ) if type(mapping) == "string" then - vim.api.nvim_input(mapping) + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes( + mapping, + true, + false, + true + ), + "n", + false + ) elseif type(mapping) == "function" then - vim.api.nvim_input(mapping() or "") + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes( + mapping() or "", + true, + false, + true + ), + "n", + false) end end) ::continue::