From 43cf9829ce0dbd9b54eefc2f3d8457f768ec0b67 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 10 Oct 2024 12:56:23 -0400 Subject: [PATCH] fix: correctly handle non-blink keymaps with string rhs --- lua/blink/cmp/keymap.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/blink/cmp/keymap.lua b/lua/blink/cmp/keymap.lua index f3b98b65..bd7c34a5 100644 --- a/lua/blink/cmp/keymap.lua +++ b/lua/blink/cmp/keymap.lua @@ -110,11 +110,13 @@ function keymap.run_non_blink_keymap(mode, key) -- https://github.com/hrsh7th/nvim-cmp/blob/ae644feb7b67bf1ce4260c231d1d4300b19c6f30/lua/cmp/utils/keymap.lua if type(mapping.callback) == 'function' then local expr = mapping.callback() - if mapping.replace_keycodes then expr = vim.api.nvim_replace_termcodes(expr, true, true, true) end - if mapping.expr then return expr end + if mapping.replace_keycodes == 1 then expr = vim.api.nvim_replace_termcodes(expr, true, true, true) end + if mapping.expr == 1 then return expr end return elseif mapping.rhs then - return vim.api.nvim_eval(vim.api.nvim_replace_termcodes(mapping.rhs, true, true, true)) + local rhs = vim.api.nvim_replace_termcodes(mapping.rhs, true, true, true) + if mapping.expr == 1 then rhs = vim.api.nvim_eval(rhs) end + return rhs end -- pass the key along as usual