plugins.cmp.settings.sorting.comparators

The function to customize the sorting behavior. You can use built-in comparators via cmp.config.compare.*.

Signature: (fun(entry1: cmp.Entry, entry2: cmp.Entry): boolean | nil)[]

Default:

[
  "require('cmp.config.compare').offset"
  "require('cmp.config.compare').exact"
  "require('cmp.config.compare').score"
  "require('cmp.config.compare').recently_used"
  "require('cmp.config.compare').locality"
  "require('cmp.config.compare').kind"
  "require('cmp.config.compare').length"
  "require('cmp.config.compare').order"
]

Type: null or (list of lua function string)

Default: null

Declared by:

plugins.cmp.settings.sorting.priority_weight

Each item’s original priority (given by its corresponding source) will be increased by #sources - (source_index - 1) and multiplied by priority_weight.

That is, the final priority is calculated by the following formula: final_score = orig_score + ((#sources - (source_index - 1)) * sorting.priority_weight)

Type: null or unsigned integer, meaning >=0, or raw lua code

Default: null

Plugin default: 2

Declared by: