my_nvim_config/after/plugin/llm.lua

51 lines
1.5 KiB
Lua
Raw Permalink Normal View History

require("codecompanion").setup({
adapters = {
llama3_2 = function()
return require("codecompanion.adapters").extend("ollama", {
name = "llama3_2", -- Give this adapter a different name to differentiate it from the default ollama adapter
schema = {
model = {
default = "llama3.2:latest",
},
},
})
end,
2025-01-08 16:26:45 -05:00
phi4 = function()
return require("codecompanion.adapters").extend("ollama", {
name = "phi4", -- Give this adapter a different name to differentiate it from the default ollama adapter
schema = {
model = {
default = "phi4:latest",
},
},
})
end,
},
strategies = {
chat = {
2025-01-08 16:26:45 -05:00
adapter= "phi4",
},
inline = {
2025-01-08 16:26:45 -05:00
adapter="phi4",
}
}
})
vim.api.nvim_set_keymap("v", "<leader>ce", "", {
callback = function()
require("codecompanion").prompt("explain")
end,
noremap = true,
silent = true,
})
vim.api.nvim_set_keymap("n", "<C-a>", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "<C-a>", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>tc", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "<leader>tc", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "ga", ":CodeCompanionChat Add<cr>", { noremap = true, silent = true })