add copilot chat

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-11-12 10:28:18 -06:00
parent 31244ea8a8
commit ec01d807a0
3 changed files with 90 additions and 0 deletions

View file

@ -26,6 +26,74 @@ return {
main = "copilot",
},
{ "zbirenbaum/copilot-cmp", opts = {}, main = "copilot_cmp" },
{
"CopilotC-Nvim/CopilotChat.nvim",
branch = "canary",
dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
},
opts = {
-- debug = true, -- Enable debugging
-- See Configuration section for rest
mappings = {
complete = {
insert = "",
},
},
window = {
layout = "float",
relative = "cursor",
width = 1,
height = 0.4,
row = 1,
},
},
keys = {
-- Show help actions with telescope
{
"<leader><leader>h",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.help_actions())
end,
desc = "CopilotChat - Help actions",
mode = { "n", "v", "x" },
},
-- Show prompts actions with telescope
{
"<leader><leader>p",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
end,
desc = "CopilotChat - Prompt actions",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>q",
function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
end
end,
desc = "CopilotChat - Quick chat",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>c",
function()
require("CopilotChat").toggle()
end,
desc = "CopilotChat - Toggle",
mode = { "n", "v", "x" },
},
},
-- See Commands section for default commands if you want to lazy load on them
},
},
config = function()
-- See `:help cmp`
@ -104,5 +172,7 @@ return {
{ name = "crates" },
},
})
require("CopilotChat.integrations.cmp").setup()
end,
}