Add ui/hydra module
And conforms all existing hydras to the naming convention for interactive commands, e.g. +vc-gutter-hydra -> +vc/gutter-hydra
This commit is contained in:
parent
388267d256
commit
d7ed52f3c7
14 changed files with 116 additions and 105 deletions
|
@ -199,10 +199,6 @@ localleader prefix."
|
|||
(which-key-mode +1))
|
||||
|
||||
|
||||
;;;###package hydra
|
||||
(setq lv-use-seperator t)
|
||||
|
||||
|
||||
;;
|
||||
;;; `map!' macro
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
;; core-keybinds.el
|
||||
(package! general)
|
||||
(package! which-key)
|
||||
(package! hydra)
|
||||
|
||||
;; autoload/debug.el
|
||||
(package! esup)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :ui hydra)
|
||||
|
||||
;;;###autoload
|
||||
(after! ivy-hydra
|
||||
(with-no-warnings
|
||||
(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)
|
||||
|
@ -29,4 +30,4 @@
|
|||
("c" ivy-toggle-calling)
|
||||
("m" ivy-toggle-fuzzy)
|
||||
("t" (setq truncate-lines (not truncate-lines)))
|
||||
("o" ivy-occur :exit t))))
|
||||
("o" ivy-occur :exit t))
|
||||
|
|
41
modules/emacs/vc/autoload/hydra.el
Normal file
41
modules/emacs/vc/autoload/hydra.el
Normal file
|
@ -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))
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
24
modules/tools/ein/autoload/ein.el
Normal file
24
modules/tools/ein/autoload/ein.el
Normal file
|
@ -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)))))
|
|
@ -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
|
||||
----------------------------^^^^^^ ----------------------------------^^^^
|
|
@ -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)
|
||||
|
|
|
@ -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
|
4
modules/ui/hydra/config.el
Normal file
4
modules/ui/hydra/config.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;;; ui/hydra/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###package hydra
|
||||
(setq lv-use-seperator t)
|
4
modules/ui/hydra/packages.el
Normal file
4
modules/ui/hydra/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/hydra/packages.el
|
||||
|
||||
(package! hydra)
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue