plugins.cmp.settings

Options provided to the require('cmp').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  mapping = {
    __raw = ''
      cmp.mapping.preset.insert({
        ['<C-b>'] = cmp.mapping.scroll_docs(-4),
        ['<C-f>'] = cmp.mapping.scroll_docs(4),
        ['<C-Space>'] = cmp.mapping.complete(),
        ['<C-e>'] = cmp.mapping.abort(),
        ['<CR>'] = cmp.mapping.confirm({ select = true }),
      })
    '';
  };
  snippet = {
    expand = "function(args) require('luasnip').lsp_expand(args.body) end";
  };
  sources = {
    __raw = ''
      cmp.config.sources({
        { name = 'nvim_lsp' },
        { name = 'vsnip' },
        -- { name = 'luasnip' },
        -- { name = 'ultisnips' },
        -- { name = 'snippy' },
      }, {
        { name = 'buffer' },
      })
    '';
  };
}

Declared by:

plugins.cmp.settings.experimental

Experimental features.

Type: null or (attribute set of anything)

Default: null

Declared by:

plugins.cmp.settings.mapping

This option has no description.

Type: (attribute set of lua code string) or raw lua code

Default: { }

Example:

{
  "<C-Space>" = "cmp.mapping.complete()";
  "<C-d>" = "cmp.mapping.scroll_docs(-4)";
  "<C-e>" = "cmp.mapping.close()";
  "<C-f>" = "cmp.mapping.scroll_docs(4)";
  "<CR>" = "cmp.mapping.confirm({ select = true })";
  "<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
  "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
}

Declared by:

plugins.cmp.settings.preselect

  • “cmp.PreselectMode.Item”: nvim-cmp will preselect the item that the source specified.
  • “cmp.PreselectMode.None”: nvim-cmp will not preselect any items.

Plugin default: cmp.PreselectMode.Item

Type: null or lua code string

Default: null

Declared by:

plugins.cmp.settings.sources

The sources to use. Can either be a list of sourceConfigs which will be made directly to a Lua object. Or it can be a raw lua string which might be necessary for more advanced use cases.

WARNING: If plugins.cmp.autoEnableSources Nixivm will automatically enable the corresponding source plugins. This will work only when this option is set to a list. If you use a raw lua string, you will need to explicitly enable the relevant source plugins in your nixvim configuration.

Default: []

Type: (list of (attribute set of anything)) or raw lua code

Default: [ ]

Example:

[
  {
    name = "nvim_lsp";
  }
  {
    name = "luasnip";
  }
  {
    name = "path";
  }
  {
    name = "buffer";
  }
]

Declared by: