Notice I said .lua
, I'm not talking about github/copilot.vim.
Disclaimer: I do not have access to copilot. I'm just repeating the instructions from the plugin zbirenbaum/copilot-cmp.
These are the step you should follow.
-
Install the plugins zbirenbaum/copilot.lua and zbirenbaum/copilot-cmp.
-
Call the setup function for copilot.lua.
require('copilot').setup({
suggestion = {enabled = false},
panel = {enabled = false},
})
require('copilot_cmp').setup()
-
Once copilot started, run the command
:Copilot auth
to start the authentication process. -
Add the source in nvim-cmp
local cmp = require('cmp')
cmp.setup({
sources = {
{name = 'copilot'},
{name = 'nvim_lsp'},
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({
-- documentation says this is important.
-- I don't know why.
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
})
})