return {
{
"hrsh7th/cmp-buffer",
name = "cmp-buffer",
priority = 1,
},
{
"hrsh7th/cmp-path",
name = "cmp-path",
priority = 1,
},
{
"hrsh7th/cmp-cmdline",
name = "cmp-cmdline",
priority = 1,
},
{
"hrsh7th/cmp-vsnip",
name = "cmp-vsnip",
priority = 1,
},
{
"hrsh7th/vim-vsnip",
name = "vim-vsnip",
priority = 1,
},
{
"hrsh7th/cmp-nvim-lsp",
name = "cmp-nvim-lsp",
priority = 1,
},
{
"hrsh7th/nvim-cmp",
name = "nvim-cmp",
priority = 2,
opts = function(_, opts)
local cmp = require("cmp")
opts.snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
}
opts.window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
}
opts.mapping = cmp.mapping.preset.insert({
[''] = cmp.mapping.scroll_docs(-4),
[''] = cmp.mapping.scroll_docs(4),
[''] = cmp.mapping.complete(),
[''] = cmp.mapping.abort(),
[''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
})
opts.sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
}, {
{ name = 'buffer' },
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
matching = { disallow_symbol_nonprefix_matching = false }
})
end,
}
}