From da77adfa6059cc691c29f95e443f2fd3ce3b1b08 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:20:58 +0200 Subject: [PATCH] fix(ai): mappings for accept when `ai_cmp=false` --- lua/lazyvim/plugins/extras/ai/codeium.lua | 16 ++++++++-------- lua/lazyvim/plugins/extras/ai/copilot.lua | 4 +--- lua/lazyvim/plugins/extras/ai/supermaven.lua | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua index 8d37d750..a53f503d 100644 --- a/lua/lazyvim/plugins/extras/ai/codeium.lua +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -11,9 +11,7 @@ return { virtual_text = { enabled = not vim.g.ai_cmp, key_bindings = { - accept = false, -- handled by nvim-cmp / blink.cmp - next = "", - prev = "", + accept = not vim.g.ai_cmp and "" or false, -- handled by nvim-cmp / blink.cmp }, }, }, @@ -39,11 +37,13 @@ return { optional = true, dependencies = { "codeium.nvim" }, opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "codeium", - group_index = 1, - priority = 100, - }) + if vim.g.ai_cmp then + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) + end end, }, diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 4651c689..98f11997 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -11,9 +11,7 @@ return { enabled = not vim.g.ai_cmp, auto_trigger = true, keymap = { - accept = false, -- handled by nvim-cmp / blink.cmp - next = "", - prev = "", + accept = not vim.g.ai_cmp and "" or false, -- handled by nvim-cmp / blink.cmp }, }, panel = { enabled = false }, diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua index 5d30f49c..88865ffa 100644 --- a/lua/lazyvim/plugins/extras/ai/supermaven.lua +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -8,7 +8,7 @@ return { }, opts = { keymaps = { - accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp + accept_suggestion = not vim.g.ai_cmp and "" or nil, -- handled by nvim-cmp / blink.cmp }, disable_inline_completion = vim.g.ai_cmp, ignore_filetypes = { "bigfile", "snacks_input", "snacks_notif" },