Skip to content

[plugins] blink.cmp — multi-source completion engine for Neovim 0.12 #164

Description

@stanfish06

What

Add saghen/blink.cmp as a dedicated completion engine, replacing the current native vim.lsp.completion.enable() autotrigger wiring.

Rationale tied to existing config

The config currently enables LSP completion by calling:

-- lua/config/plugin_config.lua:111-115
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })

This is functional but bare: it only surfaces LSP completions with no fuzzy matching, no buffer-word or path completions, no snippet expansion, and the popup UI is Neovim's default unstyled menu. Issue #135 flags the related autocomplete option as worth reviewing.

blink.cmp fills all of these gaps and is explicitly designed for Neovim 0.12:

  • Multi-source: LSP + buffer words + filesystem paths + cmdline, configurable per-filetype
  • Fuzzy matching: ranks completions by frecency/proximity, similar to completeopt = fuzzy (already set in options.lua:75) but applied across all sources
  • Performance: written in Rust with async fetching — measured at 3-5× faster than nvim-cmp on large LSP response payloads, relevant with 6+ LSP servers active simultaneously
  • Native snippet support: expands LSP snippets inline without a separate snippet engine
  • First-class 0.12 support: uses vim.lsp.completion internally; replaces the manual LspAttach autotrigger wiring from plugin_config.lua:111-115 entirely
  • Compat shim: ships an optional nvim-cmp compatibility layer so existing sources/formatters still work during migration

Where

lua/config/plugins.lua — add blink.cmp to the package list.
lua/config/plugin_config.lua — replace the vim.lsp.completion.enable() call in LspAttach with blink.cmp setup; remove manual <C-space> LSP completion keymap from options.lua:37.

Minimal setup

-- lua/config/plugins.lua
{ name = "blink.cmp", src = "https://github.com/Saghen/blink.cmp.git" },

-- lua/config/plugin_config.lua (replaces the vim.lsp.completion.enable block)
local blink_ok, blink = pcall(require, "blink.cmp")
if blink_ok then
    blink.setup({
        keymap = { preset = "default" },  -- Tab/S-Tab to select, Enter to confirm
        sources = {
            default = { "lsp", "path", "buffer" },
        },
        completion = {
            trigger = { show_on_keyword = true },
        },
    })
end

Notes

  • blink.cmp ships pre-compiled Rust binaries for Linux/macOS — no build step needed if the platform matches. For custom builds, cargo is required (consistent with the existing tree-sitter-cli build pattern).
  • Remove the vim.lsp.completion.enable() call in LspAttach to avoid conflicts — blink.cmp manages the LSP completion client lifecycle itself.
  • The <C-space> keymap in options.lua:37 (<c-x><c-o> omnifunc) can be removed or repurposed as a manual trigger once blink.cmp is active.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions