Use transient instead of hydra (#3)
* Use transient instead of hydra * Use global map instead of my custom map
This commit is contained in:
parent
835c3325ef
commit
8d81d91314
8 changed files with 173 additions and 311 deletions
|
|
@ -5,9 +5,7 @@
|
|||
(require '+custom-pkg-prog-mode "$HOME/.emacs.d/pkg/prog-mode.el")
|
||||
(require '+custom-pkg-hydra "$HOME/.emacs.d/pkg/hydra.el")
|
||||
|
||||
(use-package clojure-mode
|
||||
:defer t
|
||||
:straight t)
|
||||
(use-package clojure-mode :defer t :straight t)
|
||||
|
||||
(use-package cider
|
||||
:requires clojure-mode
|
||||
|
|
@ -22,25 +20,19 @@
|
|||
:straight t)
|
||||
|
||||
;; Hydra
|
||||
(defhydra my-clojure/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ Cider ^^Buffer
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _j_: Jack in _r_: Reload
|
||||
^ _t_: Test _f_: Format
|
||||
^ ^ ^ _l_: Load
|
||||
^ ^ ^ _e_: Show Errors
|
||||
^
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
|
||||
("r" revert-buffer-no-confirm)
|
||||
("j" cider-jack-in)
|
||||
("f" cider-format-buffer)
|
||||
("l" cider-load-buffer)
|
||||
("e" flycheck-list-errors)
|
||||
("t" cider-test-run-loaded-tests))
|
||||
(transient-define-prefix +my-transient-cider-context-menu ()
|
||||
"Clojure Buffer Commands"
|
||||
[""
|
||||
["Cider"
|
||||
("j" "Jack in" cider-jack-in)
|
||||
("t" "Test" cider-test-run-loaded-tests)]
|
||||
["Buffer"
|
||||
("r" "Reload" revert-buffer-no-confirm)
|
||||
("f" "Format" cider-format-buffer)
|
||||
("l" "Load" cider-load-buffer)
|
||||
("e" "Show Errors" flycheck-list-errors)]]
|
||||
[""
|
||||
("q" "Quit" keyboard-quit)])
|
||||
|
||||
(defun activate-my-clojure-mode ()
|
||||
"Goodies for clojure files."
|
||||
|
|
@ -50,7 +42,7 @@
|
|||
(cider-mode 1)
|
||||
(setq-local indent-tabs-mode nil)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-c l") 'my-clojure/context-hydra/body)
|
||||
(define-key clojure-mode-map (kbd "C-c l") '+my-transient-cider-context-menu)
|
||||
|
||||
;; Do not enable paredit for clojure
|
||||
;; (paredit-mode 1)
|
||||
|
|
|
|||
|
|
@ -10,23 +10,18 @@
|
|||
|
||||
(add-to-list 'auto-mode-alist '("\\.heex\\'" . elixir-mode))
|
||||
|
||||
(defhydra my-elixir/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ LSP ^^Buffer
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _m_: iMenu _r_: Reload
|
||||
^^^ _f_: Format
|
||||
^^^ _i_: Indent
|
||||
^^^ _e_: Show Errors
|
||||
^
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
("r" revert-buffer-no-confirm)
|
||||
("i" mark-and-indent-whole-buffer)
|
||||
("f" elixir-format)
|
||||
("e" flycheck-list-errors)
|
||||
("m" lsp-ui-imenu))
|
||||
(transient-define-prefix +my-transient-elixir-context-menu ()
|
||||
"Elixir Buffer Commands"
|
||||
[""
|
||||
["LSP"
|
||||
("m" "iMenu" lsp-ui-imenu)]
|
||||
["Buffer"
|
||||
("r" "Reload" revert-buffer-no-confirm)
|
||||
("f" "Format" elixir-format)
|
||||
("i" "Indent" mark-and-indent-whole-buffer)
|
||||
("e" "Show Errors" flycheck-list-errors)]]
|
||||
[""
|
||||
("q" "Quit" keyboard-quit)])
|
||||
|
||||
(defun activate-elixir-mode ()
|
||||
"All things Elixir."
|
||||
|
|
@ -41,7 +36,7 @@
|
|||
;; If needed, switch the one below to false to disable documentation pop-ups
|
||||
;; (setq-local lsp-ui-doc-enable t)
|
||||
|
||||
(define-key elixir-mode-map (kbd "C-c l") 'my-elixir/context-hydra/body)
|
||||
(define-key elixir-mode-map (kbd "C-c l") '+my-transient-elixir-context-menu)
|
||||
|
||||
;; Company list override
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
|
|
|
|||
|
|
@ -18,29 +18,11 @@
|
|||
:straight t
|
||||
:defer t)
|
||||
|
||||
(defhydra my-fsharp/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ FSharp actions^
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _r_: Reload buffer _f_: Format buffer
|
||||
^ _i_: Indent buffer _m_: iMenu
|
||||
^ _e_: Show errors
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
|
||||
("r" revert-buffer-no-confirm)
|
||||
("i" indent-region)
|
||||
("e" flycheck-list-errors)
|
||||
("f" lsp-format-buffer)
|
||||
("m" lsp-ui-imenu))
|
||||
|
||||
(defun activate-fsharp-mode ()
|
||||
"Activate F# goodies."
|
||||
(set-indent 4)
|
||||
(column-enforce-n 100)
|
||||
(lsp-deferred)
|
||||
(define-key fsharp-mode-map (kbd "C-c l") 'my-fsharp/context-hydra/body)
|
||||
|
||||
;; Company list override
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
|
|
|
|||
|
|
@ -25,31 +25,11 @@
|
|||
:config
|
||||
(setq lsp-haskell-process-path-hie "haskell-language-server-wrapper"))
|
||||
|
||||
(defhydra my-haskell/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ LSP ^^Buffer
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _m_: iMenu _r_: Reload
|
||||
^ ^ ^ _f_: Format
|
||||
^ ^ ^ _i_: Indent
|
||||
^ ^ ^ _e_: Show Errors
|
||||
^
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
|
||||
("r" revert-buffer-no-confirm)
|
||||
("i" indent-region)
|
||||
("f" lsp-format-buffer)
|
||||
("e" flycheck-list-errors)
|
||||
("m" lsp-ui-imenu))
|
||||
|
||||
(defun activate-haskell-mode ()
|
||||
"Run this in haskell-mode."
|
||||
(set-indent 2)
|
||||
(column-enforce-n 80)
|
||||
(lsp)
|
||||
(define-key haskell-mode-map (kbd "C-c l") 'my-haskell/context-hydra/body)
|
||||
|
||||
;; Company list override
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
|
|
|
|||
|
|
@ -23,22 +23,17 @@
|
|||
:defer t
|
||||
:straight t)
|
||||
|
||||
|
||||
(defhydra my-ocaml/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ OCaml actions
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _r_: Reload _f_: Format
|
||||
^ _i_: Indent _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))
|
||||
(transient-define-prefix +my-transient-ocaml-context-menu ()
|
||||
"Ocaml Actions"
|
||||
["OCaml actions"
|
||||
[""
|
||||
("r" "Reload" revert-buffer-no-confirm)
|
||||
("i" "Indent" mark-and-indent-whole-buffer)]
|
||||
[""
|
||||
("f" "Format" ocamlformat)
|
||||
("e" "Opam Env" tuareg-opam-update-env)]]
|
||||
[""
|
||||
("q" "Quit" keyboard-quit)])
|
||||
|
||||
(defun load-ocaml-site-packages ()
|
||||
"Generate ocaml config."
|
||||
|
|
@ -53,7 +48,7 @@
|
|||
|
||||
;; Use opam switch to lookup ocamlmerlin binary
|
||||
(setq merlin-command 'opam)))
|
||||
(define-key tuareg-mode-map (kbd "C-c l") 'my-ocaml/context-hydra/body))
|
||||
(define-key tuareg-mode-map (kbd "C-c l") '+my-transient-ocaml-context-menu))
|
||||
|
||||
;; OCaml setup
|
||||
(add-hook 'tuareg-mode-hook 'merlin-mode)
|
||||
|
|
@ -71,24 +66,23 @@
|
|||
;; Use tuareg-opam with lock files
|
||||
(add-to-list 'auto-mode-alist '("\\.opam.locked\\'" . tuareg-opam-mode))
|
||||
|
||||
(defhydra my-reason/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ Reason actions
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _r_: Reload _f_: Format
|
||||
^ _o_: Opam env
|
||||
^
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
(transient-define-prefix +my-transient-reasonml-context-menu ()
|
||||
"ReasonML Actions"
|
||||
["ReasonML actions"
|
||||
[""
|
||||
("r" "Reload" revert-buffer-no-confirm)
|
||||
("i" "Indent" mark-and-indent-whole-buffer)]
|
||||
[""
|
||||
("f" "Format" refmt)
|
||||
("e" "Opam Env" tuareg-opam-update-env)]]
|
||||
[""
|
||||
("q" "Quit" keyboard-quit)])
|
||||
|
||||
("f" refmt)
|
||||
("r" revert-buffer-no-confirm)
|
||||
("o" tuareg-opam-update-env))
|
||||
|
||||
(defun my-reason-mode ()
|
||||
"Generate reason config."
|
||||
(define-key reason-mode-map (kbd "C-c l") 'my-reason/context-hydra/body))
|
||||
(define-key
|
||||
reason-mode-map (kbd "C-c l") '+my-transient-reasonml-context-menu))
|
||||
|
||||
;; Reason setup
|
||||
(add-hook 'reason-mode-hook
|
||||
|
|
|
|||
31
lang/php.el
31
lang/php.el
|
|
@ -18,31 +18,26 @@
|
|||
:requires (lsp-mode lsp-ui)
|
||||
:straight t)
|
||||
|
||||
(defhydra my-php/context-hydra (:color teal :hint nil)
|
||||
"
|
||||
^
|
||||
^ LSP ^^Buffer
|
||||
^────────────────────────────────────────────────────────────────────────────────
|
||||
^ _m_: iMenu _r_: Reload
|
||||
^ ^ ^ _f_: Format
|
||||
^ ^ ^ _i_: Indent
|
||||
^ ^ ^ _e_: Show Errors
|
||||
^
|
||||
"
|
||||
("q" nil "cancel" :color blue)
|
||||
(transient-define-prefix +my-transient-php-context-menu ()
|
||||
"PHP Buffer Commands"
|
||||
[""
|
||||
["LSP"
|
||||
("m" "iMenu" lsp-ui-imenu)]
|
||||
["Buffer"
|
||||
("r" "Reload" revert-buffer-no-confirm)
|
||||
("f" "Format" elixir-format)
|
||||
("i" "Indent" mark-and-indent-whole-buffer)
|
||||
("e" "Show Errors" flycheck-list-errors)]]
|
||||
[""
|
||||
("q" "Quit" keyboard-quit)])
|
||||
|
||||
("r" revert-buffer-no-confirm)
|
||||
("i" indent-region)
|
||||
("f" lsp-format-buffer)
|
||||
("e" flycheck-list-errors)
|
||||
("m" lsp-ui-imenu))
|
||||
|
||||
(defun activate-php-mode ()
|
||||
"All things php."
|
||||
(set-indent 4)
|
||||
(column-enforce-n 80)
|
||||
|
||||
(define-key php-mode-map (kbd "C-c l") 'my-php/context-hydra/body)
|
||||
(define-key php-mode-map (kbd "C-c l") '+my-transient-php-context-menu)
|
||||
|
||||
;; Company list override
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue