2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/elixir/config.el -*- lexical-binding: t; -*-
|
2017-05-24 13:08:26 +03:00
|
|
|
|
2024-08-09 20:42:33 -04:00
|
|
|
;; DEPRECATED: Remove when projectile is replaced with project.el
|
2019-10-19 15:25:29 -04:00
|
|
|
(after! projectile
|
|
|
|
(add-to-list 'projectile-project-root-files "mix.exs"))
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! elixir-mode
|
2018-05-25 00:46:11 +02:00
|
|
|
:defer t
|
2018-06-25 15:54:38 +02:00
|
|
|
:init
|
2019-03-02 01:56:32 -05:00
|
|
|
;; Disable default smartparens config. There are too many pairs; we only want
|
|
|
|
;; a subset of them (defined below).
|
2018-06-25 15:54:38 +02:00
|
|
|
(provide 'smartparens-elixir)
|
2017-05-24 13:08:26 +03:00
|
|
|
:config
|
2020-08-12 18:52:14 -04:00
|
|
|
(set-ligatures! 'elixir-mode
|
2020-11-12 08:58:19 -07:00
|
|
|
;; 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")
|
2018-06-15 02:58:12 +02:00
|
|
|
|
2019-03-02 01:56:32 -05:00
|
|
|
;; ...and only complete the basics
|
2019-07-23 00:30:45 +02:00
|
|
|
(sp-with-modes 'elixir-mode
|
|
|
|
(sp-local-pair "do" "end"
|
|
|
|
:when '(("RET" "<evil-ret>"))
|
|
|
|
:unless '(sp-in-comment-p sp-in-string-p)
|
|
|
|
:post-handlers '("||\n[i]"))
|
|
|
|
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
|
|
|
|
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p)))
|
2019-03-02 01:56:32 -05:00
|
|
|
|
2022-08-12 20:29:19 +02:00
|
|
|
(when (modulep! +lsp)
|
2022-03-24 02:19:52 +01:00
|
|
|
(add-hook 'elixir-mode-local-vars-hook #'lsp! 'append)
|
2021-05-05 12:33:33 -04:00
|
|
|
(after! lsp-mode
|
2021-05-14 21:31:41 +02:00
|
|
|
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]_build\\'")))
|
2020-07-31 01:39:24 -04:00
|
|
|
|
2022-08-12 20:29:19 +02:00
|
|
|
(when (modulep! +tree-sitter)
|
2022-07-25 17:34:44 +02:00
|
|
|
(add-hook 'elixir-mode-local-vars-hook #'tree-sitter! 'append))
|
|
|
|
|
2020-07-31 01:39:24 -04:00
|
|
|
(after! highlight-numbers
|
|
|
|
(puthash 'elixir-mode
|
|
|
|
"\\_<-?[[:digit:]]+\\(?:_[[:digit:]]\\{3\\}\\)*\\_>"
|
|
|
|
highlight-numbers-modelist)))
|
2019-07-26 21:32:20 +03:00
|
|
|
|
2020-03-27 01:25:30 -04:00
|
|
|
|
|
|
|
(use-package! flycheck-credo
|
2022-08-17 01:16:08 +01:00
|
|
|
:when (and (modulep! :checkers syntax)
|
|
|
|
(not (modulep! :checkers syntax +flymake)))
|
2020-03-27 01:25:30 -04:00
|
|
|
:after elixir-mode
|
|
|
|
:config (flycheck-credo-setup))
|
2017-12-18 13:12:48 -05:00
|
|
|
|
|
|
|
|
2020-10-22 18:39:59 -06:00
|
|
|
(use-package! exunit
|
|
|
|
:hook (elixir-mode . exunit-mode)
|
2020-11-12 08:58:19 -07:00
|
|
|
:init
|
2020-10-22 18:39:59 -06:00
|
|
|
(map! :after elixir-mode
|
2020-11-14 15:35:07 -07:00
|
|
|
:localleader
|
|
|
|
:map elixir-mode-map
|
2021-05-04 18:15:42 -04:00
|
|
|
:prefix ("t" . "test")
|
2020-11-14 15:35:07 -07:00
|
|
|
"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))
|