Fix wrong which-key labels & leader key precedence
This changes how leader keys are bound, to fix an issue where the wrong which-key label was assigned to the wrong keys, and cases where the leader key was being shadowed by other minor mode mappings. Unfortunately, this new method adds 10-20% to startup times. I'll address this in a future patch. For now, correctness is more important. Also fixes dashboard keybind detection.
This commit is contained in:
parent
6992e27884
commit
63a224f0e8
2 changed files with 18 additions and 19 deletions
|
@ -419,17 +419,13 @@ controlled by `+doom-dashboard-pwd-policy'."
|
|||
'help-echo label)
|
||||
(format "%-37s" (buffer-string)))
|
||||
;; Lookup command keys dynamically
|
||||
(or (let ((maps (list global-map)))
|
||||
(when (bound-and-true-p evil-normal-state-map)
|
||||
(push evil-motion-state-map maps)
|
||||
(push evil-normal-state-map maps))
|
||||
(when-let* ((key (where-is-internal action maps t)))
|
||||
(propertize (with-temp-buffer
|
||||
(save-excursion (insert (key-description key)))
|
||||
(while (re-search-forward "<\\([^>]+\\)>" nil t)
|
||||
(replace-match (upcase (substring (match-string 1) 0 3))))
|
||||
(buffer-string))
|
||||
'face 'font-lock-constant-face)))
|
||||
(or (when-let* ((key (where-is-internal action nil t)))
|
||||
(propertize (with-temp-buffer
|
||||
(save-excursion (insert (key-description key)))
|
||||
(while (re-search-forward "<\\([^>]+\\)>" nil t)
|
||||
(replace-match (upcase (substring (match-string 1) 0 3))))
|
||||
(buffer-string))
|
||||
'face 'font-lock-constant-face))
|
||||
""))))
|
||||
(if (display-graphic-p)
|
||||
"\n\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue