From c734d941b47312baafe3e0429a5fecd25da95f5f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 8 Feb 2023 16:00:56 +0100 Subject: [PATCH] fix(keys): feed keys instead of returning expr for Neovim 0.8.x. Fixes #511 --- lua/lazy/core/handler/keys.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/lazy/core/handler/keys.lua b/lua/lazy/core/handler/keys.lua index f398127..8285240 100644 --- a/lua/lazy/core/handler/keys.lua +++ b/lua/lazy/core/handler/keys.lua @@ -63,9 +63,6 @@ end function M:_add(keys) local lhs = keys[1] local opts = M.opts(keys) - opts.remap = true - opts.expr = true - opts.replace_keycodes = false vim.keymap.set(keys.mode, lhs, function() local plugins = self.active[keys.id] @@ -76,8 +73,15 @@ function M:_add(keys) Util.track({ keys = lhs }) Loader.load(plugins, { keys = lhs }) Util.track() - return vim.api.nvim_replace_termcodes("" .. lhs, false, true, true) - end, opts) + + local feed = vim.api.nvim_replace_termcodes("" .. lhs, true, true, true) + -- insert instead of append the lhs + vim.api.nvim_feedkeys(feed, "i", false) + end, { + desc = opts.desc, + -- we do not return anything, but this is still needed to make operator pending mappings work + expr = true, + }) end ---@param keys LazyKeys