Skip to content

feat(search): add fuzzy search for keybindings by description#1060

Open
MrZeLee wants to merge 1 commit into
folke:mainfrom
MrZeLee:main
Open

feat(search): add fuzzy search for keybindings by description#1060
MrZeLee wants to merge 1 commit into
folke:mainfrom
MrZeLee:main

Conversation

@MrZeLee

@MrZeLee MrZeLee commented Jun 3, 2026

Copy link
Copy Markdown

Description

Adds a fuzzy keymap search to which-key: instead of drilling through the
popup, you can search for a keybinding by its description and execute it.

It walks which-key's existing per-mode keymap tree to collect every executable
keybinding for the current mode and buffer, then presents them through
vim.ui.select, so it integrates with whatever picker the user already has
(builtin, telescope, snacks, fzf-lua, dressing, …) with no hard dependency.
Each entry shows the formatted key sequence plus a description breadcrumb that
prepends parent group names (e.g. git → commit changes). Picking an entry
feeds its keys to execute the binding.

This keeps the implementation small and self-contained — a new
lua/which-key/search.lua module plus thin entry points; no changes to the
existing rendering/state code.

Usage

:WhichKeySearch        " current mode (defaults to normal)
:WhichKeySearch v      " a specific mode
require("which-key").search()

Changes

  • lua/which-key/search.lua (new) — collect → format → vim.ui.select → execute.
  • lua/which-key/init.lua — expose require("which-key").search(opts).
  • lua/which-key/config.lua — register the :WhichKeySearch [mode] command.
  • README.md — feature bullet and a "Search" section.

Related Issue(s)

Screenshots

2026-06-03_10-04-15

@github-actions github-actions Bot added the size/xl Extra large PR (100+ lines changed) label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl Extra large PR (100+ lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Fuzzy Search for Keybinds Through Descriptions

1 participant