mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 09:18:51 +02:00
feat(copilot-chat): make keymaps work in visual mode
This commit is contained in:
parent
54d7cea305
commit
2695fc7dfc
1 changed files with 24 additions and 2 deletions
|
@ -6,6 +6,7 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
model = "gpt-4",
|
model = "gpt-4",
|
||||||
auto_insert_mode = true,
|
auto_insert_mode = true,
|
||||||
|
show_help = true,
|
||||||
window = {
|
window = {
|
||||||
width = 0.4,
|
width = 0.4,
|
||||||
},
|
},
|
||||||
|
@ -21,6 +22,7 @@ return {
|
||||||
return require("CopilotChat").toggle()
|
return require("CopilotChat").toggle()
|
||||||
end,
|
end,
|
||||||
desc = "Toggle (CopilotChat)",
|
desc = "Toggle (CopilotChat)",
|
||||||
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>ax",
|
"<leader>ax",
|
||||||
|
@ -28,16 +30,18 @@ return {
|
||||||
return require("CopilotChat").clear()
|
return require("CopilotChat").clear()
|
||||||
end,
|
end,
|
||||||
desc = "Clear (CopilotChat)",
|
desc = "Clear (CopilotChat)",
|
||||||
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>aq",
|
"<leader>aq",
|
||||||
function()
|
function()
|
||||||
local input = vim.fn.input("Quick Chat: ")
|
local input = vim.fn.input("Quick Chat: ")
|
||||||
if input ~= "" then
|
if input ~= "" then
|
||||||
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
|
require("CopilotChat").ask(input)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = "Quick Chat (CopilotChat)",
|
desc = "Quick Chat (CopilotChat)",
|
||||||
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
|
@ -48,6 +52,7 @@ return {
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
local chat = require("CopilotChat")
|
||||||
vim.api.nvim_create_autocmd("BufEnter", {
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
pattern = "copilot-chat",
|
pattern = "copilot-chat",
|
||||||
callback = function()
|
callback = function()
|
||||||
|
@ -55,10 +60,11 @@ return {
|
||||||
vim.opt_local.number = false
|
vim.opt_local.number = false
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
require("CopilotChat").setup(opts)
|
chat.setup(opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Telescope integration
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
@ -76,6 +82,7 @@ return {
|
||||||
require("CopilotChat.integrations.telescope").pick(help)
|
require("CopilotChat.integrations.telescope").pick(help)
|
||||||
end,
|
end,
|
||||||
desc = "Diagnostic Help (CopilotChat)",
|
desc = "Diagnostic Help (CopilotChat)",
|
||||||
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
-- Show prompts actions with telescope
|
-- Show prompts actions with telescope
|
||||||
{
|
{
|
||||||
|
@ -85,7 +92,22 @@ return {
|
||||||
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
|
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
|
||||||
end,
|
end,
|
||||||
desc = "Prompt Actions (CopilotChat)",
|
desc = "Prompt Actions (CopilotChat)",
|
||||||
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- 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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue