diff --git a/core/core-keybinds.el b/core/core-keybinds.el index 7619a503b..d1d3a1041 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -199,10 +199,6 @@ localleader prefix." (which-key-mode +1)) -;;;###package hydra -(setq lv-use-seperator t) - - ;; ;;; `map!' macro diff --git a/core/packages.el b/core/packages.el index e88c26bee..3cef86642 100644 --- a/core/packages.el +++ b/core/packages.el @@ -38,7 +38,6 @@ ;; core-keybinds.el (package! general) (package! which-key) -(package! hydra) ;; autoload/debug.el (package! esup) diff --git a/init.example.el b/init.example.el index 6d05cb276..0ced5928b 100644 --- a/init.example.el +++ b/init.example.el @@ -25,6 +25,7 @@ doom-quit ; DOOM quit-message prompts when you quit Emacs ;;fill-column ; a `fill-column' indicator hl-todo ; highlight TODO/FIXME/NOTE tags + ;;hydra ;;indent-guides ; highlighted indent columns modeline ; snazzy, Atom-inspired modeline, plus API nav-flash ; blink the current line after jumping diff --git a/modules/completion/ivy/autoload/hydras.el b/modules/completion/ivy/autoload/hydras.el index 5f0f45708..ee71f5118 100644 --- a/modules/completion/ivy/autoload/hydras.el +++ b/modules/completion/ivy/autoload/hydras.el @@ -1,32 +1,33 @@ ;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui hydra) -;;;###autoload -(after! ivy-hydra - (with-no-warnings - (defhydra+ hydra-ivy (:hint nil :color pink) - " +(eval-when-compile (require 'ivy-hydra)) + +;;;###autoload (autoload 'hydra-ivy/body "completion/ivy/autoload/hydras" nil nil) +(defhydra+ hydra-ivy (: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 - ("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) - ("" keyboard-escape-quit :exit t) - ("TAB" ivy-alt-done :exit nil) - ("RET" ivy-done :exit t) - ("C-SPC" ivy-call-and-recenter :exit nil) - ("f" ivy-call) - ("c" ivy-toggle-calling) - ("m" ivy-toggle-fuzzy) - ("t" (setq truncate-lines (not truncate-lines))) - ("o" ivy-occur :exit t)))) + ;; arrows + ("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) + ("" keyboard-escape-quit :exit t) + ("TAB" ivy-alt-done :exit nil) + ("RET" ivy-done :exit t) + ("C-SPC" ivy-call-and-recenter :exit nil) + ("f" ivy-call) + ("c" ivy-toggle-calling) + ("m" ivy-toggle-fuzzy) + ("t" (setq truncate-lines (not truncate-lines))) + ("o" ivy-occur :exit t)) diff --git a/modules/emacs/vc/autoload/hydra.el b/modules/emacs/vc/autoload/hydra.el new file mode 100644 index 000000000..7b69d4602 --- /dev/null +++ b/modules/emacs/vc/autoload/hydra.el @@ -0,0 +1,41 @@ +;;; emacs/vc/autoload/hydra.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui hydra) + +;;;###autoload (autoload '+vc/smerge-hydra/body "emacs/vc/autoload/hydra" nil t) +(defhydra +vc/smerge-hydra (:hint nil + :pre (if (not smerge-mode) (smerge-mode 1)) + ;; Disable `smerge-mode' when quitting hydra if + ;; no merge conflicts remain. + :post (smerge-auto-leave)) + " + [smerge] + Movement Keep Diff Other + ╭─────────────────────────────────────────────────────────╯ + ^_g_^ [_b_] base [_<_] upper/base [_C_] Combine + ^_C-k_^ [_u_] upper [_=_] upper/lower [_r_] resolve + ^_k_ ↑^ [_l_] lower [_>_] base/lower [_R_] remove + ^_j_ ↓^ [_a_] all [_H_] hightlight + ^_C-j_^ [_RET_] current [_E_] ediff ╭────────── + ^_G_^ │ [_q_] quit +" + ("g" (progn (goto-char (point-min)) (smerge-next))) + ("G" (progn (goto-char (point-max)) (smerge-prev))) + ("C-j" smerge-next) + ("C-k" smerge-prev) + ("j" next-line) + ("k" previous-line) + ("b" smerge-keep-base) + ("u" smerge-keep-upper) + ("l" smerge-keep-lower) + ("a" smerge-keep-all) + ("RET" smerge-keep-current) + ("\C-m" smerge-keep-current) + ("<" smerge-diff-base-upper) + ("=" smerge-diff-upper-lower) + (">" smerge-diff-base-lower) + ("H" smerge-refine) + ("E" smerge-ediff) + ("C" smerge-combine-with-next) + ("r" smerge-resolve) + ("R" smerge-kill-current) + ("q" nil :color blue)) diff --git a/modules/emacs/vc/autoload/vc.el b/modules/emacs/vc/autoload/vc.el index 9edaff2ed..edb4f37b5 100644 --- a/modules/emacs/vc/autoload/vc.el +++ b/modules/emacs/vc/autoload/vc.el @@ -40,42 +40,3 @@ info in the `header-line-format' is a good indication." (propertize author 'face 'git-timemachine-minibuffer-author-face) (propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face) date-full date-relative)))) - -;;;###autoload (autoload '+vc-smerge-hydra/body "emacs/vc/autoload/vc" nil t) -(defhydra +vc-smerge-hydra (:hint nil - :pre (if (not smerge-mode) (smerge-mode 1)) - ;; Disable `smerge-mode' when quitting hydra if - ;; no merge conflicts remain. - :post (smerge-auto-leave)) - " - [smerge] - Movement Keep Diff Other - ╭─────────────────────────────────────────────────────────╯ - ^_g_^ [_b_] base [_<_] upper/base [_C_] Combine - ^_C-k_^ [_u_] upper [_=_] upper/lower [_r_] resolve - ^_k_ ↑^ [_l_] lower [_>_] base/lower [_R_] remove - ^_j_ ↓^ [_a_] all [_H_] hightlight - ^_C-j_^ [_RET_] current [_E_] ediff ╭────────── - ^_G_^ │ [_q_] quit -" - ("g" (progn (goto-char (point-min)) (smerge-next))) - ("G" (progn (goto-char (point-max)) (smerge-prev))) - ("C-j" smerge-next) - ("C-k" smerge-prev) - ("j" next-line) - ("k" previous-line) - ("b" smerge-keep-base) - ("u" smerge-keep-upper) - ("l" smerge-keep-lower) - ("a" smerge-keep-all) - ("RET" smerge-keep-current) - ("\C-m" smerge-keep-current) - ("<" smerge-diff-base-upper) - ("=" smerge-diff-upper-lower) - (">" smerge-diff-base-lower) - ("H" smerge-refine) - ("E" smerge-ediff) - ("C" smerge-combine-with-next) - ("r" smerge-resolve) - ("R" smerge-kill-current) - ("q" nil :color blue)) diff --git a/modules/tools/ein/README.org b/modules/tools/ein/README.org index 57e54381c..5c3c86124 100644 --- a/modules/tools/ein/README.org +++ b/modules/tools/ein/README.org @@ -55,7 +55,7 @@ Change ~+ein-notebook-dir~ to tell ein where to find your Jupityr notebooks. #+END_SRC ** Using hydra -This module provides a batteries-included hydra - ~+ein-hydra~ - to make using ein +This module provides a batteries-included hydra - ~+ein/hydra~ - to make using ein easier. Things like navigating between cells, workbook management etc, are greatly simplified and are easily accessible. However, by default, it's not bound to any key. Here's an example of how to bind it: @@ -63,6 +63,6 @@ Here's an example of how to bind it: #+BEGIN_SRC emacs-lisp (map! :map ein:notebook-mode-map :localleader - "," #'+ein-hydra/body) + "," #'+ein/hydra/body) #+END_SRC diff --git a/modules/tools/ein/autoload/ein.el b/modules/tools/ein/autoload/ein.el new file mode 100644 index 000000000..0740f4652 --- /dev/null +++ b/modules/tools/ein/autoload/ein.el @@ -0,0 +1,24 @@ +;;; tools/ein/autoload.el -*- lexical-binding: t; -*- + +(defun +ein--collect-ein-buffer-links () + (let ((end (window-end)) + points) + (save-excursion + (goto-char (window-start)) + (while (re-search-forward "~?/.+\\|\s\\[" end t) + (push (+ (match-beginning 0) 1) points)) + (nreverse points)))) + +;;;###autoload +(defun +ein/ace-link-ein () + "Ace jump to links in ein notebooklist." + (interactive) + (require 'avy) + (let ((res (avy-with +ein/ace-link-ein + (avy--process + (+ein--collect-ein-buffer-links) + #'avy--overlay-pre)))) + ;(avy--style-fn avy-style))))) + (when (numberp res) + (goto-char (1+ res)) + (widget-button-press (point))))) diff --git a/modules/tools/ein/autoload.el b/modules/tools/ein/autoload/hydra.el similarity index 67% rename from modules/tools/ein/autoload.el rename to modules/tools/ein/autoload/hydra.el index 0dd10d81a..c06b65f2e 100644 --- a/modules/tools/ein/autoload.el +++ b/modules/tools/ein/autoload/hydra.el @@ -1,30 +1,8 @@ -;;; tools/ein/autoload.el -*- lexical-binding: t; -*- +;;; tools/ein/autoload/hydra.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui hydra) -(defun +ein--collect-ein-buffer-links () - (let ((end (window-end)) - points) - (save-excursion - (goto-char (window-start)) - (while (re-search-forward "~?/.+\\|\s\\[" end t) - (push (+ (match-beginning 0) 1) points)) - (nreverse points)))) - -;;;###autoload -(defun +ein/ace-link-ein () - "Ace jump to links in ein notebooklist." - (interactive) - (require 'avy) - (let ((res (avy-with +ein/ace-link-ein - (avy--process - (+ein--collect-ein-buffer-links) - #'avy--overlay-pre)))) - ;(avy--style-fn avy-style))))) - (when (numberp res) - (goto-char (1+ res)) - (widget-button-press (point))))) - -;;;###autoload (autoload '+ein-hydra/body "tools/ein/autoload" nil t) -(defhydra +ein-hydra (:hint t :color red) +;;;###autoload (autoload '+ein/hydra/body "tools/ein/autoload" nil t) +(defhydra +ein/hydra (:hint t :color red) " Operations on Cells^^^^^^ Other ----------------------------^^^^^^ ----------------------------------^^^^ diff --git a/modules/tools/rgb/autoload.el b/modules/tools/rgb/autoload.el index 5fdedbe29..1036cd106 100644 --- a/modules/tools/rgb/autoload.el +++ b/modules/tools/rgb/autoload.el @@ -1,7 +1,8 @@ ;;; tools/rgb/autoload.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui hydra) -;;;###autoload (autoload '+rgb-kurecolor-hydra/body "tools/rgb/autoload" nil t) -(defhydra +rgb-kurecolor-hydra (:color pink :hint nil) +;;;###autoload (autoload '+rgb/kurecolor-hydra/body "tools/rgb/autoload" nil t) +(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) diff --git a/core/autoload/hydras.el b/modules/ui/hydra/autoload/windows.el similarity index 74% rename from core/autoload/hydras.el rename to modules/ui/hydra/autoload/windows.el index 6ab2dd7a4..6d703ad81 100644 --- a/core/autoload/hydras.el +++ b/modules/ui/hydra/autoload/windows.el @@ -1,7 +1,7 @@ -;;; core/autoload/hydras.el -*- lexical-binding: t; no-byte-compile: t; -*- +;;; ui/hydra/autoload/windows.el -*- lexical-binding: t; -*- -;;;###autoload (autoload 'doom-text-zoom-hydra/body "core/autoload/hydras" nil t) -(defhydra doom-text-zoom-hydra (:hint t :color red) +;;;###autoload (autoload '+hydra/text-zoom/body "ui/hydra/autoload/windows" nil t) +(defhydra +hydra/text-zoom (:hint t :color red) " Text zoom: _j_:zoom in, _k_:zoom out, _0_:reset " @@ -9,8 +9,8 @@ ("k" doom/decrease-font-size "out") ("0" doom/reset-font-size "reset")) -;;;###autoload (autoload 'doom-window-nav-hydra/body "core/autoload/hydras" nil t) -(defhydra doom-window-nav-hydra (:hint nil) +;;;###autoload (autoload '+hydra/window-nav/body "ui/hydra/autoload/windows" nil t) +(defhydra +hydra/window-nav (:hint nil) " Split: _v_ert _s_:horz Delete: _c_lose _o_nly diff --git a/modules/ui/hydra/config.el b/modules/ui/hydra/config.el new file mode 100644 index 000000000..4d8bdb3fb --- /dev/null +++ b/modules/ui/hydra/config.el @@ -0,0 +1,4 @@ +;;; ui/hydra/config.el -*- lexical-binding: t; -*- + +;;;###package hydra +(setq lv-use-seperator t) diff --git a/modules/ui/hydra/packages.el b/modules/ui/hydra/packages.el new file mode 100644 index 000000000..f92e067e0 --- /dev/null +++ b/modules/ui/hydra/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; ui/hydra/packages.el + +(package! hydra) diff --git a/modules/ui/vc-gutter/autoload.el b/modules/ui/vc-gutter/autoload.el index bac2c9e90..741080d86 100644 --- a/modules/ui/vc-gutter/autoload.el +++ b/modules/ui/vc-gutter/autoload.el @@ -1,7 +1,8 @@ ;;; ui/vc-gutter/autoload.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui hydra) -;;;###autoload (autoload '+vc-gutter-hydra/body "ui/vc-gutter/autoload" nil t) -(defhydra +vc-gutter-hydra +;;;###autoload (autoload '+vc/gutter-hydra/body "ui/vc-gutter/autoload" nil t) +(defhydra +vc/gutter-hydra (:body-pre (git-gutter-mode 1) :hint nil) " [git gutter]