Skip to content

Commit 1ad59aa

Browse files
fix: correctly handle non-blink keymaps with string rhs (#78)
1 parent 808f628 commit 1ad59aa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/blink/cmp/keymap.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ function keymap.run_non_blink_keymap(mode, key)
110110
-- https://github.com/hrsh7th/nvim-cmp/blob/ae644feb7b67bf1ce4260c231d1d4300b19c6f30/lua/cmp/utils/keymap.lua
111111
if type(mapping.callback) == 'function' then
112112
local expr = mapping.callback()
113-
if mapping.replace_keycodes then expr = vim.api.nvim_replace_termcodes(expr, true, true, true) end
114-
if mapping.expr then return expr end
113+
if mapping.replace_keycodes == 1 then expr = vim.api.nvim_replace_termcodes(expr, true, true, true) end
114+
if mapping.expr == 1 then return expr end
115115
return
116116
elseif mapping.rhs then
117-
return vim.api.nvim_eval(vim.api.nvim_replace_termcodes(mapping.rhs, true, true, true))
117+
local rhs = vim.api.nvim_replace_termcodes(mapping.rhs, true, true, true)
118+
if mapping.expr == 1 then rhs = vim.api.nvim_eval(rhs) end
119+
return rhs
118120
end
119121

120122
-- pass the key along as usual

0 commit comments

Comments
 (0)