diff --git a/contrib/which-key/README.org b/contrib/which-key/README.org deleted file mode 100644 index 81e4012c8..000000000 --- a/contrib/which-key/README.org +++ /dev/null @@ -1,18 +0,0 @@ -#+TITLE: Which-key contribution layer for Spacemacs - -* Table of Contents :TOC@4: - - [[#description][Description]] - - [[#install][Install]] - -* Description - -This layer is a work in progress to test [[https://github.com/justbur/emacs-which-key][which-key]] package in Spacemacs. -=which-key= is aimed to replace =guide-key=, it is developed by [[https://github.com/justbur][justbur]]. - -* Install - -To use this contribution add it to your =~/.spacemacs= - -#+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-configuration-layers '(which-key)) -#+END_SRC diff --git a/contrib/which-key/packages.el b/contrib/which-key/packages.el deleted file mode 100644 index 73f91c066..000000000 --- a/contrib/which-key/packages.el +++ /dev/null @@ -1,44 +0,0 @@ -(setq which-key-packages '(which-key)) - -(setq which-key-excluded-packages '(guide-key - guide-key-tip)) - -(defun which-key/init-which-key () - (use-package which-key - :init - (progn - (setq which-key-max-description-length 32) - (which-key-mode) - (spacemacs|add-toggle which-key - :status which-key-mode - :on (which-key-mode) - :off (which-key-mode -1) - :documentation - "Display a buffer with available key bindings." - :evil-leader "tK") - (defadvice which-key--update - (around spacemacs/inhibit-which-key-buffer activate) - "Prevent the popup of the which-key buffer in some case." - ;; a micro-state is running - ;; or - ;; bzg-big-fringe-mode is on - (if (or overriding-terminal-local-map - bzg-big-fringe-mode) - (let ((which-key-inhibit t)) ad-do-it) - ad-do-it)) - (add-to-list 'which-key-description-replacement-alist '("select-window-\\([0-9]\\)" . "Window \\1")) - (which-key-add-key-based-replacements - "SPC TAB" "last buffer" - "SPC SPC" "ace word" - "SPC !" "shell cmd" - "SPC '" "open shell" - "SPC /" "smart search" - "SPC ?" "show keybindings" - "SPC J" "split sexp" - "SPC l" "ace line" - "SPC u" "universal arg" - "SPC v" "expand region" - "SPC " "apropos" - "SPC m" "maj mode cmds" - (concat "SPC " dotspacemacs-command-key) "M-x") - (spacemacs|diminish which-key-mode " Ⓚ" " K")))) diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index e18783aa7..4c90f9364 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -115,8 +115,10 @@ initialization." (setq-default evil-want-C-u-scroll t) ;; Initializing configuration from ~/.spacemacs (dotspacemacs|call-func dotspacemacs/init "Executing user init...") + ;; mandatory dependencies ;; dash is required to prevent a package.el bug with f on 24.3.1 (spacemacs/load-or-install-package 'dash t) + (spacemacs/load-or-install-package 's t) ;; bind-key is required by use-package (spacemacs/load-or-install-package 'bind-key t) (spacemacs/load-or-install-package 'use-package t) @@ -124,6 +126,8 @@ initialization." ;; inject use-package hooks for easy customization of ;; stock package configuration (setq use-package-inject-hooks t) + ;; which-key + (spacemacs/load-or-install-package 'which-key t) ;; evil and evil-leader must be installed at the beginning of the ;; boot sequence. ;; Use C-u as scroll-up (must be set before actually loading evil) diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 356dcf382..7193b52e0 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -913,7 +913,7 @@ can be reached using the =control= key. | ~SPC t c~ | =none= | | fill-column-indicator mode | | ~SPC t F~ | =Ⓕ= | F | auto-fill mode | | ~SPC t g~ | =ⓖ= | g | [[https://github.com/roman/golden-ratio.el][golden-ratio]] mode | -| ~SPC t k~ | =Ⓖ= | G | guide-key mode | +| ~SPC t G~ | =Ⓖ= | G | guide-key mode | | ~SPC t i~ | =ⓘ= | i | indentation guide | | ~SPC t C-i~ | =ⓘ= | i | global indentation guide | | ~SPC t I~ | =Ⓘ= | I | aggressive indent mode | diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 064f06a97..3a87d8872 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -57,7 +57,7 @@ gh-md golden-ratio google-translate - guide-key-tip + ;; guide-key-tip helm helm-ag helm-descbinds @@ -100,6 +100,7 @@ vi-tilde-fringe volatile-highlights whitespace + which-key window-numbering winner )) @@ -1285,63 +1286,63 @@ Example: (evil-map visual \"<\" \"m" - ;; C-M-m in terminal - "" - "g" - "\[" - "\]" - "z" - "C-h") - guide-key/recursive-key-sequence-flag t - guide-key/popup-window-position 'bottom - guide-key/idle-delay dotspacemacs-guide-key-delay - guide-key/text-scale-amount 0 - ;; use this in your ~/.spacemacs file to enable tool tip in a - ;; graphical envrionment - ;; guide-key-tip/enabled (if window-system t) - guide-key-tip/enabled nil) - (setq guide-key/highlight-command-regexp - (cons spacemacs/prefix-command-string font-lock-warning-face)) - (guide-key-mode 1) - (spacemacs|diminish guide-key-mode " Ⓖ" " G")))) +;; (setq guide-key/guide-key-sequence `("C-x" +;; "C-c" +;; "C-w" +;; ,dotspacemacs-leader-key +;; ,dotspacemacs-emacs-leader-key +;; ,dotspacemacs-major-mode-leader-key +;; ,dotspacemacs-major-mode-emacs-leader-key +;; ;; M-m in terminal +;; "m" +;; ;; C-M-m in terminal +;; "" +;; "g" +;; "\[" +;; "\]" +;; "z" +;; "C-h") +;; guide-key/recursive-key-sequence-flag t +;; guide-key/popup-window-position 'bottom +;; guide-key/idle-delay dotspacemacs-guide-key-delay +;; guide-key/text-scale-amount 0 +;; ;; use this in your ~/.spacemacs file to enable tool tip in a +;; ;; graphical envrionment +;; ;; guide-key-tip/enabled (if window-system t) +;; guide-key-tip/enabled nil) +;; (setq guide-key/highlight-command-regexp +;; (cons spacemacs/prefix-command-string font-lock-warning-face)) +;; (guide-key-mode 1) +;; (spacemacs|diminish guide-key-mode " Ⓖ" " G")))) (defun spacemacs/init-helm () (use-package helm @@ -3205,6 +3206,46 @@ It is a string holding: (spacemacs|diminish whitespace-mode " ⓦ" " w") (spacemacs|diminish global-whitespace-mode " Ⓦ" " W")))) +(defun spacemacs/init-which-key () + (use-package which-key + :init + (progn + (setq which-key-max-description-length 32) + (which-key-mode) + (spacemacs|add-toggle which-key + :status which-key-mode + :on (which-key-mode) + :off (which-key-mode -1) + :documentation + "Display a buffer with available key bindings." + :evil-leader "tK") + (defadvice which-key--update + (around spacemacs/inhibit-which-key-buffer activate) + "Prevent the popup of the which-key buffer in some case." + ;; a micro-state is running + ;; or + ;; bzg-big-fringe-mode is on + (if (or overriding-terminal-local-map + bzg-big-fringe-mode) + (let ((which-key-inhibit t)) ad-do-it) + ad-do-it)) + (add-to-list 'which-key-description-replacement-alist '("select-window-\\([0-9]\\)" . "Window \\1")) + (which-key-add-key-based-replacements + "SPC TAB" "last buffer" + "SPC SPC" "ace word" + "SPC !" "shell cmd" + "SPC '" "open shell" + "SPC /" "smart search" + "SPC ?" "show keybindings" + "SPC J" "split sexp" + "SPC l" "ace line" + "SPC u" "universal arg" + "SPC v" "expand region" + "SPC " "apropos" + "SPC m" "maj mode cmds" + (concat "SPC " dotspacemacs-command-key) "M-x") + (spacemacs|diminish which-key-mode " Ⓚ" " K")))) + (defun spacemacs/init-window-numbering () (use-package window-numbering ;; not deferred on puprose