vim-vsnip
vim-vsnip copied to clipboard
How do I configure it to look like the image below?
This is the configuration of lvim
Type 'div' to complete
I'm using the official default configuration, I don't know where to change it
You have to type "<div" to get the prompt, and pressing enter will not complete it.
local cmp = require'cmp'
local lsp_symbols = {
Text = " (Text) ",
Method = " (Method)",
Function = " (Function)",
Constructor = " (Constructor)",
Field = " ﴲ (Field)",
Variable = "[] (Variable)",
Class = " (Class)",
Interface = " ﰮ (Interface)",
Module = " (Module)",
Property = " 襁 (Property)",
Unit = " (Unit)",
Value = " (Value)",
Enum = " 練 (Enum)",
Keyword = " (Keyword)",
Snippet = " (Snippet)",
Color = " (Color)",
File = " (File)",
Reference = " (Reference)",
Folder = " (Folder)",
EnumMember = " (EnumMember)",
Constant = " ﲀ (Constant)",
Struct = " ﳤ (Struct)",
Event = " (Event)",
Operator = " (Operator)",
TypeParameter = " (TypeParameter)"
}
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 = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
formatting = {
format = function(entry, item)
item.kind = lsp_symbols[item.kind]
item.menu = ({
nvim_lsp = "[LSP]",
buffer = "[Buffer]",
path = "[Path]",
vsnip = "[VSnip]"
})[entry.source.name]
return item
end
},
sources = {
{ name = 'nvim_lsp' },
-- For vsnip user.
{ name = 'vsnip' },
-- For luasnip user.
-- { name = 'luasnip' },
-- For ultisnips user.
-- { name = 'ultisnips' },
{ name = 'buffer' },
}
})
-- Setup lspconfig.
require('lspconfig').html.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
}
I can't find the document, can you tell me where it is? How do I do it?