From d1fb4a661c2afd9c6fb55be925203e90304c5ff5 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Sun, 7 Mar 2021 10:05:33 +0200 Subject: [PATCH] Update hydras --- lang/clojure.el | 13 ++++--- lang/elixir.el | 13 ++++--- lang/ocaml.el | 15 ++++---- pkg/ctags.el | 8 ++--- pkg/hydra.el | 90 +++++++++++++++++++++++++----------------------- pkg/keys-mode.el | 9 ----- 6 files changed, 71 insertions(+), 77 deletions(-) diff --git a/lang/clojure.el b/lang/clojure.el index aeb8183..3c6fd8e 100644 --- a/lang/clojure.el +++ b/lang/clojure.el @@ -24,16 +24,15 @@ ;; Hydra (defhydra my-clojure/context-hydra (:color teal :hint nil) " - Clojure actions - - ^Cider^ ^Actions^ -^^^^^^^^----------------------------------------------------------------------- -_j_: Jack in _t_: Run loaded test(s) -_f_: Format buffer -_l_: Load buffer +^ Clojure actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Buffer: _r_: Reload _f_: Format _l_: Load +Cider: _j_: Jack in _t_: Test +^^ " ("q" nil "cancel" :color blue) + ("r" revert-buffer-no-confirm) ("j" cider-jack-in) ("f" cider-format-buffer) ("l" cider-load-buffer) diff --git a/lang/elixir.el b/lang/elixir.el index 1c940c2..6aef228 100644 --- a/lang/elixir.el +++ b/lang/elixir.el @@ -12,16 +12,15 @@ (defhydra my-elixir/context-hydra (:color teal :hint nil) " - ^Elixir actions^ -^^^^^^^^----------------------------------------------------------------------- -_r_: Reload buffer _f_: Format buffer -_i_: Indent buffer _m_: iMenu +^ Elixir actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Buffer: _r_: Reload _f_: Format _i_: Indent +Other: _m_: iMenu +^^ " ("q" nil "cancel" :color blue) - ("r" revert-buffer-no-confirm) - ("i" indent-region) - + ("i" mark-and-indent-whole-buffer) ("f" elixir-format) ("m" lsp-ui-imenu)) diff --git a/lang/ocaml.el b/lang/ocaml.el index 2679a5d..b9c8b4d 100644 --- a/lang/ocaml.el +++ b/lang/ocaml.el @@ -2,6 +2,8 @@ ;;; Commentary: ;;; Code: +(require 'icejam-pkg-hydra "$HOME/.emacs.d/pkg/hydra.el") + (use-package tuareg :defer t :straight t @@ -24,15 +26,16 @@ (defhydra my-ocaml/context-hydra (:color teal :hint nil) " - OCaml actions - - ^OCaml^ ^Actions^ -^^^^^^^^----------------------------------------------------------------------- -_f_: Format buffer -_o_: Update opam env +^ OCaml actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Buffer: _r_: Reload _f_: Format _i_: Indent +Other: _o_: Opam env +^^ " ("q" nil "cancel" :color blue) + ("r" revert-buffer-no-confirm) + ("i" mark-and-indent-whole-buffer) ("f" ocamlformat) ("o" tuareg-opam-update-env)) diff --git a/pkg/ctags.el b/pkg/ctags.el index 1bdd07e..726b2f6 100644 --- a/pkg/ctags.el +++ b/pkg/ctags.el @@ -2,10 +2,7 @@ ;;; Commentary: ;;; Old and rudimental completion framework. ;;; Code: -(require 'projectile) - -;; Do not mix ctags between folders -(provide 'my-ctags-config) +(require 'icejam-pkg-projectile "$HOME/.emacs.d/pkg/projectile.el") (setq tags-add-tables nil) @@ -27,7 +24,7 @@ ))) (cl-defun ctags/refresh-ctags (&key silent) - "Refresh ctags according to currently set command." + "Refresh ctags according to currently set command. With SILENT you can make it, uhh... silent." (interactive) ;; Print message if not silent @@ -54,5 +51,6 @@ (add-to-list (make-local-variable 'ctags/major-modes-to-update-on-save) mode)) (add-hook 'after-save-hook 'ctags/update-tags-on-save) + (provide 'icejam-pkg-ctags) ;;; ctags.el ends here diff --git a/pkg/hydra.el b/pkg/hydra.el index dc09a00..f3a927c 100644 --- a/pkg/hydra.el +++ b/pkg/hydra.el @@ -5,23 +5,30 @@ (require 'icejam-pkg-avy "$HOME/.emacs.d/pkg/avy.el") +(defun mark-and-indent-whole-buffer () + "Mark and indent whole buffer." + (interactive) + (indent-region (point-min) (point-max))) + (use-package hydra :straight t :defer t :config (defhydra hydra-file-switcher-menu (:color teal :hint nil) " - General Actions - - ^Ivy^ ^Perspectives^ ^Projectile^ ^Magit^ -^^^^^^^^------------------------------------------------------------------------------------- -_a_: Grep in buffer _p_: Switch perspective _s_: Switch project _m_: Git status -_B_: Buffer list _b_: buffers in perspective _f_: Find file in project _C_: Git checkout -_t_: Find file _K_: Kill perspective _g_: Grep in current project _M_: Git blame -_d_: Deft _c_: Invalidate cache -_w_: Avy goto word _n_: New project -_l_: Avy goto line _i_: IELM console -_:_: Avy goto char +^ General actions +^^^^^^^^-------------------------------------------------------------------------------------------- +^Ivy: _a_: Grep in buffer _B_: Buffer list _t_: Find file +^Avy: _w_: Goto word _l_: Goto line _:_: Goto char +^ +^Perspective: _p_: Switch perspective _b_: Buffers in perspective _K_: Kill perspective +^Projectile: _s_: Switch project _f_: Find file in project _g_: Grep in project +^ _c_: Invalidate cache _n_: New project +^Magit: _m_: Git status _C_: Git checkout _M_: Git blame +^ +^LISP: _i_: Console _e_: Eval region +^ _d_: Deft +^ " ("q" nil "cancel" :color blue) @@ -44,6 +51,7 @@ _:_: Avy goto char ("c" projectile-invalidate-cache) ("n" projectile-add-known-project) ("i" ielm) + ("e" eval-region) ("m" magit-status) ("C" magit-checkout) @@ -51,16 +59,12 @@ _:_: Avy goto char (defhydra hydra-programming-menu (:color teal :hint nil) " - Programming actions - - ^Code Manipulation^ ^Code Completion^ -^^^^^^^^----------------------------------------------------------------------- -_c_: Comment line _y_: Yasnippet -_r_: Regex replace _m_: Company -_i_: Indent region _u_: Undo tree -_a_: Align to regex -_e_: Eval region -_s_: Swiper +^ Code actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Manipulate: _c_: Toggle comment _r_: Replace _i_: Indent _a_: Align +Complete: _y_: Snippet _m_: Any (Company) +Find: _s_: Swiper _u_: Undo tree +^ " ("q" nil "cancel" :color blue) @@ -68,7 +72,6 @@ _s_: Swiper ("r" vr/replace) ("i" indent-region) ("a" align-regexp) - ("e" eval-region) ("s" swiper) ("u" undo-tree-visualize) @@ -77,51 +80,52 @@ _s_: Swiper (defhydra hydra-window-menu (:color teal :hint nil) " - Window actions - - ^Windows^ ^Move around^ -^^^^^^^^----------------------------------------------------------------------- -_k_: Kill buffer and window __: Move left -_h_: Split horizontally __: Move right -_v_: Split vertically __: Move up -_f_: Set font size to screen __: Move down -^^ _p_: Previous buffer -^^ _n_: Next buffer +^ Buffer actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Move: __: Left __: Right __: Up __: Down +Split: _h_: Horizontally _v_: Vertically + _k_: Kill Buffer +^ " ("q" nil "cancel" :color blue) ("k" kill-buffer-and-window) ("h" split-window-below) ("v" split-window-right) - ("f" set-font-to-screen) ("" windmove-left) ("" windmove-right) ("" windmove-up) - ("" windmove-down) - ("p" previous-buffer) - ("n" next-buffer)) + ("" windmove-down)) (defhydra hydra-language-context-menu (:color teal :hint nil) " - Context actions - - ^Context^ ^Actions^ -^^^^^^^^----------------------------------------------------------------------- -_r_: Reload buffer _f_: Format buffer -_i_: Indent buffer _m_: iMenu +^ Language-specific actions +^^^^^^^^-------------------------------------------------------------------------------------------- +Buffer: _r_: Reload _f_: Format _i_: Indent +Other: _m_: iMenu +^^ " ("q" nil "cancel" :color blue) ("r" revert-buffer-no-confirm) - ("i" indent-region) + ("i" mark-and-indent-whole-buffer) ("f" lsp-format-buffer) ("m" lsp-ui-imenu)) + (defhydra hydra-move-menu (:color teal) + "Buffer history" + ("" previous-buffer "Previous buffer") + ("" next-buffer "Next buffer") + ("[" previous-buffer "Previous buffer") + ("]" next-buffer "Next buffer") + ("q" cancel "quit")) + :bind ("C-c p" . hydra-file-switcher-menu/body) ("C-c c" . hydra-programming-menu/body) ("C-c w" . hydra-window-menu/body) + ("C-c s" . hydra-move-menu/body) ("C-c l" . hydra-language-context-menu/body)) (provide 'icejam-pkg-hydra) diff --git a/pkg/keys-mode.el b/pkg/keys-mode.el index 51294c2..3cbfc9a 100644 --- a/pkg/keys-mode.el +++ b/pkg/keys-mode.el @@ -34,15 +34,6 @@ (define-key icejam-keys-mode-map (kbd "C-c {") 'windmove-up) (define-key icejam-keys-mode-map (kbd "C-c }") 'windmove-down) -;; Switch to previous and next buffer -(define-key icejam-keys-mode-map (kbd "C-c s ") 'previous-buffer) -(define-key icejam-keys-mode-map (kbd "C-c s ") 'next-buffer) - -;; The same, but without arrow keys. -(define-key icejam-keys-mode-map (kbd "C-c s [") 'previous-buffer) -(define-key icejam-keys-mode-map (kbd "C-c s ]") 'next-buffer) - - ;; Kill current buffer and window (define-key icejam-keys-mode-map (kbd "C-c q") 'kill-buffer-and-window)