Skip to content

[audit] <C-space> "LSP completion" keymap in options.lua is silently overwritten by blink.cmp's default preset #311

Description

@stanfish06

What

lua/config/options.lua:47 registers:

vim.keymap.set("i", "<c-space>", "<c-x><c-o>", { desc = "LSP completion" })

config.options loads before config.plugin_config (see the modules table in init.lua), so this registers first. lua/config/plugin_config.lua:96-101 then calls:

require("blink.cmp").setup({
    keymap = { preset = "default" },
    ...
})

blink.cmp's "default" keymap preset itself calls vim.keymap.set("i", "<C-space>", ...) bound to { "show", "show_documentation", "hide_documentation" }, with no fallback entry in that action list. Since both registrations target the exact same {mode = "i", lhs = "<C-space>"} slot, blink's later call overwrites the options.lua mapping outright — it isn't shadowed, it's gone, and there is no fallback path back to <c-x><c-o>.

For contrast, the two neighboring mappings in the same block are not broken this way:

  • <c-f> (options.lua:49) — blink's <C-f> preset action is { "scroll_documentation_down", "fallback" }, and fallback re-invokes the prior non-blink mapping, so <c-x><c-f> still works when no doc window is open.
  • <c-l> (options.lua:48) — not touched by blink's default preset at all.

Where

  • lua/config/options.lua:47 — the dead mapping
  • lua/config/plugin_config.lua:96-101 — blink.cmp setup() call that silently overwrites it

Why it matters

In the active profile (STABLE = false in init.lua:1, which is the profile actually in use), the mapping and its desc = "LSP completion" are misleading dead code — pressing <C-space> in insert mode never reaches <c-x><c-o>; it only ever triggers blink's own completion menu. This was flagged only in passing as an optional follow-up on a since-closed issue (#164, "add blink.cmp") and never actually resolved or diagnosed as a live conflict — no open issue tracks it. It's a genuine broken keymap per the audit criteria, though low severity (blink already supplies LSP completion functionally).

Recommended action (judgment call, not mechanical)

Pick one:

  1. Delete the dead options.lua:47 mapping/comment entirely, since blink.cmp already covers <C-space>-triggered completion in the active profile.
  2. Gate it the same way lsp.lua already gates vim.lsp.completion.enable() on a blink_ok check, so the native-omnifunc shortcut only registers (and only claims <C-space>) when blink.cmp isn't loaded — e.g. a future STABLE mode where blink is skipped, or if require("blink.cmp") fails to load.
  3. Leave the mapping but correct its desc to say it's a fallback-only binding, so :DescribeKey/keymap browsers don't advertise functionality that doesn't fire.

Option 2 is the most consistent with the existing blink_ok-gating pattern already used in lsp.lua, but the actual resolution depends on whether a no-blink fallback path is wanted at all — hence issue rather than PR.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions