In the Lazy Neovim Configuration I wrote a bit about the neovim configuration I use. While most of my configuration has not changed, I learned about a new completion plugin blink.cmp. It got recommended by kulala-ls and got recently introduced in a kickstart.nvim.

The installation

Is easy with lazy.nvim.

{
  'saghen/blink.cmp',
  -- optional: provides snippets for the snippet source
  dependencies = { 'rafamadriz/friendly-snippets' },

  -- use a release tag to download pre-built binaries
  version = '1.*',
}

The configuration

While my complete configuration file blink.lua is a big one, the plugin is actually pretty easy to install and start with. What is really nice is that it offers a lot of completions by default. The "lsp", "buffer", "path" are all builtin. The "snippets" too, just require an external plugin with defined snippets.

What I really like are the defaults. The keymap = { preset = "default" } uses the ['<C-y>'] = { 'select_and_accept' }, so Ctrl+y accepts the completion as every vim nerd expects.

However when needed, it is easy to configure the plugin to the linking. So I enabled documentation to be opened by default or to enable ghost_text so the completion will be visible as a virtual text in the buffer. The documentation is simply amazing.

What really amazed me was a menu-draw configuration. What was problem and I did not appreciated was it does not show the completion source by default. The configuration was pretty straightforward. First add a source_name into columns.

columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { "source_name" } },

And then define how the source_name will look like. This define max width, the highlight class and most importantly the content of the field like [LSP] or [Buffer] or [Copilot].

components = {
	source_name = {
		width = { max = 30 },
		text = function(ctx)
			return "[" .. ctx.source_name .. "]"
		end,
		highlight = "BlinkCmpSource",
	},
},

Support for snippets is builtin, given the external plugin is installed. Either luasnip or mini.snippets are supported.

snippets = { preset = "luasnip" },

And besides documentation blink has a completion for function signatures, so it can provide a context help when using a function too.

signature = { enabled = true },

To Rust or not to Rust

The name blink does refer to the speed plugin. So except native engine written in Lua, there is a Rust based one claiming a significant speedup. The Rust based frizbee is a SIMD fuzzy matcher which achieves ~6x the performance of fzf while ignoring typos.

  1. lua
  2. rust

I ended up using fuzzy = { implementation = "lua" }, which is the one Kickstart offers. It worked well for me - except the emoji and nerdfont providers. But more specifically I do not want neovim plugins to download and install random binaries from the Internet. And that’s sadly the only one option for a frizbee at the moment.