mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
## Description blink.cmp integration for codeium and copilot, and correct menu drawing for codeium, copilot, and supermaven. I've simplified the blink.cmp config a bit for these extras (especially for copilot, which was extremely nested) by only including the blink.cmp spec if vim.g.ai_cmp is true. Multiple AI extras can now be enabled at the same time with blink.cmp. blink.cmp ghost text is now always enabled. Although some ai plugins always display virtual text, at worst it overlaps with blink's ghost text and is not noticable. Lastly, I can't test copilot because I don't have a subscription, nor do I want to sign up for one, but it should work just as well as the others. ## Screenshots With Codeium:  Multiple extras enabled at the same time:  ## Checklist - [X] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
116 lines
2.9 KiB
Lua
116 lines
2.9 KiB
Lua
return {
|
|
recommended = true,
|
|
-- copilot
|
|
{
|
|
"zbirenbaum/copilot.lua",
|
|
cmd = "Copilot",
|
|
build = ":Copilot auth",
|
|
event = "InsertEnter",
|
|
opts = {
|
|
suggestion = {
|
|
enabled = not vim.g.ai_cmp,
|
|
auto_trigger = true,
|
|
keymap = {
|
|
accept = false, -- handled by nvim-cmp / blink.cmp
|
|
next = "<M-]>",
|
|
prev = "<M-[>",
|
|
},
|
|
},
|
|
panel = { enabled = false },
|
|
filetypes = {
|
|
markdown = true,
|
|
help = true,
|
|
},
|
|
},
|
|
},
|
|
|
|
-- add ai_accept action
|
|
{
|
|
"zbirenbaum/copilot.lua",
|
|
opts = function()
|
|
LazyVim.cmp.actions.ai_accept = function()
|
|
if require("copilot.suggestion").is_visible() then
|
|
LazyVim.create_undo()
|
|
require("copilot.suggestion").accept()
|
|
return true
|
|
end
|
|
end
|
|
end,
|
|
},
|
|
|
|
-- lualine
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
optional = true,
|
|
event = "VeryLazy",
|
|
opts = function(_, opts)
|
|
table.insert(
|
|
opts.sections.lualine_x,
|
|
2,
|
|
LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function()
|
|
local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {}
|
|
if #clients > 0 then
|
|
local status = require("copilot.api").status.data.status
|
|
return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok"
|
|
end
|
|
end)
|
|
)
|
|
end,
|
|
},
|
|
|
|
-- copilot cmp source
|
|
{
|
|
"nvim-cmp",
|
|
optional = true,
|
|
dependencies = { -- this will only be evaluated if nvim-cmp is enabled
|
|
{
|
|
"zbirenbaum/copilot-cmp",
|
|
enabled = vim.g.ai_cmp, -- only enable if wanted
|
|
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
|
|
LazyVim.lsp.on_attach(function()
|
|
copilot_cmp._on_insert_enter({})
|
|
end, "copilot")
|
|
end,
|
|
specs = {
|
|
{
|
|
"nvim-cmp",
|
|
optional = true,
|
|
---@param opts cmp.ConfigSchema
|
|
opts = function(_, opts)
|
|
table.insert(opts.sources, 1, {
|
|
name = "copilot",
|
|
group_index = 1,
|
|
priority = 100,
|
|
})
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
vim.g.ai_cmp and {
|
|
"saghen/blink.cmp",
|
|
optional = true,
|
|
dependencies = { "giuxtaposition/blink-cmp-copilot" },
|
|
opts = {
|
|
sources = {
|
|
completion = {
|
|
enabled_providers = { "copilot" },
|
|
},
|
|
providers = {
|
|
copilot = {
|
|
name = "copilot",
|
|
module = "blink-cmp-copilot",
|
|
kind = "Copilot",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
} or nil,
|
|
}
|