Skip to content

Fix arrow keys not selecting blink.cmp completion candidates#203

Merged
rikuson merged 1 commit into
masterfrom
fix/blink-cmp-arrow-key-selection
Apr 27, 2026
Merged

Fix arrow keys not selecting blink.cmp completion candidates#203
rikuson merged 1 commit into
masterfrom
fix/blink-cmp-arrow-key-selection

Conversation

@rikuson

@rikuson rikuson commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add <Up>/<Down> arrow key mappings to blink.cmp keymap with select_prev/select_next actions
  • Fixes issue where arrow keys moved the cursor instead of navigating completion candidates

Test plan

  • Open Neovim and trigger completion menu
  • Verify Up/Down arrow keys navigate completion candidates
  • Verify arrow keys work normally when completion menu is not visible

🤖 Generated with Claude Code

Add Up/Down arrow key mappings to blink.cmp keymap so completion
candidates can be navigated with arrow keys instead of moving the cursor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Apr 27, 2026

Copy link
Copy Markdown

Code Review

Overview

This PR adds <Up>/<Down> arrow key mappings to the blink.cmp completion plugin so that arrow keys navigate completion candidates rather than moving the cursor while the menu is open.


Code Quality & Style ✅

The change is minimal and clean, and the implementation exactly follows the existing keymap pattern established by the <CR> binding:

["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },

No issues here.


Correctness ✅

  • select_prev / select_next are the correct blink.cmp action names for moving up/down in the candidate list.
  • The "fallback" action is the critical piece: it ensures arrow keys revert to normal cursor movement when the completion menu is not visible. Without this, arrow keys would be swallowed by blink.cmp even outside the completion context, breaking normal navigation. This is handled correctly.
  • Since preset = "none" is set, all keymaps must be defined explicitly — so this addition is both necessary and appropriate.

Potential Concerns

  • None blocking. This is a very well-scoped fix.
  • Minor consideration: If you ever find yourself wanting to scroll through a completion documentation popup with arrow keys as well, blink.cmp has a scroll_documentation_up / scroll_documentation_down action — but that's a future enhancement, not a gap here.

Test Coverage

The test plan in the PR description covers the key scenarios:

  • Arrow keys navigate candidates when menu is open
  • Arrow keys fall back to cursor movement when menu is closed

These manual checks are appropriate for a Neovim config change — no automated test infrastructure exists or is needed here.


Summary

Approve. This is a focused, correct, and idiomatic fix. The "fallback" action correctly handles the "menu not open" case, and the mapping names are accurate for the blink.cmp API. Nothing to change.

@rikuson rikuson merged commit 34365a9 into master Apr 27, 2026
3 checks passed
@rikuson rikuson deleted the fix/blink-cmp-arrow-key-selection branch April 27, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant