Beginner issue: unsure of the correct configuration
Integralist opened this issue Β· comments
Mark McDonnell commented
ππ»
I've used :VsnipOpen
to create a new ~/.vsnip/...
example, but I'm not sure of what to configure to get the list of available Snippets showing in my autocomplete menu when typing the 'trigger' name.
For example I have ~/.vsnip/go.json
that contains:
{
"Error Check": {
"prefix": ["iferr"],
"body": [
"if err != nil {",
"\treturn err"
"}"
],
"description": "err check and return."
}
}
I'm also using cmp-vsnip
like this in my plugin/cmp.lua
:
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
["<Up>"] = cmp.mapping.select_prev_item(),
["<Down>"] = cmp.mapping.select_next_item(),
["<Left>"] = cmp.mapping.select_prev_item(),
["<Right>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
sources = {
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "path" },
{ name = "vsnip" },
},
})
Any guidance appreciated. β€οΈ