Skip to content

Commit

Permalink
bootstrap: refactore which key replacement list
Browse files Browse the repository at this point in the history
And enable multiple replacements.
  • Loading branch information
syl20bnr committed Feb 10, 2019
1 parent 474f945 commit 3dd7539
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions layers/+distributions/spacemacs-bootstrap/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,17 @@
(defun spacemacs-bootstrap/init-which-key ()
(require 'which-key)

(setq which-key-special-keys nil
which-key-use-C-h-for-paging t
which-key-prevent-C-h-from-cycling t
which-key-echo-keystrokes 0.02
which-key-max-description-length 32
which-key-allow-multiple-replacements t
which-key-sort-order 'which-key-key-order-alpha
which-key-idle-delay dotspacemacs-which-key-delay
which-key-idle-secondary-delay 0.01
which-key-allow-evil-operators t)

(spacemacs|add-toggle which-key
:mode which-key-mode
:documentation
Expand All @@ -322,30 +333,33 @@
;; being higher in this list means the replacement is applied later
'(
("spacemacs/\\(.+\\)" . "\\1")
("spacemacs-\\(.+\\)" . "\\1")
("spacemacs/toggle-\\(.+\\)" . "\\1")
("\\(.+\\)-transient-state/\\(.+\\)" . "\\2")
("\\(.+\\)-transient-state/body" . "\\1-transient-state")
("spacemacs-layouts/non-restricted-buffer-list-\\(helm\\|ivy\\)" . "global-list-buffers")
("spacemacs/alternate-buffer" . "last buffer")
("spacemacs/toggle-mode-line-\\(.+\\)" . "\\1")
("lazy-helm/\\(.+\\)" . "\\1")
("avy-goto-word-or-subword-1" . "avy word")
("shell-command" . "shell cmd")
("spacemacs/default-pop-shell" . "open shell")
("spacemacs/helm-project-smart-do-search-region-or-symbol" . "smart search w/input")
("spacemacs/helm-project-smart-do-search" . "smart search")
("spacemacs/search-project-auto-region-or-symbol" . "search project w/input")
("spacemacs/helm-project-smart-do-search-region-or-symbol" . "smart search w/input")
("spacemacs/search-project-auto" . "search project")
("helm-descbinds" . "show keybindings")
("sp-split-sexp" . "split sexp")
("spacemacs/search-project-auto-region-or-symbol" . "search project w/input")
("spacemacs/toggle-holy-mode" . "emacs (holy-mode)")
("spacemacs/toggle-hybrid-mode" . "hybrid (hybrid-mode)")
("spacemacs/toggle-mode-line-\\(.+\\)" . "\\1")
("avy-goto-line" . "avy line")
("universal-argument" . "universal arg")
("avy-goto-word-or-subword-1" . "avy word")
("er/expand-region" . "expand region")
("helm-apropos" . "apropos")
("spacemacs/toggle-hybrid-mode" . "hybrid (hybrid-mode)")
("spacemacs/toggle-holy-mode" . "emacs (holy-mode)")
("evil-lisp-state-\\(.+\\)" . "\\1")
("spacemacs/\\(.+\\)-transient-state/\\(.+\\)" . "\\2")
("spacemacs/\\(.+\\)-transient-state/body" . "\\1-transient-state")
("helm-apropos" . "apropos")
("helm-descbinds" . "show keybindings")
("helm-mini\\|ivy-switch-buffer" . "list-buffers")
("spacemacs-layouts/non-restricted-buffer-list-\\(helm\\|ivy\\)" . "global-list-buffers"))))
("lazy-helm/\\(.+\\)" . "\\1")
("lazy-helm/spacemacs/\\(.+\\)" . "\\1")
("shell-command" . "shell cmd")
("sp-split-sexp" . "split sexp")
("universal-argument" . "universal arg")
)))
(dolist (nd new-descriptions)
;; ensure the target matches the whole string
(push (cons (cons nil (concat "\\`" (car nd) "\\'")) (cons nil (cdr nd)))
Expand Down Expand Up @@ -484,16 +498,6 @@
(`bottom (which-key-setup-side-window-bottom))
(`right-then-bottom (which-key-setup-side-window-right-bottom)))

(setq which-key-special-keys nil
which-key-use-C-h-for-paging t
which-key-prevent-C-h-from-cycling t
which-key-echo-keystrokes 0.02
which-key-max-description-length 32
which-key-sort-order 'which-key-key-order-alpha
which-key-idle-delay dotspacemacs-which-key-delay
which-key-idle-secondary-delay 0.01
which-key-allow-evil-operators t)

(which-key-mode)
(spacemacs|diminish which-key-mode "" " K"))

Expand Down

0 comments on commit 3dd7539

Please sign in to comment.