return { "olimorris/codecompanion.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "j-hui/fidget.nvim", }, opts = { strategies = { chat = { adapter = "gemini", }, inline = { adapter = "gemini", }, cmd = { adapter = "gemini", }, }, adapters = { llama3 = function() return require("codecompanion.adapters").extend("ollama", { name = "llama3", -- Give this adapter a different name to differentiate it from the default ollama adapter schema = { model = { default = "llama3.1:latest", }, num_ctx = { default = 16384, }, num_predict = { default = -1, }, }, }) end, qwen3 = function() return require("codecompanion.adapters").extend("ollama", { name = "qwen3", -- Give this adapter a different name to differentiate it from the default ollama adapter schema = { model = { default = "qwen3:1.7b", }, }, }) end, anthropic = function() return require("codecompanion.adapters").extend("anthropic", { env = { api_key = "MY_OTHER_ANTHROPIC_KEY", }, }) end, gemini = function() return require("codecompanion.adapters").extend("gemini", { env = { api_key = "AIzaSyCpXubVJ2ls6PgFjIjpIE9FDBIbGTuXt7U", }, }) end, }, }, config = function(_, opts) require("codecompanion").setup(opts) local progress = require("fidget.progress") local handles = {} local group = vim.api.nvim_create_augroup("CodeCompanionFidget", {}) vim.api.nvim_create_autocmd("User", { pattern = "CodeCompanionRequestStarted", group = group, callback = function(e) handles[e.data.id] = progress.handle.create({ title = "CodeCompanion", message = "Thinking...", lsp_client = { name = e.data.adapter.formatted_name }, }) end, }) vim.api.nvim_create_autocmd("User", { pattern = "CodeCompanionRequestFinished", group = group, callback = function(e) local h = handles[e.data.id] if h then h.message = e.data.status == "success" and "Done" or "Failed" h:finish() handles[e.data.id] = nil end end, }) end, }