Update code companion to use copilot claude sonnet 3.7, add support for

gemini and openai with api keys. Additionally add code companion.
Finally, add VectorCode with Code Companion which caches and gives
context of private local projects to AI for better insight.
completion in blink.
This commit is contained in:
Martin Larsson 2025-04-22 15:29:49 +02:00
parent 9b181bdf2c
commit 0db6d4183b
3 changed files with 93 additions and 14 deletions

View file

@ -1,4 +1,5 @@
{ {
"VectorCode": { "branch": "main", "commit": "caac1c8d040118c50740ab94ffbe3a4d52db583d" },
"arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" }, "arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" },
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" }, "blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
"codecompanion.nvim": { "branch": "main", "commit": "35b11dc4b292519a5c09fb2c0c0e8a8832e9e821" }, "codecompanion.nvim": { "branch": "main", "commit": "35b11dc4b292519a5c09fb2c0c0e8a8832e9e821" },
@ -12,6 +13,7 @@
"lspsaga.nvim": { "branch": "main", "commit": "501265c9b30b191ab5e5a66d104e72fb155cf3be" }, "lspsaga.nvim": { "branch": "main", "commit": "501265c9b30b191ab5e5a66d104e72fb155cf3be" },
"lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" }, "lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" },
"markview.nvim": { "branch": "main", "commit": "4f9ad36efe01c283aa886453ba75bf569c897c84" }, "markview.nvim": { "branch": "main", "commit": "4f9ad36efe01c283aa886453ba75bf569c897c84" },
"mini.diff": { "branch": "main", "commit": "7e268d0241255abaa07b8aa0ddff028f7315fe21" },
"neogit": { "branch": "master", "commit": "97f83f1dc51dee41e08e3c7a8adf00e1083e3178" }, "neogit": { "branch": "master", "commit": "97f83f1dc51dee41e08e3c7a8adf00e1083e3178" },
"neovim-ayu": { "branch": "master", "commit": "f5da37a8ddd62fc3a7b28900c4d1b807a3582584" }, "neovim-ayu": { "branch": "master", "commit": "f5da37a8ddd62fc3a7b28900c4d1b807a3582584" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
@ -26,7 +28,7 @@
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" },
"nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" }, "nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" },
"nvim-treesitter-context": { "branch": "master", "commit": "439789a9a8df9639ecd749bb3286b77117024a6f" }, "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "698b5f805722254bca3c509591c1806d268b6c2f" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "698b5f805722254bca3c509591c1806d268b6c2f" },
"nvim-web-devicons": { "branch": "master", "commit": "57dfa947cc88cdf1baa2c7e13ed31edddd8fb1d1" }, "nvim-web-devicons": { "branch": "master", "commit": "57dfa947cc88cdf1baa2c7e13ed31edddd8fb1d1" },
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" }, "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },

View file

@ -16,7 +16,10 @@ return {
-- Default list of enabled providers defined so that you can extend it -- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend` -- elsewhere in your config, without redefining it, due to `opts_extend`
sources = { sources = {
default = { "lsp", "path", "snippets", "buffer" }, default = { "lsp", "path", "snippets", "buffer", },
per_filetype = {
codecompanion = { "codecompanion", },
},
}, },
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance

View file

@ -1,25 +1,98 @@
return { return {
"olimorris/codecompanion.nvim", "olimorris/codecompanion.nvim", -- The KING of AI programming
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", {
"nvim-treesitter/nvim-treesitter", "Davidyz/VectorCode",
version = "*",
build = "pipx upgrade vectorcode",
dependencies = { "nvim-lua/plenary.nvim" },
},
"echasnovski/mini.diff",
}, },
opts = { opts = {
adapters = {
copilot = function()
return require("codecompanion.adapters").extend("copilot", {
schema = {
model = {
default = "claude-3.7-sonnet",
},
},
})
end,
gemini = function()
return require("codecompanion.adapters").extend("gemini", {
schema = {
model = {
default = "gemini-2.5-pro-exp-03-25",
},
},
})
end,
openai = function()
return require("codecompanion.adapters").extend("openai", {
opts = {
stream = true,
},
schema = {
model = {
default = function()
return "gpt-4o"
end,
},
},
})
end,
},
strategies = { strategies = {
chat = { chat = {
adapter = "copilot", adapter = "copilot",
roles = {
user = "Martin",
},
keymaps = {
send = {
modes = {
i = { "<C-CR>", "<C-s>" },
},
},
completion = {
modes = {
i = "<C-x>",
},
},
},
slash_commands = {
["buffer"] = {
opts = {
keymaps = {
modes = {
i = "<C-b>",
},
},
},
},
["help"] = {
opts = {
max_lines = 1000,
},
},
},
tools = {
vectorcode = {
description = "Run VectorCode to retrieve the project context.",
callback = function()
return require("vectorcode.integrations").codecompanion.chat.make_tool()
end,
},
},
}, },
inline = { inline = { adapter = "copilot" },
adapter = "copilot",
},
agent = {
adapter = "copilot",
},
},
adapters = {
copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end,
}, },
display = { display = {
action_palette = {
provider = "default",
},
diff = { diff = {
provider = "mini_diff", provider = "mini_diff",
}, },
@ -29,6 +102,7 @@ return {
}, },
}, },
keys = { keys = {
{ "<C-a>", "<cmd>CodeCompanionActions<cr>" },
{ "<Leader>ci", "<cmd>CodeCompanion<cr>" }, { "<Leader>ci", "<cmd>CodeCompanion<cr>" },
{ "<Leader>cc", "<cmd>CodeCompanionChat toggle<cr>" }, { "<Leader>cc", "<cmd>CodeCompanionChat toggle<cr>" },
{ "<Leader>ce", "<cmd>CodeCompanion /explain<cr>", mode = "v" }, { "<Leader>ce", "<cmd>CodeCompanion /explain<cr>", mode = "v" },