Skip to content

fix(keybinds): ensure localleader sub-key is a prefix in leader map#8659

Open
kovan wants to merge 1 commit into
doomemacs:masterfrom
kovan:fix/localleader-subkey-prefix
Open

fix(keybinds): ensure localleader sub-key is a prefix in leader map#8659
kovan wants to merge 1 commit into
doomemacs:masterfrom
kovan:fix/localleader-subkey-prefix

Conversation

@kovan

@kovan kovan commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When doom-localleader-key is a sub-key of doom-leader-key (e.g. "S m" under "S"), pressing the localleader sequence shows "undefined" even though which-key displays the entry
  • Root cause: evil-snipe binds S as a command in a minor-mode keymap that sits between the intercept keymap (leader) and mode aux keymaps (localleader). This blocks Emacs' prefix key merging — localleader bindings are never reached through read-key-sequence
  • Fix: in doom-init-leader-keys-h, when localleader is a sub-key of leader, create a sparse keymap prefix for the sub-key (e.g. "m") in doom-leader-map. This ensures the lookup path Sdoom-leader-mapm → mode aux keymaps always works

Fix: #8562

Test plan

  • Set doom-leader-key to "S" and doom-localleader-key to "S m"
  • Open a buffer with localleader bindings (e.g. a Python file with LSP)
  • Press S — which-key should show m : +<localleader>
  • Press m — localleader bindings should appear (not "S m is undefined")
  • Verify default config (SPC / SPC m) still works normally

  • I searched the issue tracker and this hasn't been PRed before.
  • My changes are not on the do-not-PR list for this project.
  • My commits conform to Doom's git conventions.
  • I am blindly checking these off.
  • This PR contains AI-generated work.
  • Any relevant issues or PRs have been linked to.
  • This a draft PR; I need more time to finish it.

🤖 Generated with Claude Code

@kovan kovan requested a review from a team as a code owner February 13, 2026 14:58
When `doom-localleader-key' is a sub-key of `doom-leader-key' (e.g.
"S m" under "S"), intermediate minor-mode keymaps like evil-snipe can
bind the leader key to a command, blocking Emacs' prefix key merging.
Localleader bindings in mode aux keymaps become unreachable even though
which-key displays them.

Create a sparse keymap prefix for the sub-key in `doom-leader-map' so
the lookup always succeeds through the leader path.

Fix: doomemacs#8562
Co-authored-by: Claude Opus 4.6 <[email protected]>
@kovan kovan force-pushed the fix/localleader-subkey-prefix branch from 49194bd to 6bc236e Compare February 13, 2026 15:20
@hlissner hlissner added is:bug Something isn't working as intended re:keybinds Changes to or discussion about Doom's keybinds core Relevant to Doom core was:moved Is, was, or will be addressed elsewhere labels Feb 13, 2026
@hlissner hlissner removed the is:bug Something isn't working as intended label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Relevant to Doom core re:keybinds Changes to or discussion about Doom's keybinds was:moved Is, was, or will be addressed elsewhere

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting localleader key to 'S m' not working

2 participants