2015-06-09 03:26:56 +00:00
|
|
|
;;; packages.el --- Elixir Layer packages File for Spacemacs
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2020-05-16 21:32:30 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2020-05-16 21:32:30 +00:00
|
|
|
(defconst elixir-packages
|
|
|
|
'(
|
|
|
|
alchemist
|
|
|
|
company
|
|
|
|
counsel-gtags
|
|
|
|
dap-mode
|
|
|
|
elixir-mode
|
|
|
|
evil-matchit
|
|
|
|
flycheck
|
|
|
|
flycheck-credo
|
|
|
|
flycheck-mix
|
|
|
|
ggtags
|
|
|
|
helm-gtags
|
|
|
|
ob-elixir
|
|
|
|
popwin
|
|
|
|
smartparens))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
(defun elixir/init-alchemist ()
|
|
|
|
(use-package alchemist
|
2019-08-27 10:21:24 +00:00
|
|
|
:if (eq elixir-backend 'alchemist)
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-27 04:22:47 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/register-repl 'alchemist 'alchemist-iex-run "alchemist")
|
|
|
|
(add-hook 'elixir-mode-hook 'alchemist-mode)
|
2016-06-01 00:04:48 +00:00
|
|
|
(setq alchemist-project-compile-when-needed t
|
|
|
|
alchemist-test-status-modeline nil)
|
2016-09-04 16:24:43 +00:00
|
|
|
(add-to-list 'spacemacs-jump-handlers-elixir-mode
|
2020-05-16 21:32:30 +00:00
|
|
|
'(alchemist-goto-definition-at-point :async t)))
|
2016-05-27 04:22:47 +00:00
|
|
|
:config
|
2017-04-20 01:05:50 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mX" "hex")
|
2016-05-27 04:22:47 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mc" "compile")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "me" "eval")
|
2017-04-20 01:05:50 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mg" "goto")
|
2016-05-27 04:22:47 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mh" "help")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mm" "mix")
|
2017-04-20 01:05:50 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mo" "macroexpand")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mp" "project")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "ms" "iex")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mt" "test")
|
2016-05-27 04:22:47 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mx" "execute")
|
2019-09-06 08:00:51 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "md" "debug")
|
2016-05-27 04:22:47 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
|
|
|
"el" 'alchemist-eval-current-line
|
|
|
|
"eL" 'alchemist-eval-print-current-line
|
|
|
|
"er" 'alchemist-eval-region
|
|
|
|
"eR" 'alchemist-eval-print-region
|
|
|
|
"eb" 'alchemist-eval-buffer
|
|
|
|
"eB" 'alchemist-eval-print-buffer
|
|
|
|
"ej" 'alchemist-eval-quoted-current-line
|
|
|
|
"eJ" 'alchemist-eval-print-quoted-current-line
|
|
|
|
"eu" 'alchemist-eval-quoted-region
|
|
|
|
"eU" 'alchemist-eval-print-quoted-region
|
|
|
|
"ev" 'alchemist-eval-quoted-buffer
|
|
|
|
"eV" 'alchemist-eval-print-quoted-buffer
|
|
|
|
|
|
|
|
"gt" 'alchemist-project-toggle-file-and-tests
|
|
|
|
"gT" 'alchemist-project-toggle-file-and-tests-other-window
|
|
|
|
|
|
|
|
"h:" 'alchemist-help
|
|
|
|
"hH" 'alchemist-help-history
|
|
|
|
"hh" 'alchemist-help-search-at-point
|
2017-04-14 18:59:47 +00:00
|
|
|
"hr" 'alchemist-help--search-marked-region
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
"m:" 'alchemist-mix
|
|
|
|
"mc" 'alchemist-mix-compile
|
|
|
|
"mx" 'alchemist-mix-run
|
|
|
|
|
|
|
|
"'" 'alchemist-iex-run
|
|
|
|
"sc" 'alchemist-iex-compile-this-buffer
|
|
|
|
"si" 'alchemist-iex-run
|
|
|
|
"sI" 'alchemist-iex-project-run
|
|
|
|
"sl" 'alchemist-iex-send-current-line
|
|
|
|
"sL" 'alchemist-iex-send-current-line-and-go
|
|
|
|
"sm" 'alchemist-iex-reload-module
|
|
|
|
"sr" 'alchemist-iex-send-region
|
|
|
|
"sR" 'alchemist-iex-send-region-and-go
|
|
|
|
|
|
|
|
"ta" 'alchemist-mix-test
|
|
|
|
"tb" 'alchemist-mix-test-this-buffer
|
2017-04-20 01:05:50 +00:00
|
|
|
"tB" 'alchemist-project-run-tests-for-current-file
|
2016-05-27 04:22:47 +00:00
|
|
|
"tt" 'alchemist-mix-test-at-point
|
2016-09-25 20:46:11 +00:00
|
|
|
"tF" 'alchemist-project-find-test
|
2017-04-14 18:59:47 +00:00
|
|
|
"tf" 'alchemist-mix-test-file
|
|
|
|
"tn" 'alchemist-test-mode-jump-to-next-test
|
2017-04-20 01:05:50 +00:00
|
|
|
"tN" 'alchemist-test-mode-jump-to-previous-test
|
2016-05-27 04:22:47 +00:00
|
|
|
"tr" 'alchemist-mix-rerun-last-test
|
2017-04-20 01:05:50 +00:00
|
|
|
"ts" 'alchemist-mix-test-stale
|
|
|
|
"tR" 'alchemist-test-toggle-test-report-display
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
"xb" 'alchemist-execute-this-buffer
|
|
|
|
"xf" 'alchemist-execute-file
|
|
|
|
"x:" 'alchemist-execute
|
|
|
|
|
|
|
|
"cb" 'alchemist-compile-this-buffer
|
|
|
|
"cf" 'alchemist-compile-file
|
|
|
|
"c:" 'alchemist-compile
|
|
|
|
|
2017-04-20 01:05:50 +00:00
|
|
|
"gg" 'alchemist-goto-definition-at-point
|
|
|
|
"." 'alchemist-goto-definition-at-point
|
|
|
|
"gb" 'alchemist-goto-jump-back
|
|
|
|
"," 'alchemist-goto-jump-back
|
|
|
|
"gN" 'alchemist-goto-jump-to-previous-def-symbol
|
|
|
|
"gn" 'alchemist-goto-jump-to-next-def-symbol
|
|
|
|
"gj" 'alchemist-goto-list-symbol-definitions
|
|
|
|
|
|
|
|
"Xi" 'alchemist-hex-info-at-point
|
|
|
|
"Xr" 'alchemist-hex-releases-at-point
|
|
|
|
"XR" 'alchemist-hex-releases
|
|
|
|
"XI" 'alchemist-hex-info
|
|
|
|
"Xs" 'alchemist-hex-search
|
|
|
|
|
|
|
|
"ol" 'alchemist-macroexpand-once-current-line
|
|
|
|
"oL" 'alchemist-macroexpand-once-print-current-line
|
|
|
|
"ok" 'alchemist-macroexpand-current-line
|
|
|
|
"oK" 'alchemist-macroexpand-print-current-line
|
|
|
|
"oi" 'alchemist-macroexpand-once-region
|
|
|
|
"oI" 'alchemist-macroexpand-once-print-region
|
|
|
|
"or" 'alchemist-macroexpand-region
|
2019-09-06 08:00:51 +00:00
|
|
|
"oR" 'alchemist-macroexpand-print-region
|
|
|
|
|
|
|
|
"db" 'spacemacs/elixir-toggle-breakpoint)
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
(dolist (mode (list alchemist-compile-mode-map
|
|
|
|
alchemist-eval-mode-map
|
|
|
|
alchemist-execute-mode-map
|
|
|
|
alchemist-message-mode-map
|
|
|
|
alchemist-help-minor-mode-map
|
|
|
|
alchemist-mix-mode-map
|
|
|
|
alchemist-macroexpand-mode-map
|
|
|
|
alchemist-refcard-mode-map
|
|
|
|
alchemist-test-report-mode-map))
|
|
|
|
(evil-define-key 'normal mode
|
|
|
|
(kbd "q") 'quit-window))))
|
|
|
|
|
2019-09-30 01:30:53 +00:00
|
|
|
(defun elixir/post-init-company ()
|
|
|
|
;; backend specific
|
|
|
|
(add-hook 'elixir-mode-local-vars-hook #'spacemacs//elixir-setup-company))
|
2016-06-01 01:34:51 +00:00
|
|
|
|
2019-09-30 01:30:53 +00:00
|
|
|
(defun elixir/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'elixir-mode))
|
|
|
|
|
|
|
|
(defun elixir/pre-init-dap-mode ()
|
2020-05-16 21:32:30 +00:00
|
|
|
(pcase (spacemacs//elixir-backend)
|
|
|
|
(`lsp (add-to-list 'spacemacs--dap-supported-modes 'elixir-mode)))
|
2019-09-30 01:30:53 +00:00
|
|
|
(add-hook 'elixir-mode-local-vars-hook #'spacemacs//elixir-setup-dap))
|
2016-12-24 21:58:47 +00:00
|
|
|
|
2019-10-18 13:52:04 +00:00
|
|
|
(defun elixir/post-init-evil-matchit ()
|
|
|
|
(add-hook 'elixir-mode-hook `turn-on-evil-matchit-mode))
|
|
|
|
|
2016-06-01 01:34:51 +00:00
|
|
|
(defun elixir/init-elixir-mode ()
|
|
|
|
(use-package elixir-mode
|
2018-06-07 04:07:28 +00:00
|
|
|
:defer t
|
2019-08-27 10:21:24 +00:00
|
|
|
:init (spacemacs/add-to-hook 'elixir-mode-hook
|
2019-09-06 08:00:51 +00:00
|
|
|
'(spacemacs//elixir-setup-backend
|
|
|
|
spacemacs//elixir-default))
|
2018-06-07 04:07:28 +00:00
|
|
|
:config
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'elixir-mode
|
|
|
|
"=" 'elixir-format)))
|
2016-06-01 01:34:51 +00:00
|
|
|
|
|
|
|
(defun elixir/post-init-flycheck ()
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck 'elixir-mode))
|
2016-06-01 01:34:51 +00:00
|
|
|
|
2019-09-30 01:30:53 +00:00
|
|
|
(defun elixir/init-flycheck-credo ()
|
|
|
|
(use-package flycheck-credo
|
|
|
|
:defer t
|
|
|
|
:init (add-hook 'flycheck-mode-hook #'flycheck-credo-setup)))
|
|
|
|
|
|
|
|
(defun elixir/init-flycheck-mix ()
|
|
|
|
(use-package flycheck-mix
|
|
|
|
:commands (flycheck-mix-setup)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(add-to-list 'safe-local-variable-values
|
|
|
|
(cons 'elixir-enable-compilation-checking nil))
|
|
|
|
(add-to-list 'safe-local-variable-values
|
|
|
|
(cons 'elixir-enable-compilation-checking t))
|
|
|
|
(add-hook 'elixir-mode-local-vars-hook
|
|
|
|
'spacemacs//elixir-enable-compilation-checking))))
|
|
|
|
|
|
|
|
(defun elixir/post-init-ggtags ()
|
|
|
|
(add-hook 'elixir-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
|
|
|
|
|
|
|
(defun elixir/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'elixir-mode))
|
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun elixir/pre-init-ob-elixir ()
|
2016-10-11 23:00:36 +00:00
|
|
|
(spacemacs|use-package-add-hook org
|
|
|
|
:post-config
|
|
|
|
(use-package ob-elixir
|
|
|
|
:init (add-to-list 'org-babel-load-languages '(elixir . t)))))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun elixir/init-ob-elixir ())
|
2016-10-11 23:00:36 +00:00
|
|
|
|
2016-06-01 01:34:51 +00:00
|
|
|
(defun elixir/pre-init-popwin ()
|
|
|
|
(spacemacs|use-package-add-hook popwin
|
|
|
|
:post-config
|
|
|
|
(push '("*mix*" :tail t :noselect t) popwin:special-display-config)))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
2016-07-25 05:36:36 +00:00
|
|
|
(defun elixir/pre-init-smartparens ()
|
2016-05-31 17:49:09 +00:00
|
|
|
(spacemacs|use-package-add-hook smartparens
|
|
|
|
:post-config
|
|
|
|
(progn
|
|
|
|
(sp-with-modes '(elixir-mode)
|
|
|
|
(sp-local-pair
|
2016-12-22 08:31:05 +00:00
|
|
|
"(" ")"
|
|
|
|
:unless '(:add spacemacs//elixir-point-after-fn-p))
|
|
|
|
(sp-local-pair
|
|
|
|
"fn" "end"
|
|
|
|
:when '(("SPC" "RET" "-" "("))
|
2016-05-31 17:49:09 +00:00
|
|
|
:post-handlers '(:add spacemacs//elixir-do-end-close-action)
|
|
|
|
:actions '(insert)))
|
|
|
|
(sp-with-modes '(elixir-mode)
|
|
|
|
(sp-local-pair
|
|
|
|
"do" "end"
|
|
|
|
:when '(("SPC" "RET"))
|
|
|
|
:post-handlers '(:add spacemacs//elixir-do-end-close-action)
|
|
|
|
:actions '(insert))))))
|