From 304b9a413ad2685793095a2ba2803a979fa6e9e0 Mon Sep 17 00:00:00 2001 From: Emma Thorpe Date: Tue, 23 Jun 2026 16:17:05 +0100 Subject: [PATCH] feat(editor): add nvim-cmp completion keymaps nvim-cmp ships no default mappings, so the completion menu (including the path source) appeared but nothing could navigate or accept it. Bind the usual set: C-n/C-p and Tab/S-Tab to move, C-Space to open, C-e to abort, and to confirm with select=false so a bare Enter stays a newline unless an entry is explicitly highlighted. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyrathorpe/home/editor.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lyrathorpe/home/editor.nix b/lyrathorpe/home/editor.nix index a6569cc..23f37e7 100644 --- a/lyrathorpe/home/editor.nix +++ b/lyrathorpe/home/editor.nix @@ -89,6 +89,18 @@ enable = true; autoEnableSources = true; settings = { + # nvim-cmp ships no default keymaps; without these the menu shows but + # nothing accepts it. confirm uses select=false so a bare stays a + # newline unless an entry is explicitly highlighted. + mapping = { + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.confirm({ select = false })"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.abort()"; + }; snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; sources = [ { name = "nvim_lsp"; }