configure copilot
This commit is contained in:
parent
9a81bc88cf
commit
c47afa2471
4 changed files with 43 additions and 10 deletions
|
|
@ -6,6 +6,7 @@ return {
|
|||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"zbirenbaum/copilot-cmp", -- Copilot completion source
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
|
|
@ -19,17 +20,18 @@ return {
|
|||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Auto-select first item
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
{ name = "copilot", group_index = 2 }, -- Copilot suggestions (priority 1)
|
||||
{ name = "nvim_lsp", group_index = 2 },
|
||||
{ name = "path", group_index = 2 },
|
||||
{ name = "buffer", group_index = 2 },
|
||||
}),
|
||||
completion = { completeopt = "menu,menuone,noselect" },
|
||||
completion = { completeopt = "menu,menuone,noinsert" }, -- Auto-select first item
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
|
|
|
|||
22
lua/plugins/copilot.lua
Normal file
22
lua/plugins/copilot.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- GitHub Copilot: AI-powered code completion
|
||||
return {
|
||||
{
|
||||
'zbirenbaum/copilot.lua',
|
||||
cmd = 'Copilot',
|
||||
event = 'InsertEnter', -- Lazy load on first insert mode entry
|
||||
opts = {
|
||||
suggestion = { enabled = false }, -- Disable inline suggestions (use cmp instead)
|
||||
panel = { enabled = false }, -- Disable panel (use cmp instead)
|
||||
filetypes = {
|
||||
['*'] = true, -- Enable for all filetypes
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'zbirenbaum/copilot-cmp',
|
||||
dependencies = { 'zbirenbaum/copilot.lua' },
|
||||
config = function()
|
||||
require('copilot_cmp').setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue