;;; which-key-settings.el --- which-key settings -*- mode: emacs-lisp; lexical-binding: t -*- ;;; Commentary: ;; https://melpa.org/#/which-key ;; https://github.com/justbur/emacs-which-key ;;; Code: ;; variables which needs to be set before loading which-key-mode ;; https://github.com/justbur/emacs-which-key#manual-activation ;;(setq which-key-show-early-on-C-h t) ;; Allow C-h to trigger which-key before it is done automatically (use-package which-key :delight (which-key-mode "K") ;; \u24C0 K :init (setq which-key-idle-delay 0.75) (setq which-key-idle-secondary-delay 0.05) ;;(setq which-key-unicode-correction 3) (when (daemonp) ;; problem if using unicodes and emacsclient, the last line of which-key side-frame is cropped. (setq which-key-dont-use-unicode t)) :config (which-key-mode) (setq which-key-allow-multiple-replacements t) (unless (daemonp) ;; problem if using unicodes and emacsclient, the last line of which-key side-frame is cropped. (add-to-list 'which-key-replacement-alist '(("TAB" . nil) . ("↹" . nil))) (add-to-list 'which-key-replacement-alist '(("RET" . nil) . ("⏎" . nil))) (add-to-list 'which-key-replacement-alist '(("DEL" . nil) . ("⇤" . nil))) (add-to-list 'which-key-replacement-alist '(("SPC" . nil) . ("␣" . nil))) (add-to-list 'which-key-replacement-alist '(("" . nil) . ("↑" . nil))) (add-to-list 'which-key-replacement-alist '(("" . nil) . ("↓" . nil))) ;;(add-to-list 'which-key-replacement-alist '(("" . nil) . ("←" . nil))) ; already in ;;(add-to-list 'which-key-replacement-alist '(("" . nil) . ("→" . nil))) ; already in (setq which-key-special-keys '("SPC" "TAB" "RET" "ESC" "DEL")) ;; automatically truncated to one character ) ;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Keymaps.html#Creating-Keymaps (setq meta-m-map (make-sparse-keymap)) (define-prefix-command 'meta-m-map) ;; define new prefix (global-set-key (kbd "M-m") 'meta-m-map) ;; set new prefix to M-m ;;(global-set-key (kbd "M-m SPC") 'counsel-M-x) ;; TODO (global-set-key (kbd "M-m h k") 'which-key-show-top-level) (global-set-key (kbd "M-m t K") 'which-key-mode) ;; define prefix names ;; formaly which-key-declare-prefixes ;; blob/c7a103a772d808101d7635ec10f292ab9202d9ee/layers/%2Bdistributions/spacemacs-base/packages.el (which-key-add-key-based-replacements "C-c !" "flyspell" "C-c ," "semantic/senator" "C-x RET" "coding-system" "C-x 8" "char" "C-x X" "edebug" "C-x a" "abbrev" "C-x n" "narrow" "C-x p" "project" "C-x r" "register/rectangle/bookmark" "C-x t" "tab" "C-x w" "window" "M-m" '("root" . "My root") "M-m a" "applications" "M-m b" "buffers" "M-m c" "compile/comments" "M-m e" "errors" "M-m f" "files" "M-m f v" "variables" "M-m h" "help" "M-m h d" "describe" "M-m j" "jump/join/split" "M-m m" '("major-mode-cmd" . "Major mode commands") "M-m M-m" "M-x" "M-m n" "narrow/numbers" "M-m q" "quit" "M-m s" "misc." "M-m s m" "multiple-cursors" "M-m s m s" "specials" "M-m t" "toggles" "M-m t h" "highlight" "M-m t m" "modeline" "M-m T" "UI toggles/themes" "M-m w" "windows" "M-m x" "text" "M-m x a" "align" "M-m x d" "delete" "M-m x j" "justification" "M-m x l" "lines" "M-m x t" "transpose" ) (which-key-add-major-mode-key-based-replacements 'python-mode "M-m m c" "execute" "M-m m d" "debug" "M-m m s" "REPL" ;; REPL read-eval-print-loop / interactive toplevel / language shell ) ;;(set-face-foreground 'font-lock-keyword-face "Purple") ;;(set-face-attribute 'which-key-group-description-face nil :inherit nil) ;;(set-face-attribute 'which-key-group-description-face nil :inherit font-lock-keyword-face) ) (provide 'which-key-settings) ;;; which-key-settings.el ends here