mirror of
https://github.com/zebrajr/dotfiles.git
synced 2025-12-06 00:20:05 +01:00
add codecompanion with inline via openai + chat via ollama
This commit is contained in:
parent
6fd8d8847b
commit
9f7550464b
2
config/nvim/.gitignore
vendored
Normal file
2
config/nvim/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# secrets for nvim
|
||||
lua/secrets/*.lua
|
||||
61
config/nvim/lua/plugins/codecompanion.lua
Normal file
61
config/nvim/lua/plugins/codecompanion.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
local secrets = require('secrets.codecompanion')
|
||||
|
||||
return {
|
||||
"olimorris/codecompanion.nvim",
|
||||
opts = {
|
||||
strategies = {
|
||||
-- Change Default Adapter
|
||||
chat = {
|
||||
adapter = "ollama",
|
||||
},
|
||||
inline = {
|
||||
adapter = "openai_41mini",
|
||||
keymaps = {
|
||||
accept_change = {
|
||||
modes = { n = "ga" },
|
||||
description = "Accept the suggested change",
|
||||
},
|
||||
reject_change = {
|
||||
modes = { n = "gr" },
|
||||
description = "Reject the suggested change",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
adapters = {
|
||||
openai_41mini = function()
|
||||
return require("codecompanion.adapters").extend("openai", {
|
||||
name = "openai_41mini",
|
||||
schema = {
|
||||
model = {
|
||||
default = "gpt-4.1-mini"
|
||||
}
|
||||
},
|
||||
env = {
|
||||
api_key = secrets.openai_api_key
|
||||
}
|
||||
})
|
||||
end,
|
||||
ollama = function()
|
||||
return require("codecompanion.adapters").extend("ollama", {
|
||||
name = "local_llama3.2",
|
||||
schema = {
|
||||
model = {
|
||||
default = "llama3.2:3b"
|
||||
},
|
||||
num_ctx = {
|
||||
default = 16384,
|
||||
},
|
||||
num_predict = {
|
||||
default = -1,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
}
|
||||
3
config/nvim/lua/secrets/codecompanion.lua.sample
Normal file
3
config/nvim/lua/secrets/codecompanion.lua.sample
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
openai_api_key = "your_own_api_key"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user