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 = { vendors = {
cargdev = { cargdev = {
name = "cargdev", -- Optional 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 api_key_name = "CARGDEV_API_KEY", -- reference the ENV VAR below
model = "codellama:7b", model = "codellama:7b",
__inherited_from = "ollama", -- ensures compatibility __inherited_from = "ollama", -- ensures compatibility

View File

@@ -1,41 +1,81 @@
return { return {
"zbirenbaum/copilot.lua", {
lazy = false, -- Load at startup -- Main Copilot plugin
enabled = true, "zbirenbaum/copilot.lua",
config = function() lazy = false, -- Load at startup
require("copilot").setup({ enabled = true,
panel = { config = function()
require("copilot").setup({
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>",
},
layout = {
position = "bottom", -- | top | left | right | horizontal | vertical
ratio = 0.4,
},
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
trigger_on_accept = true,
keymap = {
accept = "<C-l>", -- Accept suggestion
next = "<C-j>", -- Next suggestion
prev = "<C-k>", -- Previous suggestion
dismiss = "<C-x>", -- Dismiss suggestion
},
},
filetypes = {
markdown = true,
["*"] = true, -- Enable for all filetypes
},
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, enabled = true,
auto_refresh = false, border = "rounded",
keymap = { },
jump_prev = "[[", prompts = {
jump_next = "]]", Rename = {
accept = "<CR>", prompt = "Please rename the variable correctly in given selection based on context",
refresh = "gr", selection = function(source)
open = "<M-CR>", local select = require("CopilotChat.select")
}, return select.visual(source)
layout = { end,
position = "bottom", -- | top | left | right | horizontal | vertical
ratio = 0.4,
}, },
}, },
suggestion = { keys = {
enabled = true, { "<leader>zn", ":CopilotChatRename<CR>", mode = "v", desc = "Rename the variable" },
auto_trigger = true, { "<leader>zc", ":CopilotChat<CR>", mode = "n", desc = "Chat with Copilot" },
debounce = 75, { "<leader>ze", ":CopilotChatExplain<CR>", mode = "v", desc = "Explain Code" },
trigger_on_accept = true, { "<leader>zr", ":CopilotChatReview<CR>", mode = "v", desc = "Review Code" },
keymap = { { "<leader>zf", ":CopilotChatFix<CR>", mode = "v", desc = "Fix Code Issues" },
accept = "<C-l>", -- Accept suggestion { "<leader>zo", ":CopilotChatOptimize<CR>", mode = "v", desc = "Optimize Code" },
next = "<C-j>", -- Next suggestion { "<leader>zd", ":CopilotChatDocs<CR>", mode = "v", desc = "Generate Docs" },
prev = "<C-k>", -- Previous suggestion
dismiss = "<C-x>", -- Dismiss suggestion
},
}, },
filetypes = { },
markdown = true, },
["*"] = true, -- Enable for all filetypes
},
copilot_node_command = "node", -- Ensure your system's Node.js is v20+
})
end,
} }