cmp: add copilot as cmp source
This commit is contained in:
parent
1b8a4094d0
commit
75a7857913
|
@ -17,10 +17,20 @@ return {
|
|||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip'
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
{ -- copilot
|
||||
'zbirenbaum/copilot.lua',
|
||||
opts = { suggestion = { enabled = false }, panel = { enabled = false } }
|
||||
},
|
||||
|
||||
config = function ()
|
||||
{ -- copilot-cmp source
|
||||
'zbirenbaum/copilot-cmp',
|
||||
opts = { clear_after_cursor = true }
|
||||
}
|
||||
},
|
||||
|
||||
config = function()
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
|
@ -34,7 +44,7 @@ return {
|
|||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs( -4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
|
@ -53,8 +63,8 @@ return {
|
|||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
elseif luasnip.jumpable( -1) then
|
||||
luasnip.jump( -1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -63,6 +73,7 @@ return {
|
|||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'copilot' },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue