2024-02-25 17:12:48 +00:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
dependencies = {
|
|
|
|
-- extra completion plugins
|
|
|
|
'hrsh7th/cmp-cmdline',
|
|
|
|
'hrsh7th/cmp-path',
|
|
|
|
'hrsh7th/cmp-buffer',
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
'hrsh7th/cmp-calc',
|
|
|
|
'hrsh7th/cmp-emoji',
|
|
|
|
'kdheepak/cmp-latex-symbols',
|
|
|
|
-- snippets
|
|
|
|
'hrsh7th/cmp-vsnip',
|
|
|
|
'hrsh7th/vim-vsnip',
|
|
|
|
'onsails/lspkind.nvim'
|
|
|
|
},
|
2024-03-01 17:57:06 +00:00
|
|
|
config = function(_, _)
|
2024-02-25 17:12:48 +00:00
|
|
|
local cmp = require("cmp");
|
|
|
|
cmp.setup({
|
2024-03-01 17:57:06 +00:00
|
|
|
window = {
|
|
|
|
completion = {
|
|
|
|
border = "single",
|
|
|
|
scrollbar = false,
|
|
|
|
winhighlight = "Normal:CmpPmenu,FloatBorder:FloatBorder,Search:None"
|
|
|
|
},
|
|
|
|
documentation = {
|
|
|
|
border = "single",
|
|
|
|
scrollbar = false,
|
|
|
|
winhighlight = "Normal:CmpPmenu,FloatBorder:FloatBorder,Search:None"
|
|
|
|
},
|
|
|
|
},
|
2024-02-25 17:12:48 +00:00
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
completion = {
|
2024-03-01 17:57:06 +00:00
|
|
|
preselect = 'none',
|
|
|
|
completeopt = "menu,menuone,noinser,noselectt",
|
2024-02-25 17:12:48 +00:00
|
|
|
},
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'nvim_lsp' },
|
2024-03-01 17:57:06 +00:00
|
|
|
{ name = 'nvim_lsp_signature_help' },
|
2024-02-25 17:12:48 +00:00
|
|
|
{ name = 'vsnip' },
|
|
|
|
{ name = 'buffer' },
|
2024-03-01 17:57:06 +00:00
|
|
|
{ name = "path" },
|
2024-02-25 17:12:48 +00:00
|
|
|
{ name = 'calc' },
|
2024-03-01 17:57:06 +00:00
|
|
|
}, {
|
2024-02-25 17:12:48 +00:00
|
|
|
{ name = 'emoji' },
|
|
|
|
{ name = "cmdline" },
|
|
|
|
{ name = "latex_symbols" }
|
|
|
|
}),
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
|
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
['<C-e>'] = cmp.mapping.abort(),
|
2024-03-01 17:57:06 +00:00
|
|
|
["<CR>"] = cmp.mapping({
|
|
|
|
i = function(fallback)
|
|
|
|
if cmp.visible() and cmp.get_active_entry() then
|
|
|
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
s = cmp.mapping.confirm({ select = true }),
|
|
|
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
|
|
|
}),
|
2024-02-25 17:12:48 +00:00
|
|
|
}),
|
|
|
|
formatting = {
|
2024-03-01 17:57:06 +00:00
|
|
|
fields = { "abbr", "kind", "menu" },
|
2024-02-25 17:12:48 +00:00
|
|
|
format = function(entry, item)
|
2024-03-01 17:57:06 +00:00
|
|
|
return require("lspkind").cmp_format()(entry, item)
|
2024-02-25 17:12:48 +00:00
|
|
|
end
|
2024-03-01 17:57:06 +00:00
|
|
|
},
|
|
|
|
experimental = {
|
|
|
|
ghost_text = {
|
|
|
|
hl_group = "NonText",
|
|
|
|
},
|
|
|
|
},
|
2024-02-25 17:12:48 +00:00
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|