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:
Henrik Lissner 2019-07-22 22:49:27 +02:00
parent 388267d256
commit d7ed52f3c7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
14 changed files with 116 additions and 105 deletions

View file

@ -199,10 +199,6 @@ localleader prefix."
(which-key-mode +1)) (which-key-mode +1))
;;;###package hydra
(setq lv-use-seperator t)
;; ;;
;;; `map!' macro ;;; `map!' macro

View file

@ -38,7 +38,6 @@
;; core-keybinds.el ;; core-keybinds.el
(package! general) (package! general)
(package! which-key) (package! which-key)
(package! hydra)
;; autoload/debug.el ;; autoload/debug.el
(package! esup) (package! esup)

View file

@ -25,6 +25,7 @@
doom-quit ; DOOM quit-message prompts when you quit Emacs doom-quit ; DOOM quit-message prompts when you quit Emacs
;;fill-column ; a `fill-column' indicator ;;fill-column ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE tags hl-todo ; highlight TODO/FIXME/NOTE tags
;;hydra
;;indent-guides ; highlighted indent columns ;;indent-guides ; highlighted indent columns
modeline ; snazzy, Atom-inspired modeline, plus API modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping nav-flash ; blink the current line after jumping

View file

@ -1,9 +1,10 @@
;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*- ;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
;;;###autoload (eval-when-compile (require 'ivy-hydra))
(after! ivy-hydra
(with-no-warnings ;;;###autoload (autoload 'hydra-ivy/body "completion/ivy/autoload/hydras" nil nil)
(defhydra+ hydra-ivy (:hint nil :color pink) (defhydra+ hydra-ivy (:hint nil :color pink)
" "
Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name) Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name)
----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+--------------------------------- ----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+---------------------------------
@ -29,4 +30,4 @@
("c" ivy-toggle-calling) ("c" ivy-toggle-calling)
("m" ivy-toggle-fuzzy) ("m" ivy-toggle-fuzzy)
("t" (setq truncate-lines (not truncate-lines))) ("t" (setq truncate-lines (not truncate-lines)))
("o" ivy-occur :exit t)))) ("o" ivy-occur :exit t))

View 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))

View file

@ -40,42 +40,3 @@ info in the `header-line-format' is a good indication."
(propertize author 'face 'git-timemachine-minibuffer-author-face) (propertize author 'face 'git-timemachine-minibuffer-author-face)
(propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face) (propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face)
date-full date-relative)))) 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))

View file

@ -55,7 +55,7 @@ Change ~+ein-notebook-dir~ to tell ein where to find your Jupityr notebooks.
#+END_SRC #+END_SRC
** Using hydra ** 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 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. simplified and are easily accessible. However, by default, it's not bound to any key.
Here's an example of how to bind it: 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 #+BEGIN_SRC emacs-lisp
(map! :map ein:notebook-mode-map (map! :map ein:notebook-mode-map
:localleader :localleader
"," #'+ein-hydra/body) "," #'+ein/hydra/body)
#+END_SRC #+END_SRC

View 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)))))

View file

@ -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 () ;;;###autoload (autoload '+ein/hydra/body "tools/ein/autoload" nil t)
(let ((end (window-end)) (defhydra +ein/hydra (:hint t :color red)
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)
" "
Operations on Cells^^^^^^ Other Operations on Cells^^^^^^ Other
----------------------------^^^^^^ ----------------------------------^^^^ ----------------------------^^^^^^ ----------------------------------^^^^

View file

@ -1,7 +1,8 @@
;;; tools/rgb/autoload.el -*- lexical-binding: t; -*- ;;; tools/rgb/autoload.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
;;;###autoload (autoload '+rgb-kurecolor-hydra/body "tools/rgb/autoload" nil t) ;;;###autoload (autoload '+rgb/kurecolor-hydra/body "tools/rgb/autoload" nil t)
(defhydra +rgb-kurecolor-hydra (:color pink :hint nil) (defhydra +rgb/kurecolor-hydra (:color pink :hint nil)
" "
Inc/Dec _w_/_W_ brightness _d_/_D_ saturation _e_/_E_ hue " Inc/Dec _w_/_W_ brightness _d_/_D_ saturation _e_/_E_ hue "
("w" kurecolor-decrease-brightness-by-step) ("w" kurecolor-decrease-brightness-by-step)

View file

@ -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) ;;;###autoload (autoload '+hydra/text-zoom/body "ui/hydra/autoload/windows" nil t)
(defhydra doom-text-zoom-hydra (:hint t :color red) (defhydra +hydra/text-zoom (:hint t :color red)
" "
Text zoom: _j_:zoom in, _k_:zoom out, _0_:reset Text zoom: _j_:zoom in, _k_:zoom out, _0_:reset
" "
@ -9,8 +9,8 @@
("k" doom/decrease-font-size "out") ("k" doom/decrease-font-size "out")
("0" doom/reset-font-size "reset")) ("0" doom/reset-font-size "reset"))
;;;###autoload (autoload 'doom-window-nav-hydra/body "core/autoload/hydras" nil t) ;;;###autoload (autoload '+hydra/window-nav/body "ui/hydra/autoload/windows" nil t)
(defhydra doom-window-nav-hydra (:hint nil) (defhydra +hydra/window-nav (:hint nil)
" "
Split: _v_ert _s_:horz Split: _v_ert _s_:horz
Delete: _c_lose _o_nly Delete: _c_lose _o_nly

View file

@ -0,0 +1,4 @@
;;; ui/hydra/config.el -*- lexical-binding: t; -*-
;;;###package hydra
(setq lv-use-seperator t)

View file

@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; ui/hydra/packages.el
(package! hydra)

View file

@ -1,7 +1,8 @@
;;; ui/vc-gutter/autoload.el -*- lexical-binding: t; -*- ;;; ui/vc-gutter/autoload.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
;;;###autoload (autoload '+vc-gutter-hydra/body "ui/vc-gutter/autoload" nil t) ;;;###autoload (autoload '+vc/gutter-hydra/body "ui/vc-gutter/autoload" nil t)
(defhydra +vc-gutter-hydra (defhydra +vc/gutter-hydra
(:body-pre (git-gutter-mode 1) :hint nil) (:body-pre (git-gutter-mode 1) :hint nil)
" "
[git gutter] [git gutter]