remove double initialization of copilot

This commit is contained in:
Alexander Gehrke 2023-06-20 11:50:02 +02:00
parent 9605898edd
commit 94394fd3b4
3 changed files with 75 additions and 70 deletions

View file

@ -1,65 +1,82 @@
return { return {
"hrsh7th/nvim-cmp", {
-- load cmp on InsertEnter "hrsh7th/nvim-cmp",
event = "InsertEnter", -- load cmp on InsertEnter
-- these dependencies will only be loaded when cmp loads event = "InsertEnter",
-- dependencies are always lazy-loaded unless specified otherwise -- these dependencies will only be loaded when cmp loads
dependencies = { -- dependencies are always lazy-loaded unless specified otherwise
"hrsh7th/cmp-nvim-lsp", dependencies = {
"hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp",
'hrsh7th/cmp-buffer', "hrsh7th/cmp-buffer",
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-path',
'hrsh7th/cmp-vsnip', 'hrsh7th/cmp-cmdline',
'hrsh7th/vim-vsnip', 'hrsh7th/cmp-vsnip',
'hrsh7th/vim-vsnip-integ', 'hrsh7th/vim-vsnip',
'onsails/lspkind.nvim', 'hrsh7th/vim-vsnip-integ',
}, 'onsails/lspkind.nvim',
config = function() },
local cmp = require('cmp') config = function()
local lspkind = require('lspkind') local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) vim.fn["vsnip#anonymous"](args.body)
end, end,
}, },
mapping = { mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }), ['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(), ['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ ['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}), }),
['<Tab>'] = function(fallback) ['<Tab>'] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
else else
fallback() fallback()
end
end end
end },
}, sources = cmp.config.sources({
sources = cmp.config.sources({ { name = 'nvim_lsp' },
{ name = 'nvim_lsp' }, { name = 'vsnip' },
{ name = 'vsnip' }, { name = "copilot" },
{ name = "copilot"}, }, {
},{
{ name = 'buffer' }, { name = 'buffer' },
--{ name = 'path' }, --{ name = 'path' },
}), }),
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = 'symbol_text', -- show only symbol annotations mode = 'symbol_text', -- show only symbol annotations
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = '', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) ellipsis_char = '', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
symbol_map = { Copilot = "" }, symbol_map = { Copilot = "" },
}) })
}, },
}) })
end, end,
},
{
'zbirenbaum/copilot-cmp',
dependencies = { "hrsh7th/nvim-cmp",
{
'zbirenbaum/copilot.lua',
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
mail = false,
}
}
}
},
},
} }

View file

@ -35,10 +35,6 @@ return {
'folke/lsp-colors.nvim', 'folke/lsp-colors.nvim',
'nvim-lua/popup.nvim', 'nvim-lua/popup.nvim',
'zbirenbaum/copilot.lua',
{'zbirenbaum/copilot-cmp',
dependencies = { "hrsh7th/nvim-cmp" },
},
'junegunn/vim-easy-align', 'junegunn/vim-easy-align',
'machakann/vim-highlightedyank', 'machakann/vim-highlightedyank',
'vim-airline/vim-airline', 'vim-airline/vim-airline',

View file

@ -1,8 +0,0 @@
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
mail = false,
}
})
require("copilot_cmp").setup()