dotfiles/home/dot_config/nvim/lua/plugins/nvim_cmp.lua

41 lines
1.1 KiB
Lua
Raw Normal View History

return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- for vsnip users
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
},
opts = function ()
local cmp = require('cmp')
return {
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({
-- behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
['<C-e>'] = cmp.mapping.abort(),
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
}),
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{name = 'buffer'},
}),
}
end
}