Autoload defhydras & use new naming convention

Phasing out the +module@name convention for plain old
+module-name-hydra, which is more compatible with elisp reflection tools
like describe-function and such.

Also, Emacs starts up faster now. Tee hee.
This commit is contained in:
Henrik Lissner 2018-06-26 01:42:35 +02:00
parent 3134df8f43
commit 017ba8d79c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
10 changed files with 178 additions and 181 deletions

47
core/autoload/hydras.el Normal file
View file

@ -0,0 +1,47 @@
;;; core/autoload/hydras.el -*- lexical-binding: t; -*-
;;;###autoload (autoload 'doom-text-zoom-hydra/body "core/autoload/hydras" nil nil)
(defhydra doom-text-zoom-hydra (:hint t :color red)
"
Text zoom: _j_:zoom in, _k_:zoom out, _0_:reset
"
("j" text-scale-increase "in")
("k" text-scale-decrease "out")
("0" (text-scale-set 0) "reset"))
;;;###autoload (autoload 'doom-window-nav-hydra/body "core/autoload/hydras" nil nil)
(defhydra doom-window-nav-hydra (:hint nil)
"
Split: _v_ert _s_:horz
Delete: _c_lose _o_nly
Switch Window: _h_:left _j_:down _k_:up _l_:right
Buffers: _p_revious _n_ext _b_:select _f_ind-file
Resize: _H_:splitter left _J_:splitter down _K_:splitter up _L_:splitter right
Move: _a_:up _z_:down _i_menu
"
("z" scroll-up-line)
("a" scroll-down-line)
("i" idomenu)
("h" windmove-left)
("j" windmove-down)
("k" windmove-up)
("l" windmove-right)
("p" previous-buffer)
("n" next-buffer)
("b" switch-to-buffer)
("f" find-file)
("s" split-window-below)
("v" split-window-right)
("c" delete-window)
("o" delete-other-windows)
("H" hydra-move-splitter-left)
("J" hydra-move-splitter-down)
("K" hydra-move-splitter-up)
("L" hydra-move-splitter-right)
("q" nil))

View file

@ -63,54 +63,8 @@ If any hook returns non-nil, all hooks after it are ignored.")
(which-key-mode +1))
(def-package! hydra
:defer t
:config
(setq lv-use-seperator t)
(defhydra doom@text-zoom (:hint t :color red)
"
Text zoom: _j_:zoom in, _k_:zoom out, _0_:reset
"
("j" text-scale-increase "in")
("k" text-scale-decrease "out")
("0" (text-scale-set 0) "reset"))
(defhydra doom@window-nav (:hint nil)
"
Split: _v_ert _s_:horz
Delete: _c_lose _o_nly
Switch Window: _h_:left _j_:down _k_:up _l_:right
Buffers: _p_revious _n_ext _b_:select _f_ind-file
Resize: _H_:splitter left _J_:splitter down _K_:splitter up _L_:splitter right
Move: _a_:up _z_:down _i_menu
"
("z" scroll-up-line)
("a" scroll-down-line)
("i" idomenu)
("h" windmove-left)
("j" windmove-down)
("k" windmove-up)
("l" windmove-right)
("p" previous-buffer)
("n" next-buffer)
("b" switch-to-buffer)
("f" find-file)
("s" split-window-below)
("v" split-window-right)
("c" delete-window)
("o" delete-other-windows)
("H" hydra-move-splitter-left)
("J" hydra-move-splitter-down)
("K" hydra-move-splitter-up)
("L" hydra-move-splitter-right)
("q" nil)))
;; `hydra'
(setq lv-use-seperator t)
;;

View file

@ -0,0 +1,43 @@
;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*-
;;;###autoload (autoload '+ivy-coo-hydra/body "completion/ivy/autoload/hydras" nil nil)
(defhydra +ivy-coo-hydra (:hint nil :color pink)
"
Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name)
----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+---------------------------------
_g_ ^ ^ _k_ ^ ^ _u_ | _f_orward _o_ccur | _i_nsert | _c_alling: %-7s(if ivy-calling \"on\" \"off\") _C_ase-fold: %-10`ivy-case-fold-search
^^ _h_ ^+^ _l_ ^^ | _RET_ done ^^ | _q_uit | _m_atcher: %-7s(ivy--matcher-desc) _t_runcate: %-11`truncate-lines
_G_ ^ ^ _j_ ^ ^ _d_ | _TAB_ alt-done ^^ | ^ ^ | _<_/_>_: shrink/grow
"
;; arrows
("j" ivy-next-line)
("k" ivy-previous-line)
("l" ivy-alt-done)
("h" ivy-backward-delete-char)
("g" ivy-beginning-of-buffer)
("G" ivy-end-of-buffer)
("d" ivy-scroll-up-command)
("u" ivy-scroll-down-command)
("e" ivy-scroll-down-command)
;; actions
("q" keyboard-escape-quit :exit t)
("C-g" keyboard-escape-quit :exit t)
("<escape>" keyboard-escape-quit :exit t)
("C-o" nil)
("i" nil)
("TAB" ivy-alt-done :exit nil)
("C-j" ivy-alt-done :exit nil)
("RET" ivy-done :exit t)
("C-m" ivy-done :exit t)
("C-SPC" ivy-call-and-recenter :exit nil)
("f" ivy-call)
("c" ivy-toggle-calling)
("m" ivy-toggle-fuzzy)
(">" ivy-minibuffer-grow)
("<" ivy-minibuffer-shrink)
("w" ivy-prev-action)
("s" ivy-next-action)
("a" ivy-read-action)
("t" (setq truncate-lines (not truncate-lines)))
("C" ivy-toggle-case-fold)
("o" ivy-occur :exit t))

View file

@ -126,49 +126,8 @@ immediately runs it on the current candidate (ending the ivy session)."
:init
(after! ivy
(define-key! ivy-minibuffer-map
"\C-o" #'+ivy@coo/body
(kbd "M-o") #'ivy-dispatching-done-hydra))
:config
(defhydra +ivy@coo (:hint nil :color pink)
"
Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name)
----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+---------------------------------
_g_ ^ ^ _k_ ^ ^ _u_ | _f_orward _o_ccur | _i_nsert | _c_alling: %-7s(if ivy-calling \"on\" \"off\") _C_ase-fold: %-10`ivy-case-fold-search
^^ _h_ ^+^ _l_ ^^ | _RET_ done ^^ | _q_uit | _m_atcher: %-7s(ivy--matcher-desc) _t_runcate: %-11`truncate-lines
_G_ ^ ^ _j_ ^ ^ _d_ | _TAB_ alt-done ^^ | ^ ^ | _<_/_>_: shrink/grow
"
;; arrows
("j" ivy-next-line)
("k" ivy-previous-line)
("l" ivy-alt-done)
("h" ivy-backward-delete-char)
("g" ivy-beginning-of-buffer)
("G" ivy-end-of-buffer)
("d" ivy-scroll-up-command)
("u" ivy-scroll-down-command)
("e" ivy-scroll-down-command)
;; actions
("q" keyboard-escape-quit :exit t)
("C-g" keyboard-escape-quit :exit t)
("<escape>" keyboard-escape-quit :exit t)
("C-o" nil)
("i" nil)
("TAB" ivy-alt-done :exit nil)
("C-j" ivy-alt-done :exit nil)
("RET" ivy-done :exit t)
("C-m" ivy-done :exit t)
("C-SPC" ivy-call-and-recenter :exit nil)
("f" ivy-call)
("c" ivy-toggle-calling)
("m" ivy-toggle-fuzzy)
(">" ivy-minibuffer-grow)
("<" ivy-minibuffer-shrink)
("w" ivy-prev-action)
("s" ivy-next-action)
("a" ivy-read-action)
("t" (setq truncate-lines (not truncate-lines)))
("C" ivy-toggle-case-fold)
("o" ivy-occur :exit t)))
"\C-o" #'+ivy-coo-hydra/body
(kbd "M-o") #'ivy-dispatching-done-hydra)))
(def-package! wgrep

View file

@ -34,4 +34,47 @@
(goto-char (1+ res))
(widget-button-press (point)))))
;;;###autoload (autoload '+ein-hydra/body "tools/ein/autoload" nil nil)
(defhydra +ein-hydra (:hint t :color red)
"
Operations on Cells^^^^^^ Other
----------------------------^^^^^^ ----------------------------------^^^^
[_k_/_j_]^^ select prev/next [_t_]^^ toggle output
[_K_/_J_]^^ move up/down [_C-l_/_C-S-l_] clear/clear all output
[_C-k_/_C-j_]^^ merge above/below [_C-o_]^^ open console
[_O_/_o_]^^ insert above/below [_C-s_/_C-r_] save/rename notebook
[_y_/_p_/_d_] copy/paste [_x_]^^ close notebook
[_u_]^^^^ change type [_q_]^^ quit
[_RET_]^^^^ execute
"
("q" nil :exit t)
("h" ein:notebook-worksheet-open-prev-or-last)
("j" ein:worksheet-goto-next-input)
("k" ein:worksheet-goto-prev-input)
("l" ein:notebook-worksheet-open-next-or-first)
("H" ein:notebook-worksheet-move-prev)
("J" ein:worksheet-move-cell-down)
("K" ein:worksheet-move-cell-up)
("L" ein:notebook-worksheet-move-next)
("t" ein:worksheet-toggle-output)
("d" ein:worksheet-kill-cell)
("R" ein:worksheet-rename-sheet)
("y" ein:worksheet-copy-cell)
("p" ein:worksheet-yank-cell)
("o" ein:worksheet-insert-cell-below)
("O" ein:worksheet-insert-cell-above)
("u" ein:worksheet-change-cell-type)
("RET" ein:worksheet-execute-cell-and-goto-next)
;; Output
("C-l" ein:worksheet-clear-output)
("C-S-l" ein:worksheet-clear-all-output)
;;Console
("C-o" ein:console-open :exit t)
;; Merge and split cells
("C-k" ein:worksheet-merge-cell)
("C-j" spacemacs/ein:worksheet-merge-cell-next)
("s" ein:worksheet-split-cell-at-point)
;; Notebook
("C-s" ein:notebook-save-notebook-command)
("C-r" ein:notebook-rename-command)
("x" ein:notebook-close :exit t))

View file

@ -40,49 +40,4 @@
;; Ace-link on notebook list buffers
(after! ein-notebooklist
(define-key ein:notebooklist-mode-map "o" #'+ein/ace-link-ein))
;; add hydra
(defhydra +ein/hydra (:hint t :color red)
"
Operations on Cells^^^^^^ Other
----------------------------^^^^^^ ----------------------------------^^^^
[_k_/_j_]^^ select prev/next [_t_]^^ toggle output
[_K_/_J_]^^ move up/down [_C-l_/_C-S-l_] clear/clear all output
[_C-k_/_C-j_]^^ merge above/below [_C-o_]^^ open console
[_O_/_o_]^^ insert above/below [_C-s_/_C-r_] save/rename notebook
[_y_/_p_/_d_] copy/paste [_x_]^^ close notebook
[_u_]^^^^ change type [_q_]^^ quit
[_RET_]^^^^ execute
"
("q" nil :exit t)
("h" ein:notebook-worksheet-open-prev-or-last)
("j" ein:worksheet-goto-next-input)
("k" ein:worksheet-goto-prev-input)
("l" ein:notebook-worksheet-open-next-or-first)
("H" ein:notebook-worksheet-move-prev)
("J" ein:worksheet-move-cell-down)
("K" ein:worksheet-move-cell-up)
("L" ein:notebook-worksheet-move-next)
("t" ein:worksheet-toggle-output)
("d" ein:worksheet-kill-cell)
("R" ein:worksheet-rename-sheet)
("y" ein:worksheet-copy-cell)
("p" ein:worksheet-yank-cell)
("o" ein:worksheet-insert-cell-below)
("O" ein:worksheet-insert-cell-above)
("u" ein:worksheet-change-cell-type)
("RET" ein:worksheet-execute-cell-and-goto-next)
;; Output
("C-l" ein:worksheet-clear-output)
("C-S-l" ein:worksheet-clear-all-output)
;;Console
("C-o" ein:console-open :exit t)
;; Merge and split cells
("C-k" ein:worksheet-merge-cell)
("C-j" spacemacs/ein:worksheet-merge-cell-next)
("s" ein:worksheet-split-cell-at-point)
;; Notebook
("C-s" ein:notebook-save-notebook-command)
("C-r" ein:notebook-rename-command)
("x" ein:notebook-close :exit t)))
(define-key ein:notebooklist-mode-map "o" #'+ein/ace-link-ein)))

View file

@ -0,0 +1,13 @@
;;; tools/rgb/autoload.el -*- lexical-binding: t; -*-
;;;###autoload (autoload '+rgb-kurecolor-hydra/body "tools/rgb/autoload" nil nil)
(defhydra +rgb-kurecolor-hydra (:color pink :hint nil)
"
Inc/Dec _w_/_W_ brightness _d_/_D_ saturation _e_/_E_ hue "
("w" kurecolor-decrease-brightness-by-step)
("W" kurecolor-increase-brightness-by-step)
("d" kurecolor-decrease-saturation-by-step)
("D" kurecolor-increase-saturation-by-step)
("e" kurecolor-decrease-hue-by-step)
("E" kurecolor-increase-hue-by-step)
("q" nil "cancel" :color blue))

View file

@ -1,19 +0,0 @@
;;; tools/rgb/config.el -*- lexical-binding: t; -*-
;;
;; Plugins
;;
(def-package! kurecolor
:after rainbow-mode
:config
(defhydra +rgb@kurecolor (:color pink :hint nil)
"
Inc/Dec _w_/_W_ brightness _d_/_D_ saturation _e_/_E_ hue "
("w" kurecolor-decrease-brightness-by-step)
("W" kurecolor-increase-brightness-by-step)
("d" kurecolor-decrease-saturation-by-step)
("D" kurecolor-increase-saturation-by-step)
("e" kurecolor-decrease-hue-by-step)
("E" kurecolor-increase-hue-by-step)
("q" nil "cancel" :color blue)))

View file

@ -0,0 +1,26 @@
;;; ui/vc-gutter/autoload.el -*- lexical-binding: t; -*-
;;;###autoload (autoload '+vc-gutter-hydra/body "ui/vc-gutter/autoload" nil nil)
(defhydra +vc-gutter-hydra
(:body-pre (git-gutter-mode 1) :hint nil)
"
[git gutter]
Movement Hunk Actions Misc. +%-4s(car (git-gutter:statistic))/ -%-4s(cdr (git-gutter:statistic))
^_g_^ [_s_] stage [_R_] set start Rev
^_k_^ [_r_] revert
^ ^ [_m_] mark
^ ^ [_p_] popup
^_j_^ [_q_] quit
^_G_^ [_Q_] Quit and disable"
("j" (progn (git-gutter:next-hunk 1) (recenter)))
("k" (progn (git-gutter:previous-hunk 1) (recenter)))
("g" (progn (goto-char (point-min)) (git-gutter:next-hunk 1)))
("G" (progn (goto-char (point-min)) (git-gutter:previous-hunk 1)))
("s" git-gutter:stage-hunk)
("r" git-gutter:revert-hunk)
("m" git-gutter:mark-hunk)
("p" git-gutter:popup-hunk)
("R" git-gutter:set-start-revision)
("q" nil :color blue)
("Q" (git-gutter-mode -1) :color blue))

View file

@ -51,30 +51,6 @@ to the right fringe.")
;; update git-gutter when using these commands
(add-hook 'magit-post-refresh-hook #'+version-control|update-git-gutter)
(defhydra +version-control@git-gutter
(:body-pre (git-gutter-mode 1) :hint nil)
"
[git gutter]
Movement Hunk Actions Misc. +%-4s(car (git-gutter:statistic))/ -%-4s(cdr (git-gutter:statistic))
^_g_^ [_s_] stage [_R_] set start Rev
^_k_^ [_r_] revert
^ ^ [_m_] mark
^ ^ [_p_] popup
^_j_^ [_q_] quit
^_G_^ [_Q_] Quit and disable"
("j" (progn (git-gutter:next-hunk 1) (recenter)))
("k" (progn (git-gutter:previous-hunk 1) (recenter)))
("g" (progn (goto-char (point-min)) (git-gutter:next-hunk 1)))
("G" (progn (goto-char (point-min)) (git-gutter:previous-hunk 1)))
("s" git-gutter:stage-hunk)
("r" git-gutter:revert-hunk)
("m" git-gutter:mark-hunk)
("p" git-gutter:popup-hunk)
("R" git-gutter:set-start-revision)
("q" nil :color blue)
("Q" (git-gutter-mode -1) :color blue))
;; subtle diff indicators in the fringe
(when +vc-gutter-default-style
;; places the git gutter outside the margins.