mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
feat(copilot): added an extra to enable copilot. {import = "lazyvim.plugins.extras.coding.copilot"}
This commit is contained in:
parent
3a52307505
commit
368c65e14b
1 changed files with 41 additions and 0 deletions
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,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue