[nvim] codecompanion plugin

This commit is contained in:
Dmitry Chumak
2025-04-23 21:20:22 +03:00
parent bcba0e372a
commit 352a8c3c97
3 changed files with 48 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"codecompanion.nvim": { "branch": "main", "commit": "1b1bfc71f426a50ece54489078f5afe82b0af90c" },
"github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
"gitsigns.nvim": { "branch": "main", "commit": "011dc6718bcebdf92a5336bb0da79189c3afe621" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
@@ -10,6 +11,7 @@
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" },
"nvim-lspconfig": { "branch": "master", "commit": "fd26f8626c03b424f7140d454031d1dcb8d23513" },
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
"outline.nvim": { "branch": "main", "commit": "ae473fb51b7b6086de0876328c81a63f9c3ecfef" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },

View File

@@ -0,0 +1,37 @@
require("codecompanion").setup({
strategies = {
chat = {
adapter = "deepseek",
},
inline = {
adapter = "deepseek",
},
cmd = {
adapter = "deepseek",
}
},
adapters = {
deepseek = function()
return require("codecompanion.adapters").extend("deepseek", {
env = {
api_key = (function()
local path = os.getenv("HOME") .. "/.config/deepseek_api_key"
local file = io.open(path, "r")
if not file then
vim.notify("Deepseek API key not found at " .. path, vim.log.levels.WARN)
return nil
end
local content = file:read("*a"):gsub("%s+", "")
file:close()
return content
end)(),
},
schema = {
model = {
default = "deepseek-chat",
},
},
})
end,
},
})

View File

@@ -84,6 +84,14 @@ local plugins = {
-- Your setup opts here
},
},
{
"olimorris/codecompanion.nvim",
opts = {},
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
},
}
require("lazy").setup(plugins)
@@ -96,3 +104,4 @@ vim.cmd([[
require("plugins/telescope")
require("plugins/completions")
require("plugins/gitsigns")
require("plugins/codecompanion")