plugins.cmp.cmdline.<name>.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.

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

Default: [ ]

Example:

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

Declared by:

plugins.cmp.cmdline.sources.*.entry_filter

A source-specific entry filter, with the following function signature:

function(entry: cmp.Entry, ctx: cmp.Context): boolean

Returning true will keep the entry, while returning false will remove it.

This can be used to hide certain entries from a given source. For instance, you could hide all entries with kind Text from the nvim_lsp filter using the following source definition:

{
  name = "nvim_lsp";
  entry_filter = \'\'
    function(entry, ctx)
      return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()] ~= 'Text'
    end
  \'\';
}

Using the ctx parameter, you can further customize the behaviour of the source.

Type: null or lua code string

Default: null

plugins.cmp.cmdline.sources.*.group_index

The source group index.

For instance, you can set the buffer’s source group_index to a larger number if you don’t want to see buffer source items while nvim-lsp source is available:

  sources = [
    {
      name = "nvim_lsp";
      group_index = 1;
    }
    {
      name = "buffer";
      group_index = 2;
    }
  ];

Type: null or (unsigned integer, meaning >=0)

Default: null

plugins.cmp.cmdline.sources.*.keyword_length

The source-specific keyword length to trigger auto completion.

Type: null or (unsigned integer, meaning >=0)

Default: null

plugins.cmp.cmdline.sources.*.keyword_pattern

The source-specific keyword pattern.

Type: null or lua code string

Default: null

plugins.cmp.cmdline.sources.*.name

The name of the source.

Type: string

Example: "buffer"

plugins.cmp.cmdline.sources.*.option

Any specific options defined by the source itself.

If direct lua code is needed use helpers.mkRaw.

Type: null or (attribute set of anything)

Default: null

plugins.cmp.cmdline.sources.*.priority

The source-specific priority value.

Type: null or (unsigned integer, meaning >=0)

Default: null

plugins.cmp.cmdline.sources.*.trigger_characters

Trigger characters.

Type: null or (list of string)

Default: null