feat(copilot): added an extra to enable copilot. {import = "lazyvim.plugins.extras.coding.copilot"}
This commit is contained in:
41
lua/lazyvim/plugins/extras/coding/copilot.lua
Normal file
41
lua/lazyvim/plugins/extras/coding/copilot.lua
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
-- copilot
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
cmd = "Copilot",
|
||||||
|
build = ":Copilot auth",
|
||||||
|
opts = {
|
||||||
|
suggestion = { enabled = false },
|
||||||
|
panel = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- copilot cmp source
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot-cmp",
|
||||||
|
dependencies = "copilot.lua",
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
local copilot_cmp = require("copilot_cmp")
|
||||||
|
copilot_cmp.setup(opts)
|
||||||
|
-- attach cmp source whenever copilot attaches
|
||||||
|
-- fixes lazy-loading issues with the copilot cmp source
|
||||||
|
require("lazyvim.util").on_attach(function(client)
|
||||||
|
if client.name == "copilot" then
|
||||||
|
copilot_cmp._on_insert_enter()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
local cmp = require("cmp")
|
||||||
|
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "copilot" } }))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
Reference in New Issue
Block a user