mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
- Instead of using picker integrations (that are now deprecated), switch to using CopilotChat.select_prompt() that is using `vim.ui.select` which brings the selector integration responsibility to pickers instead of plugin - Use vim.ui.input instead of vim.fn.input for consistency Reason why this was deprecated in CopilotChat.nvim (by me) and will be removed in future is because these integrations never made any sense anyway when `vim.ui.select` overrides exist. ## Screenshots Using fzf-lua in my config, outside of LazyNvim but same thing applies:  ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
88 lines
2.1 KiB
Lua
88 lines
2.1 KiB
Lua
return {
|
|
{
|
|
"CopilotC-Nvim/CopilotChat.nvim",
|
|
branch = "main",
|
|
cmd = "CopilotChat",
|
|
opts = function()
|
|
local user = vim.env.USER or "User"
|
|
user = user:sub(1, 1):upper() .. user:sub(2)
|
|
return {
|
|
auto_insert_mode = true,
|
|
question_header = " " .. user .. " ",
|
|
answer_header = " Copilot ",
|
|
window = {
|
|
width = 0.4,
|
|
},
|
|
}
|
|
end,
|
|
keys = {
|
|
{ "<c-s>", "<CR>", ft = "copilot-chat", desc = "Submit Prompt", remap = true },
|
|
{ "<leader>a", "", desc = "+ai", mode = { "n", "v" } },
|
|
{
|
|
"<leader>aa",
|
|
function()
|
|
return require("CopilotChat").toggle()
|
|
end,
|
|
desc = "Toggle (CopilotChat)",
|
|
mode = { "n", "v" },
|
|
},
|
|
{
|
|
"<leader>ax",
|
|
function()
|
|
return require("CopilotChat").reset()
|
|
end,
|
|
desc = "Clear (CopilotChat)",
|
|
mode = { "n", "v" },
|
|
},
|
|
{
|
|
"<leader>aq",
|
|
function()
|
|
vim.ui.input({
|
|
prompt = "Quick Chat: ",
|
|
}, function(input)
|
|
if input ~= "" then
|
|
require("CopilotChat").ask(input)
|
|
end
|
|
end)
|
|
end,
|
|
desc = "Quick Chat (CopilotChat)",
|
|
mode = { "n", "v" },
|
|
},
|
|
{
|
|
"<leader>ap",
|
|
function()
|
|
require("CopilotChat").select_prompt()
|
|
end,
|
|
desc = "Prompt Actions (CopilotChat)",
|
|
mode = { "n", "v" },
|
|
},
|
|
},
|
|
config = function(_, opts)
|
|
local chat = require("CopilotChat")
|
|
|
|
vim.api.nvim_create_autocmd("BufEnter", {
|
|
pattern = "copilot-chat",
|
|
callback = function()
|
|
vim.opt_local.relativenumber = false
|
|
vim.opt_local.number = false
|
|
end,
|
|
})
|
|
|
|
chat.setup(opts)
|
|
end,
|
|
},
|
|
|
|
-- Edgy integration
|
|
{
|
|
"folke/edgy.nvim",
|
|
optional = true,
|
|
opts = function(_, opts)
|
|
opts.right = opts.right or {}
|
|
table.insert(opts.right, {
|
|
ft = "copilot-chat",
|
|
title = "Copilot Chat",
|
|
size = { width = 50 },
|
|
})
|
|
end,
|
|
},
|
|
}
|