Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginner issue: unsure of the correct configuration #252

Closed
Integralist opened this issue Jul 11, 2022 · 0 comments
Closed

Beginner issue: unsure of the correct configuration #252

Integralist opened this issue Jul 11, 2022 · 0 comments

Comments

@Integralist
Copy link

👋🏻

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. ❤️

@hrsh7th hrsh7th closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants