Our specific configuration and customizations for the Blink.cmp completion engine
We chose Blink.cmp over nvim-cmp for:
-- Located in: src/neovim/plugins.lua
{
performance = {
-- Faster triggering for immediate feedback
debounce_ms = 0,
-- More aggressive caching
cache = true,
-- Async processing
async_budget = 5,
}
}
Our setup differs from defaults:
| Key | Our Binding | Default | Reason |
|---|---|---|---|
Tab |
Accept & snippet jump | Accept only | Unified snippet workflow |
<C-y> |
Confirm selection | Same | Vim convention |
<C-e> |
Cancel | Same | Standard abort |
<C-Space> |
Manual trigger | Same | Force completion |
sources = {
-- Our priority order (differs from default)
default = { 'lsp', 'snippets', 'path', 'buffer' },
-- Custom for specific contexts
providers = {
lsp = {
-- Prefer LSP for code
score_offset = 100,
},
path = {
-- Boost paths in strings
score_offset = 10,
opts = {
trailing_slash = true,
label_trailing_slash = false,
}
}
}
}
-- Seamless snippet expansion
snippets = {
expand = function(snippet)
require('luasnip').lsp_expand(snippet)
end,
-- Tab/S-Tab for jumping
jump_forward = '<Tab>',
jump_backward = '<S-Tab>',
}
-- Remember and prioritize frequently used completions
frecency = {
db_root = vim.fn.stdpath('data') .. '/blink-frecency',
max_entries = 2048,
}
-- Automatically add parentheses for functions
auto_brackets = {
enabled = true,
-- Skip for these languages
skip_langs = { 'tex', 'markdown' },
}
documentation = {
auto_show = true,
auto_show_delay_ms = 200,
window = {
border = 'rounded',
max_width = 80,
max_height = 20,
}
}
In our environment:
| Metric | Blink.cmp | nvim-cmp | Improvement |
|---|---|---|---|
| Initial completion | <1ms | 15-60ms | 15-60x |
| Filtering 10k items | 2ms | 20ms | 10x |
| Memory usage | 20MB | 35MB | 43% less |
" Check status
:Blink
" Verify sources
:lua print(vim.inspect(require('blink.cmp').get_sources()))
-- Add to our config
performance = {
max_items = 50, -- Limit items shown
max_fuzzy_matches = 20, -- Limit fuzzy search
}
-- Disable in specific filetypes
filetypes = {
disable = { 'TelescopePrompt', 'neo-tree' }
}
-- In src/neovim/plugins.lua
sources = {
providers = {
-- Add custom source
my_source = {
module = 'my_completion_source',
score_offset = 50,
}
},
default = { 'lsp', 'my_source', 'snippets', 'path', 'buffer' }
}
window = {
completion = {
format = function(item)
-- Custom formatting logic
item.label = item.label .. ' ' .. item.source
return item
end
}
}