kickstart.nvim/lua/custom/plugins/copilot.lua

36 lines
968 B
Lua

return {
{
-- Taken from https://github.com/fredrikaverpil/dotfiles/blob/main/nvim-lazyvim/lua/plugins/ai.lua
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "InsertEnter",
config = function()
require("copilot").setup({
panel = {
enabled = true,
auto_refresh = true,
},
suggestion = {
enabled = true,
auto_trigger = true,
accept = false, -- disable built-in keymapping
},
})
-- hide copilot suggestions when cmp menu is open
-- to prevent odd behavior/garbled up suggestions
local cmp_status_ok, cmp = pcall(require, "cmp")
if cmp_status_ok then
cmp.event:on("menu_opened", function()
vim.b.copilot_suggestion_hidden = true
end)
cmp.event:on("menu_closed", function()
vim.b.copilot_suggestion_hidden = false
end)
end
end,
},
}