diff --git a/emacs/init.org b/emacs/init.org index ab4d4c5..50b42cc 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -212,6 +212,12 @@ A framework for creating Magit-style popups: (use-package transient) #+END_SRC +* Hydra +[[https://github.com/abo-abo/hydra][Hydra]]s are convenient keybinding menus. +#+BEGIN_SRC emacs-lisp + (use-package hydra) +#+END_SRC + * Magit Magit is objectively the best Git interface. #+BEGIN_SRC emacs-lisp @@ -1003,7 +1009,62 @@ Store backups and autosaves in a centralized place. This should really be the de Smartparens enables structured editing of s-expressions and other pairs: #+BEGIN_SRC emacs-lisp (use-package smartparens - :hook ((prog-mode . smartparens-strict-mode))) + :hook ((prog-mode . smartparens-strict-mode)) + :init + (defhydra hydra-smartparens (:hint nil) + " + Moving^^^^ Slurp & Barf^^ Wrapping^^ Sexp juggling^^^^ Destructive + ------------------------------------------------------------------------------------------------------------------------ + [_a_] beginning [_n_] down [_h_] bw slurp [_R_] rewrap [_S_] split [_t_] transpose [_c_] change inner [_w_] copy + [_e_] end [_N_] bw down [_H_] bw barf [_u_] unwrap [_s_] splice [_A_] absorb [_C_] change outer + [_f_] forward [_p_] up [_l_] slurp [_U_] bw unwrap [_r_] raise [_E_] emit [_k_] kill [_g_] quit + [_b_] backward [_P_] bw up [_L_] barf [_(__{__[_] wrap (){}[] [_j_] join [_o_] convolute [_K_] bw kill [_q_] quit" + ;; Moving + ("a" sp-beginning-of-sexp) + ("e" sp-end-of-sexp) + ("f" sp-forward-sexp) + ("b" sp-backward-sexp) + ("n" sp-down-sexp) + ("N" sp-backward-down-sexp) + ("p" sp-up-sexp) + ("P" sp-backward-up-sexp) + + ;; Slurping & barfing + ("h" sp-backward-slurp-sexp) + ("H" sp-backward-barf-sexp) + ("l" sp-forward-slurp-sexp) + ("L" sp-forward-barf-sexp) + + ;; Wrapping + ("R" sp-rewrap-sexp) + ("u" sp-unwrap-sexp) + ("U" sp-backward-unwrap-sexp) + ("(" sp-wrap-round) + ("{" sp-wrap-curly) + ("[" sp-wrap-square) + + ;; Sexp juggling + ("S" sp-split-sexp) + ("s" sp-splice-sexp) + ("r" sp-raise-sexp) + ("j" sp-join-sexp) + ("t" sp-transpose-sexp) + ("A" sp-absorb-sexp) + ("E" sp-emit-sexp) + ("o" sp-convolute-sexp) + + ;; Destructive editing + ("c" sp-change-inner :exit t) + ("C" sp-change-enclosing :exit t) + ("k" sp-kill-sexp) + ("K" sp-backward-kill-sexp) + ("w" sp-copy-sexp) + + ("q" nil) + ("g" nil)) + :general + (prog-mode-map "C-c p" 'hydra-smartparens/body) + ((normal motion visual) prog-mode-map "g p" 'hydra-smartparens/body)) (use-package evil-smartparens :after (evil smartparens)