2021-10-13 11:32:56 -05:00
|
|
|
set completeopt=menu,menuone,noselect
|
|
|
|
|
|
|
|
lua <<EOF
|
|
|
|
-- Setup nvim-cmp.
|
|
|
|
local cmp = require'cmp'
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
-- For `vsnip` user.
|
|
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
|
|
|
|
|
|
-- For `luasnip` user.
|
|
|
|
-- require('luasnip').lsp_expand(args.body)
|
|
|
|
|
|
|
|
-- For `ultisnips` user.
|
|
|
|
-- vim.fn["UltiSnips#Anon"](args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
mapping = {
|
2021-10-13 11:35:41 -05:00
|
|
|
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
|
|
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
|
|
['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
|
|
|
['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
2021-10-13 11:32:56 -05:00
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
['<C-e>'] = cmp.mapping.close(),
|
2021-10-13 11:35:41 -05:00
|
|
|
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
select = true,
|
|
|
|
})
|
2021-10-13 11:32:56 -05:00
|
|
|
},
|
|
|
|
sources = {
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
|
|
|
|
-- For vsnip user.
|
|
|
|
{ name = 'vsnip' },
|
|
|
|
|
|
|
|
-- For luasnip user.
|
|
|
|
-- { name = 'luasnip' },
|
|
|
|
|
|
|
|
-- For ultisnips user.
|
|
|
|
-- { name = 'ultisnips' },
|
|
|
|
|
|
|
|
{ name = 'buffer' },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
EOF
|