diff --git a/modules/lang/elixir/README.org b/modules/lang/elixir/README.org index b1a703e2f..49fec9f2e 100644 --- a/modules/lang/elixir/README.org +++ b/modules/lang/elixir/README.org @@ -13,6 +13,8 @@ - [[#gentoo-linux][Gentoo Linux]] - [[#opensuse][openSUSE]] - [[#features][Features]] +- [[#appendix][Appendix]] + - [[#commands][Commands]] * Description This module provides support for [[https://elixir-lang.org/][Elixir programming language]] via [[https://github.com/tonini/alchemist.el][alchemist.el]] @@ -60,3 +62,16 @@ sudo zypper install elixir - Phoenix support - ~iex~ integration (~:tools eval~) - Syntax checking (~:checkers syntax~, using [[https://github.com/aaronjensen/flycheck-credo][flycheck-credo]]~) +* Appendix +** Commands +*** exunit-mode +The exunit-mode prefix is =SPC m t=. Here is some examples: +| | | | +| command | key / ex command | description | +|------------------------------------------+------------------+--------------------------------------------------------| +| ~exunit-verify-all~ | =SPC m t a= | Runs exunit on all files | +| ~exunit-rerun~ | =SPC m t r= | Re-runs last exunit command | +| ~exunit-verify~ | =SPC m t v= | Runs exunit on current file | +| ~exunit-verify-single~ | =SPC m t s= | Runs exunit for the item on cursor | +| ~exunit-toggle-file-and-test~ | =SPC m t t= | Switch between implementation and test | +| ~exunit-toggle-file-and-test-other-window~ | =SPC m t T= | Switch between implementation and test in other window | diff --git a/modules/lang/elixir/config.el b/modules/lang/elixir/config.el index 34bb0abc9..6ad924eac 100644 --- a/modules/lang/elixir/config.el +++ b/modules/lang/elixir/config.el @@ -15,17 +15,17 @@ (provide 'smartparens-elixir) :config (set-ligatures! 'elixir-mode - ;; Functional - :def "def" - :lambda "fn" - ;; :src_block "do" - ;; :src_block_end "end" - ;; Flow - :not "!" - :in "in" :not-in "not in" - :and "and" :or "or" - :for "for" - :return "return" :yield "use") + ;; Functional + :def "def" + :lambda "fn" + ;; :src_block "do" + ;; :src_block_end "end" + ;; Flow + :not "!" + :in "in" :not-in "not in" + :and "and" :or "or" + :for "for" + :return "return" :yield "use") ;; ...and only complete the basics (sp-with-modes 'elixir-mode @@ -71,3 +71,18 @@ (let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company))))) (remove-hook 'alchemist-mode-hook fn) (remove-hook 'alchemist-iex-mode-hook fn))) + +(use-package! exunit + :hook (elixir-mode . exunit-mode) + :defer t + :config + (map! :after elixir-mode + :localleader + :map elixir-mode-map + :prefix "t" + "a" #'exunit-verify-all + "r" #'exunit-rerun + "v" #'exunit-verify + "T" #'exunit-toggle-file-and-test + "t" #'exunit-toggle-file-and-test-other-window + "s" #'exunit-verify-single)) diff --git a/modules/lang/elixir/packages.el b/modules/lang/elixir/packages.el index b4d091bf3..6fc03b62b 100644 --- a/modules/lang/elixir/packages.el +++ b/modules/lang/elixir/packages.el @@ -4,5 +4,6 @@ ;; +elixir.el (package! elixir-mode :pin "01b332495d3f44addeb236428041c4ffa0c2ca3b") (package! alchemist :pin "6f99367511ae209f8fe2c990779764bbb4ccb6ed") +(package! exunit :pin "c77b0397b80d772c98fcc34c9ab131a8350fbf40") (when (featurep! :checkers syntax) (package! flycheck-credo :pin "e88f11ead53805c361ec7706e44c3dfee1daa19f"))