feat: add conditional support for Neocodeium plugin based on config

This commit is contained in:
2024-09-13 09:19:14 -04:00
parent 56834c33c5
commit 00a9ad0c8c
2 changed files with 56 additions and 24 deletions
+25 -14
View File
@@ -6,33 +6,44 @@
local data = require("data")
return {
{ --
-- Neocodeium
{ -- Neocodeium
"monkoose/neocodeium",
event = "VeryLazy",
opts = data.types.neocodeium.opts,
keys = data.keys.neocodeium,
enabled = data.cond.neocodeium,
},
{ -- Codeium
import = "lazyvim.plugins.extras.coding.codeium",
cond = data.cond.codeium,
},
{ -- Copilot
import = "lazyvim.plugins.extras.coding.copilot",
cond = function()
return vim.g.aitool == "copilot"
end,
cond = data.cond.copilot,
},
{ -- Tabnine
import = "lazyvim.plugins.extras.coding.tabnine",
cond = function()
return vim.g.aitool == "tabnine"
end,
cond = data.cond.tabnine,
},
{ -- Minuet-AI
"milanglacier/minuet-ai.nvim",
dependencies = data.deps.minuet,
config = function()
require("minuet").setup({ provider = "openai" })
end,
cond = function()
return vim.g.aitool == "minuet"
end,
opts = { provider = "openai" },
enabled = data.cond.minuet,
},
-- {
-- "jackMort/ChatGPT.nvim",
-- event = "VeryLazy",
-- opts = {},
-- dependencies = {
-- "MunifTanjim/nui.nvim",
-- "nvim-lua/plenary.nvim",
-- "folke/trouble.nvim",
-- "nvim-telescope/telescope.nvim",
-- },
-- },
{
"robitx/gp.nvim",
opts = {},
},
}
+31 -10
View File
@@ -4,27 +4,48 @@
-- │ Auto Completion │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
local perf = vim.g.cmp_performance_enabled or false
return { --
"hrsh7th/nvim-cmp",
-- HACK: Experiemental cmp performance fork
dev = true,
--- Function to return the cmp provider
---@param performance? boolean Whether to use the experimental cmp performance fork
---@return table provider The cmp provider spec
local function cmp_provider(performance)
if performance then
return {
url = "yioneko/nvim-cmp",
-- Experiemental cmp performance fork
dev = true,
build = "git clone https://github.com/yioneko/nvim-cmp.git ~/projects/nvim-cmp/",
}
end
return {
-- Classic cmp
url = "hrsh7th/nvim-cmp",
dev = false,
}
end
return { -- cmp
cmp_provider(perf).url,
build = cmp_provider(perf).build,
dev = cmp_provider(perf).dev,
event = "VeryLazy",
dependencies = data.deps.cmp,
-- :
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local neocodeium = require("neocodeium")
local commands = require("neocodeium.commands")
cmp.event:on("menu_opened", function()
neocodeium.clear()
if data.cond.neocodeium() == true then
require("neocodeium").clear()
end
end)
cmp.event:on("menu_closed", function()
commands.enable()
neocodeium.cycle_or_complete()
if data.cond.neocodeium() == true then
require("neocodeium.commands").enable()
require("neocodeium").cycle_or_complete()
end
end)
local border_opts = {