diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 706473f4..d99c3d29 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -80,10 +80,6 @@ return { keymap = { preset = "enter", [""] = { "select_and_accept" }, - [""] = { - LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), - "fallback", - }, }, }, ---@param opts blink.cmp.Config | { sources: { compat: string[] } } @@ -101,19 +97,26 @@ return { end end - -- fix super-tab completion - if opts.keymap.preset == "super-tab" then - opts.keymap[""] = { - function(cmp) - if cmp.snippet_active() then - return cmp.accept() - else - return cmp.select_and_accept() - end - end, - LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), - "fallback", - } + -- add ai_accept to key + if not opts.keymap[""] then + if opts.keymap.preset == "super-tab" then -- super-tab + opts.keymap[""] = { + function(cmp) + if cmp.snippet_active() then + return cmp.accept() + else + return cmp.select_and_accept() + end + end, + LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), + "fallback", + } + else -- other presets + opts.keymap[""] = { + LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), + "fallback", + } + end end --- NOTE: compat with latest version. Currenlty 0.7.6