[nvim] codecompanion plugin
This commit is contained in:
37
nvim/lua/plugins/codecompanion.lua
Normal file
37
nvim/lua/plugins/codecompanion.lua
Normal 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,
|
||||
},
|
||||
})
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user