Browse Source

Change which-key key order

master
Riyyi 4 years ago
parent
commit
b2c8e4f23d
  1. 86
      .emacs.d/config.org

86
.emacs.d/config.org

@ -193,7 +193,7 @@ Install and configure packages.
(which-key-add-column-padding 1) (which-key-add-column-padding 1)
(which-key-max-display-columns nil) (which-key-max-display-columns nil)
(which-key-min-display-lines 5) (which-key-min-display-lines 5)
(which-key-sort-order 'which-key-prefix-then-key-order) (which-key-sort-order 'dot/which-key-prefix-then-key-order-alpha)
(which-key-sort-uppercase-first nil)) (which-key-sort-uppercase-first nil))
(use-package general) (use-package general)
@ -1082,7 +1082,7 @@ Functions that use package functionality.
name) name)
))) )))
(defun dot/buffer-cleanup () (defun dot/centaur-tabs-buffer-cleanup ()
"Clean up all the hidden buffers." "Clean up all the hidden buffers."
(interactive) (interactive)
(dolist (buffer (buffer-list)) (dolist (buffer (buffer-list))
@ -1091,7 +1091,7 @@ Functions that use package functionality.
) )
) )
(defun dot/kill-buffer-or-window () (defun dot/centaur-tabs-kill-buffer-or-window ()
"Delete window of the current buffer, also kill if the buffer is hidden." "Delete window of the current buffer, also kill if the buffer is hidden."
(interactive) (interactive)
(if (centaur-tabs-hide-tab (buffer-name)) (if (centaur-tabs-hide-tab (buffer-name))
@ -1109,6 +1109,16 @@ Functions that use package functionality.
(dashboard-refresh-buffer)) (dashboard-refresh-buffer))
(switch-to-buffer buffer))) (switch-to-buffer buffer)))
(with-eval-after-load 'which-key
(defun dot/which-key-prefix-then-key-order-alpha (acons bcons)
"Order y prefix, then lexicographical."
(let ((apref? (which-key--group-p (cdr acons)))
(bpref? (which-key--group-p (cdr bcons))))
(if (not (eq apref? bpref?))
(and (not apref?) bpref?)
(which-key-key-order-alpha acons bcons))))
)
(defun dashboard-goto-bookmarks () (defun dashboard-goto-bookmarks ()
"Go to bookmarks." "Go to bookmarks."
(interactive) (interactive)
@ -1400,21 +1410,21 @@ General.el ~leader key binds.
"RET" '(bookmark-jump :which-key "Jump to bookmark") "RET" '(bookmark-jump :which-key "Jump to bookmark")
;; Buffer / bookmark ;; Buffer / bookmark
"b" '(:ignore t :which-key "buffer/bookmark") "b" '(:ignore t :which-key "buffer/bookmark")
"b a" '(auto-revert-mode :which-key "Auto revert buffer") "b a" '(auto-revert-mode :which-key "Auto revert buffer")
"b b" '(switch-to-buffer :which-key "Switch buffer") "b b" '(switch-to-buffer :which-key "Switch buffer")
"b d" '(dot/go-to-dashboard :which-key "Dashboard") "b d" '(dot/go-to-dashboard :which-key "Dashboard")
"b k" '(kill-current-buffer :which-key "Kill buffer") "b k" '(kill-current-buffer :which-key "Kill buffer")
"b m" '(bookmark-set :which-key "Make bookmark") "b m" '(bookmark-set :which-key "Make bookmark")
"b n" '(evil-buffer-new :which-key "New empty buffer") "b n" '(evil-buffer-new :which-key "New empty buffer")
"b r" '(revert-buffer :which-key "Revert buffer") "b r" '(revert-buffer :which-key "Revert buffer")
"b s" '(basic-save-buffer :which-key "Save buffer") "b s" '(basic-save-buffer :which-key "Save buffer")
"b B" '(ibuffer :which-key "List buffers") "b B" '(ibuffer :which-key "List buffers")
"b C" '(dot/buffer-cleanup :which-key "Cleanup buffers") "b C" '(dot/centaur-tabs-buffer-cleanup :which-key "Cleanup buffers")
"b M" '(bookmark-delete :which-key "Delete bookmark") "b M" '(bookmark-delete :which-key "Delete bookmark")
"b S" '(evil-write-all :which-key "Save all buffers") "b S" '(evil-write-all :which-key "Save all buffers")
"b <left>" '(previous-buffer :which-key "Previous buffer") "b <left>" '(previous-buffer :which-key "Previous buffer")
"b <right>" '(next-buffer :which-key "Next buffer") "b <right>" '(next-buffer :which-key "Next buffer")
;; Comments / config ;; Comments / config
"c" '(:ignore t :which-key "comment/config") "c" '(:ignore t :which-key "comment/config")
@ -1494,26 +1504,26 @@ General.el ~leader key binds.
"u" '(auto-package-update-now :which-key "Update packages") "u" '(auto-package-update-now :which-key "Update packages")
;; Window ;; Window
"w" '(:ignore t :which-key "window") "w" '(:ignore t :which-key "window")
"w +" '(evil-window-increase-height :which-key "Increase window height") "w +" '(evil-window-increase-height :which-key "Increase window height")
"w -" '(evil-window-decrease-height :which-key "Decrease window height") "w -" '(evil-window-decrease-height :which-key "Decrease window height")
"w <" '(evil-window-decrease-width :which-key "Decrease window width") "w <" '(evil-window-decrease-width :which-key "Decrease window width")
"w =" '(balance-windows :which-key "Balance windows") "w =" '(balance-windows :which-key "Balance windows")
"w >" '(evil-window-increase-width :which-key "Increase window width") "w >" '(evil-window-increase-width :which-key "Increase window width")
"w _" '(evil-window-set-height :which-key "Maximize window height") "w _" '(evil-window-set-height :which-key "Maximize window height")
"w h" '(windmove-left :which-key "Focus window left") "w h" '(windmove-left :which-key "Focus window left")
"w j" '(windmove-down :which-key "Focus window down") "w j" '(windmove-down :which-key "Focus window down")
"w k" '(windmove-up :which-key "Focus window up") "w k" '(windmove-up :which-key "Focus window up")
"w l" '(windmove-right :which-key "Focus window right") "w l" '(windmove-right :which-key "Focus window right")
"w o" '(delete-other-windows :which-key "Close other windows") "w o" '(delete-other-windows :which-key "Close other windows")
"w s" '(split-follow-horizontally :which-key "Split horizontal") "w s" '(split-follow-horizontally :which-key "Split horizontal")
"w v" '(split-follow-vertically :which-key "Split vertical") "w v" '(split-follow-vertically :which-key "Split vertical")
"w w" '(other-window :which-key "Focus other window") "w w" '(other-window :which-key "Focus other window")
"w q" '(dot/kill-buffer-or-window :which-key "Close window") "w q" '(dot/centaur-tabs-kill-buffer-or-window :which-key "Close window")
"w <left>" '(windmove-left :which-key "Focus window left") "w <left>" '(windmove-left :which-key "Focus window left")
"w <right>" '(windmove-right :which-key "Focus window right") "w <right>" '(windmove-right :which-key "Focus window right")
"w <up>" '(windmove-up :which-key "Focus window up") "w <up>" '(windmove-up :which-key "Focus window up")
"w <down>" '(windmove-down :which-key "Focus window down") "w <down>" '(windmove-down :which-key "Focus window down")
;; winner-redo (built-in window history) ;; winner-redo (built-in window history)
;; winner-undo ;; winner-undo
) )

Loading…
Cancel
Save