From db52cf12abe4da12d192ef88798a1be1842f4131 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 24 Sep 2017 12:34:25 +0200 Subject: [PATCH] [Init] Move definition of hydras into main init function --- init.el | 118 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/init.el b/init.el index bce982d..2953b01 100644 --- a/init.el +++ b/init.el @@ -115,6 +115,65 @@ (add-hook 'prog-mode-hook #'electric-indent-local-mode)) (add-hook 'lisp-mode-hook #'lispy-mode) + ;; Hydras + + (defhydra hydra-toggle (:color blue) + "toggle" + ("c" column-number-mode "column") + ("d" toggle-debug-on-error "debug-on-error") + ("e" toggle-debug-on-error "debug-on-error") + ("f" auto-fill-mode "auto-fill") + ("l" toggle-truncate-lines "truncate lines") + ("q" toggle-debug-on-quit "debug-on-quit") + ("r" read-only-mode "read-only")) + + ;; zooming with single keystrokes (from oremacs) + (defhydra hydra-zoom (:color red) + "zoom" + ("g" text-scale-increase "increase") + ("l" text-scale-decrease "decrease")) + + ;; rectangle mode + (defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1) + :color pink + :post (deactivate-mark)) + " + ^_k_^ _d_elete _s_tring +_h_ _l_ _o_k _y_ank + ^_j_^ _n_ew-copy _r_eset +^^^^ _e_xchange _u_ndo +^^^^ ^ ^ _p_aste +" + ("h" backward-char nil) + ("l" forward-char nil) + ("k" previous-line nil) + ("j" next-line nil) + ("e" ora-ex-point-mark nil) + ("n" copy-rectangle-as-kill nil) + ("d" delete-rectangle nil) + ("r" (if (region-active-p) + (deactivate-mark) + (rectangle-mark-mode 1)) + nil) + ("y" yank-rectangle nil) + ("u" undo nil) + ("s" string-rectangle nil) + ("p" kill-rectangle nil) + ("o" nil nil)) + + (defhydra hydra-ispell (:color blue) + "ispell" + ("g" (lambda () + (interactive) + (setq ispell-dictionary "de_DE") + (ispell-change-dictionary "de_DE")) + "german") + ("e" (lambda () + (interactive) + (setq ispell-dictionary "en_US") + (ispell-change-dictionary "en_US")) + "english")) + ;; Top-Level Keybindings (bind-key "" #'winner-undo) @@ -522,64 +581,7 @@ hydra-zoom/body hydra-rectangle/body hydra-ispell/body - defhydra) - :config (progn - (defhydra hydra-toggle (:color blue) - "toggle" - ("c" column-number-mode "column") - ("d" toggle-debug-on-error "debug-on-error") - ("e" toggle-debug-on-error "debug-on-error") - ("f" auto-fill-mode "auto-fill") - ("l" toggle-truncate-lines "truncate lines") - ("q" toggle-debug-on-quit "debug-on-quit") - ("r" read-only-mode "read-only")) - - ;; zooming with single keystrokes (from oremacs) - (defhydra hydra-zoom (:color red) - "zoom" - ("g" text-scale-increase "increase") - ("l" text-scale-decrease "decrease")) - - ;; rectangle mode - (defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1) - :color pink - :post (deactivate-mark)) - " - ^_k_^ _d_elete _s_tring -_h_ _l_ _o_k _y_ank - ^_j_^ _n_ew-copy _r_eset -^^^^ _e_xchange _u_ndo -^^^^ ^ ^ _p_aste -" - ("h" backward-char nil) - ("l" forward-char nil) - ("k" previous-line nil) - ("j" next-line nil) - ("e" ora-ex-point-mark nil) - ("n" copy-rectangle-as-kill nil) - ("d" delete-rectangle nil) - ("r" (if (region-active-p) - (deactivate-mark) - (rectangle-mark-mode 1)) - nil) - ("y" yank-rectangle nil) - ("u" undo nil) - ("s" string-rectangle nil) - ("p" kill-rectangle nil) - ("o" nil nil)) - - (defhydra hydra-ispell (:color blue) - "ispell" - ("g" (lambda () - (interactive) - (setq ispell-dictionary "de_DE") - (ispell-change-dictionary "de_DE")) - "german") - ("e" (lambda () - (interactive) - (setq ispell-dictionary "en_US") - (ispell-change-dictionary "en_US")) - "english")))) + defhydra)) (use-package magit :commands (magit-status)