From c23d810a665a1ab341aa8ed2abd82fb9b3bcafac Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Mon, 17 Jan 2022 19:20:09 +0900 Subject: [PATCH] Fix #746 --- lua/cmp/utils/keymap.lua | 5 +++-- lua/cmp/utils/keymap_spec.lua | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/cmp/utils/keymap.lua b/lua/cmp/utils/keymap.lua index 9171d64..8c06566 100644 --- a/lua/cmp/utils/keymap.lua +++ b/lua/cmp/utils/keymap.lua @@ -156,16 +156,17 @@ keymap.evacuate = setmetatable({ silent = mode ~= 'c', nowait = map.nowait, }) - elseif mode ~= 'c' then + elseif mode ~= 'c' or not map.callback then local rhs = map.rhs if not map.noremap then rhs = keymap.recursive(map.lhs, rhs) end keymap.set_map(bufnr, mode, fallback, rhs, { expr = false, + callback = map.callback, noremap = map.noremap, script = map.script, - silent = mode ~= 'c', + silent = mode ~= 'c' and map.silent, nowait = map.nowait, }) else diff --git a/lua/cmp/utils/keymap_spec.lua b/lua/cmp/utils/keymap_spec.lua index 18cc8f5..561b851 100644 --- a/lua/cmp/utils/keymap_spec.lua +++ b/lua/cmp/utils/keymap_spec.lua @@ -15,6 +15,7 @@ describe('keymap', function() '', '', '', + '', '(example)', '="abc"', 'normal! ==',