Skip to content

Sources Go to default configuration

INFO

Check out the recipes for some common configurations

Blink provides a sources interface, modelled after LSPs, for getting completion items, trigger characters, documentation and signature help. The lsp, path, snippets, luasnip, buffer, and omni sources are built-in. You may add additional community sources as well. Check out the source boilerplate to learn how to write your own!

Providers

Sources are configured via the sources.providers table, where each id (key) must have a name and module field. The id (key) may be used in the sources.default/per_filetype, cmdline.sources, and term.sources to enable the source.

See the reference for the default configuration options.

lua
sources = {
  -- `lsp`, `buffer`, `snippets`, `path` and `omni` are built-in
  -- so you don't need to define them in `sources.providers`
  default = { 'lsp', 'buffer', 'snippets', 'path' },

  per_filetype = { sql = { 'dadbod' } }
  providers = {
    dadbod = { module = "vim_dadbod_completion.blink" },
  }
}

Provider options

All of the fields shown below apply to all sources. The opts field is passed to the source directly, and will vary by source.

lua
sources.providers.lsp = {
  name = 'LSP',
  module = 'blink.cmp.sources.lsp',
  opts = {} -- Passed to the source directly, varies by source

  --- NOTE: All of these options may be functions to get dynamic behavior
  --- See the type definitions for more information
  enabled = true, -- Whether or not to enable the provider
  async = false, -- Whether we should wait for the provider to return before showing the completions
  timeout_ms = 2000, -- How long to wait for the provider to return before showing completions and treating it as asynchronous
  transform_items = nil, -- Function to transform the items before they're returned
  should_show_items = true, -- Whether or not to show the items
  max_items = nil, -- Maximum number of items to display in the menu
  min_keyword_length = 0, -- Minimum number of characters in the keyword to trigger the provider
  -- If this provider returns 0 items, it will fallback to these providers.
  -- If multiple providers fallback to the same provider, all of the providers must return 0 items for it to fallback
  fallbacks = {},
  score_offset = 0, -- Boost/penalize the score of the items
  override = nil, -- Override the source's functions
}

Terminal and Cmdline Sources

INFO

Terminal completions are nightly only! Known bugs in v0.10. Cmdline completions are supported on all versions

You may use cmdline and term sources via the cmdline.sources and term.sources tables. You may see the defaults in the reference. There's no source for shell completions at the moment, contributions welcome!

Using nvim-cmp sources

Blink can use nvim-cmp sources through a compatibility layer developed by stefanboca: blink.compat. Please open any issues with blink.compat in that repo

Checking status of sources providers

The command :BlinkCmp status can be used to view which sources providers are enabled or not enabled.

Community sources