plugins.cmp.filetype.<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.filetype.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.filetype.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.filetype.sources.*.keyword_length

The source-specific keyword length to trigger auto completion.

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

Default: null

plugins.cmp.filetype.sources.*.keyword_pattern

The source-specific keyword pattern.

Type: null or lua code string

Default: null

plugins.cmp.filetype.sources.*.name

The name of the source.

Type: string

Example: "buffer"

plugins.cmp.filetype.sources.*.option

Any specific options defined by the source itself.

If direct lua code is needed use lib.nixvim.mkRaw.

Type: null or (attribute set of anything)

Default: null

plugins.cmp.filetype.sources.*.priority

The source-specific priority value.

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

Default: null

plugins.cmp.filetype.sources.*.trigger_characters

Trigger characters.

Type: null or (list of string)

Default: null