plugins.cmp.filetype.<name>.snippet.expand

The snippet expansion function. That’s how nvim-cmp interacts with a particular snippet engine.

Common engines:

  function(args)
    # vsnip
    vim.fn["vsnip#anonymous"](args.body)

    # luasnip
    require('luasnip').lsp_expand(args.body)

    # snippy
    require('snippy').expand_snippet(args.body)

    # ultisnips
    vim.fn["UltiSnips#Anon"](args.body)
  end

You can also provide a custom function:

  function(args)
    vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
    -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
    -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
    -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
  end

Type: null or lua function string

Default: null

Example:

''
  function(args)
    require('luasnip').lsp_expand(args.body)
  end
''

Declared by: