init.lua/lua/plugins/copilot.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
local enabled = true
---@type LazySpec
return {
{
"zbirenbaum/copilot.lua",
enabled = enabled,
cmd = "Copilot",
build = ":Copilot auth",
opts = {
suggestion = { enabled = false },
panel = {
enabled = false,
auto_refresh = true,
keymap = { refresh = "<C-r>" },
layout = {
position = "right",
ratio = 0.3,
},
},
filetypes = {
yaml = true,
TelescopePrompt = false,
org = false,
ledger = false,
["."] = false,
},
},
},
{
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = { "copilot.lua" },
enabled = enabled,
version = false,
cmd = { "CopilotChat" },
build = "make tiktoken",
keys = {
{ "<leader>C", ":CopilotChat ", mode = { "n", "v" } },
},
---@module "CopilotChat"
---@type CopilotChat.config
opts = {
auto_insert_mode = true,
mappings = {
---@diagnostic disable-next-line: missing-fields
reset = {
insert = "<C-r>",
normal = "<C-r>",
},
---@diagnostic disable-next-line: missing-fields
submit_prompt = {
insert = "<C-CR>",
},
---@diagnostic disable-next-line: missing-fields
show_help = { normal = "?" },
},
},
},
{
"zbirenbaum/copilot-cmp",
enabled = enabled,
config = true,
dependencies = {
"copilot.lua",
{
"nvim-cmp",
---@module "cmp"
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "copilot",
group_index = 0,
max_item_count = 3,
})
end,
},
},
},
}
|