added luasnip as cmp snippet engine
This commit is contained in:
parent
4258701c98
commit
6c68f8d6c7
|
@ -11,8 +11,8 @@ return {
|
|||
'hrsh7th/cmp-emoji',
|
||||
'kdheepak/cmp-latex-symbols',
|
||||
-- snippets
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'hrsh7th/vim-vsnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'onsails/lspkind.nvim'
|
||||
},
|
||||
config = function(_, _)
|
||||
|
@ -32,12 +32,12 @@ return {
|
|||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
preselect = 'none',
|
||||
completeopt = "menu,menuone,noinser,noselectt",
|
||||
completeopt = "menu,menuone,noinser",
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
|
@ -69,9 +69,14 @@ return {
|
|||
}),
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, item)
|
||||
return require("lspkind").cmp_format()(entry, item)
|
||||
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
kind.kind = (strings[1] or "") .. " "
|
||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||
|
||||
return kind
|
||||
end
|
||||
},
|
||||
experimental = {
|
||||
|
|
Loading…
Reference in New Issue