Copilot
info
You can enable the extra with the :LazyExtras
command.
Plugins marked as optional will only be configured if they are installed.
Below you can find a list of included plugins and their default settings.
caution
You don't need to copy the default settings to your config. They are only shown here for reference.
copilot.lua
copilot
- Options
- Full Spec
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
hide_during_completion = vim.g.ai_cmp,
keymap = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = "<M-]>",
prev = "<M-[>",
},
},
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
}
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "BufReadPost",
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
hide_during_completion = vim.g.ai_cmp,
keymap = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = "<M-]>",
prev = "<M-[>",
},
},
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
}
nvim-lspconfig
copilot-language-server
- Options
- Full Spec
opts = {
servers = {
-- copilot.lua only works with its own copilot lsp server
copilot = { enabled = false },
},
}
{
"neovim/nvim-lspconfig",
opts = {
servers = {
-- copilot.lua only works with its own copilot lsp server
copilot = { enabled = false },
},
},
}
copilot.lua
add ai_accept action
- Options
- Full Spec
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
{
"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 (optional)
lualine
- Options
- Full Spec
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 vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {}
if #clients > 0 then
local status = require("copilot.status").data.status
return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok"
end
end)
)
end
{
"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 vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {}
if #clients > 0 then
local status = require("copilot.status").data.status
return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok"
end
end)
)
end,
}