Skip to content

Commit 1a55fd1

Browse files
fix: schedule non-expr fallback keymaps (#196)
* fix(keymaps): conflicts fix(keymaps): conflicting with other runtime keymaps * fix: schedule non-expr fallback keymaps --------- Co-authored-by: Liam Dyer <[email protected]>
1 parent 6290abd commit 1a55fd1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/blink/cmp/keymap.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,16 @@ function keymap.run_non_blink_keymap(mode, key)
117117
-- and is quite complex. we should look to see if we can simplify their logic
118118
-- https://github.com/hrsh7th/nvim-cmp/blob/ae644feb7b67bf1ce4260c231d1d4300b19c6f30/lua/cmp/utils/keymap.lua
119119
if type(mapping.callback) == 'function' then
120+
-- with expr = true, which we use, we can't modify the buffer without scheduling
121+
-- so if the keymap does not use expr, we must schedule it
122+
if mapping.expr ~= 1 then
123+
vim.schedule(mapping.callback)
124+
return
125+
end
126+
120127
local expr = mapping.callback()
121128
if mapping.replace_keycodes == 1 then expr = vim.api.nvim_replace_termcodes(expr, true, true, true) end
122-
if mapping.expr == 1 then return expr end
123-
return
129+
return expr
124130
elseif mapping.rhs then
125131
local rhs = vim.api.nvim_replace_termcodes(mapping.rhs, true, true, true)
126132
if mapping.expr == 1 then rhs = vim.api.nvim_eval(rhs) end

0 commit comments

Comments
 (0)