2021-02-23 11:27:32 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
-- - LSP completion config -
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- Set completeopt to have a better completion experience
|
2021-10-08 14:28:07 +00:00
|
|
|
vim.o.completeopt = "menu,menuone,noselect"
|
2021-03-23 10:54:28 +00:00
|
|
|
|
2021-10-08 14:28:07 +00:00
|
|
|
local cmp = require'cmp'
|
|
|
|
cmp.setup {
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
2021-10-08 18:47:52 +00:00
|
|
|
vim.fn["UltiSnips#Anon"](args.body)
|
|
|
|
end,
|
2021-10-08 14:28:07 +00:00
|
|
|
},
|
|
|
|
mapping = {
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
['<C-e>'] = cmp.mapping.close(),
|
|
|
|
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
|
|
|
},
|
|
|
|
sources = {
|
|
|
|
{ name = 'nvim_lsp' },
|
2021-10-08 18:47:52 +00:00
|
|
|
{ name = 'nvim_lua' },
|
|
|
|
{ name = 'path' },
|
2021-10-08 14:28:07 +00:00
|
|
|
{ name = 'ultisnips' },
|
|
|
|
{ name = 'buffer' },
|
|
|
|
}
|
2021-03-23 10:54:28 +00:00
|
|
|
}
|