55 lines
1,009 B
Lua
55 lines
1,009 B
Lua
|
local cmp = require 'cmp'
|
||
|
local lspkind = require 'lspkind'
|
||
|
|
||
|
cmp.setup {
|
||
|
formatting = {
|
||
|
format = function(entry, vim_item)
|
||
|
vim_item.menu = ({
|
||
|
buffer = '[Buffer]',
|
||
|
nvim_lsp = '[Lsp]',
|
||
|
nvim_lua = '[Lua]',
|
||
|
path = '[Path]',
|
||
|
vsnip = '[Snippet]',
|
||
|
})[entry.source.name]
|
||
|
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
||
|
return vim_item
|
||
|
end,
|
||
|
},
|
||
|
snippet = {
|
||
|
expand = function (args)
|
||
|
vim.fn["vsnip#anonymous"](args.body)
|
||
|
end
|
||
|
},
|
||
|
documentation = {
|
||
|
border = 'rounded'
|
||
|
},
|
||
|
mapping = {
|
||
|
['<CR>'] = cmp.mapping.confirm({
|
||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||
|
select = true
|
||
|
}),
|
||
|
},
|
||
|
sources = {
|
||
|
{
|
||
|
name = 'nvim_lsp',
|
||
|
priority = 100
|
||
|
},
|
||
|
{
|
||
|
name = 'vsnip',
|
||
|
priority = 80
|
||
|
},
|
||
|
{
|
||
|
name = 'nvim_lua',
|
||
|
priority = 50
|
||
|
},
|
||
|
{
|
||
|
name = 'buffer',
|
||
|
priority = 20
|
||
|
},
|
||
|
{
|
||
|
name = 'path',
|
||
|
priority = 5
|
||
|
},
|
||
|
}
|
||
|
}
|