feat adding copilot

This commit is contained in:
Carlos
2025-05-11 11:29:47 -04:00
parent a60fcc611b
commit 3472e86e6a
2 changed files with 76 additions and 36 deletions

View File

@@ -9,7 +9,7 @@ return {
vendors = {
cargdev = {
name = "cargdev", -- Optional
endpoint = "https://api-ai.cargdev.io/api/generate",
endpoint = "https://api-ai.cargdev.io/api/generate", -- API endpoint
api_key_name = "CARGDEV_API_KEY", -- reference the ENV VAR below
model = "codellama:7b",
__inherited_from = "ollama", -- ensures compatibility

View File

@@ -1,4 +1,6 @@
return {
{
-- Main Copilot plugin
"zbirenbaum/copilot.lua",
lazy = false, -- Load at startup
enabled = true,
@@ -38,4 +40,42 @@ return {
copilot_node_command = "node", -- Ensure your system's Node.js is v20+
})
end,
},
{
-- Copilot Chat plugin
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "github/copilot.vim" }, -- Or zbirenbaum/copilot.lua
{ "nvim-lua/plenary.nvim", branch = "master" }, -- For curl, log and async functions
},
build = "make tiktoken", -- Only on MacOS or Linux
opts = {
layout = {
position = "right", -- Position of the chat window
ratio = 0.5,
},
floating = {
enabled = true,
border = "rounded",
},
prompts = {
Rename = {
prompt = "Please rename the variable correctly in given selection based on context",
selection = function(source)
local select = require("CopilotChat.select")
return select.visual(source)
end,
},
},
keys = {
{ "<leader>zn", ":CopilotChatRename<CR>", mode = "v", desc = "Rename the variable" },
{ "<leader>zc", ":CopilotChat<CR>", mode = "n", desc = "Chat with Copilot" },
{ "<leader>ze", ":CopilotChatExplain<CR>", mode = "v", desc = "Explain Code" },
{ "<leader>zr", ":CopilotChatReview<CR>", mode = "v", desc = "Review Code" },
{ "<leader>zf", ":CopilotChatFix<CR>", mode = "v", desc = "Fix Code Issues" },
{ "<leader>zo", ":CopilotChatOptimize<CR>", mode = "v", desc = "Optimize Code" },
{ "<leader>zd", ":CopilotChatDocs<CR>", mode = "v", desc = "Generate Docs" },
},
},
},
}