mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
92 lines
2.4 KiB
Lua
92 lines
2.4 KiB
Lua
|
return {
|
||
|
{
|
||
|
"CopilotC-Nvim/CopilotChat.nvim",
|
||
|
branch = "canary",
|
||
|
cmd = "CopilotChat",
|
||
|
opts = {
|
||
|
model = "gpt-4",
|
||
|
auto_insert_mode = true,
|
||
|
window = {
|
||
|
width = 0.4,
|
||
|
},
|
||
|
selection = function(source)
|
||
|
local select = require("CopilotChat.select")
|
||
|
return select.visual(source) or select.buffer(source)
|
||
|
end,
|
||
|
},
|
||
|
keys = {
|
||
|
{
|
||
|
"<leader>aa",
|
||
|
function()
|
||
|
return require("CopilotChat").toggle()
|
||
|
end,
|
||
|
desc = "Toggle (CopilotChat)",
|
||
|
},
|
||
|
{
|
||
|
"<leader>ax",
|
||
|
function()
|
||
|
return require("CopilotChat").clear()
|
||
|
end,
|
||
|
desc = "Clear (CopilotChat)",
|
||
|
},
|
||
|
{
|
||
|
"<leader>aq",
|
||
|
function()
|
||
|
local input = vim.fn.input("Quick Chat: ")
|
||
|
if input ~= "" then
|
||
|
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
|
||
|
end
|
||
|
end,
|
||
|
desc = "Quick Chat (CopilotChat)",
|
||
|
},
|
||
|
},
|
||
|
init = function()
|
||
|
LazyVim.on_load("which-key.nvim", function()
|
||
|
vim.schedule(function()
|
||
|
require("which-key").register({ a = { name = "+CopilotChat (AI)" } }, { prefix = "<leader>" })
|
||
|
end)
|
||
|
end)
|
||
|
end,
|
||
|
config = function(_, opts)
|
||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||
|
pattern = "copilot-chat",
|
||
|
callback = function()
|
||
|
vim.opt_local.relativenumber = false
|
||
|
vim.opt_local.number = false
|
||
|
end,
|
||
|
})
|
||
|
require("CopilotChat").setup(opts)
|
||
|
end,
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"nvim-telescope/telescope.nvim",
|
||
|
optional = true,
|
||
|
keys = {
|
||
|
-- Show help actions with telescope
|
||
|
{
|
||
|
"<leader>ad",
|
||
|
function()
|
||
|
local actions = require("CopilotChat.actions")
|
||
|
local help = actions.help_actions()
|
||
|
if not help then
|
||
|
LazyVim.warn("No diagnostics found on the current line")
|
||
|
return
|
||
|
end
|
||
|
require("CopilotChat.integrations.telescope").pick(help)
|
||
|
end,
|
||
|
desc = "Diagnostic Help (CopilotChat)",
|
||
|
},
|
||
|
-- Show prompts actions with telescope
|
||
|
{
|
||
|
"<leader>ap",
|
||
|
function()
|
||
|
local actions = require("CopilotChat.actions")
|
||
|
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
|
||
|
end,
|
||
|
desc = "Prompt Actions (CopilotChat)",
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
}
|