doc/configuration/sources.md
::: 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, 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!
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.
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' },
-- optionally inherit from the `default` sources
lua = { inherit_defaults = true, 'lazydev' }
},
providers = {
dadbod = { module = "vim_dadbod_completion.blink" },
lazydev = { ... }
}
}
All of the fields shown below apply to all sources. The opts field is passed to the source directly, and will vary by source.
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 show the completions before this provider returns, without waiting for it
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
}
By default, the buffer source will only show when the LSP source is disabled or returns no items. You may always show the buffer source via:
sources = {
providers = {
-- defaults to `{ 'buffer' }`
lsp = { fallbacks = {} }
}
}
::: info Terminal completions are 0.11+ 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!
nvim-cmp sourcesBlink can use nvim-cmp sources through a compatibility layer developed by stefanboca: blink.compat. Please open any issues with blink.compat in that repo
The command :BlinkCmp status can be used to view which sources providers are enabled or not enabled.
::: info
See blink.compat for using nvim-cmp sources
:::
Here is a non-exhaustive list of third-party plugins providing additional completion sources. Please open a PR to add yours.
4e554c4c: Agda symbolsKaiser-Yang: Avantedisrupted: Git conventional commitspxwg: CopilotChat.nvimgiuxtaposition: Github Copilotnetmute: Ctagsmayromr: DAP replxieyonn: WordKaiser-Yang: Wordbydlw98: Environment variablesbarrettruth: Ghostty terminalKaiser-Yang: Git commitsyehuohan: Input Methodgaryhurtz: Kitty terminalerooke: Unicode symbols via latex macrosbecknik: LuaSnip choice nodealexandre-abrioux: NPM package names and versionsphanen: Registersniuiic: Ripgrepribru17: Spell (based on Neovim's spellsuggest)bydlw98: SSH config filesHuijiro: supermaven-nvimbarrettruth: Tmuxmgalliou: Tmuxdynamotn: ZellijFelipeLema: vim-vsnipjunkblocker: WezTerm terminalarchie-judd: Words and synonymsmarcoSven: yanky.nvimfang2hou: Github Copilotmoyiz: EmojisMahanRahmati: Nerd Fontsmikavilpas: Ripgrepjmbuhr: Bibliography, reference and cross-ref itemsjdrupal-dev: CSS variablesph1losof: Environment variablesDynge: gitmojisfolke: LuaLSmilanglacier: AIkristijanhusak: vim-dadboddbernheisel: Hex.pm package completion for Elixir mix.exs files.