Skip to content

Commit

Permalink
fix: correctly handle non-blink keymaps with string rhs (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-elias-alvarez authored Oct 10, 2024
1 parent 808f628 commit 1ad59aa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/blink/cmp/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ad59aa

Please sign in to comment.