2015-06-09 03:26:56 +00:00
|
|
|
;;; packages.el --- Elixir Layer packages File for Spacemacs
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 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
|
|
|
|
|
2015-06-09 03:26:56 +00:00
|
|
|
(setq elixir-packages
|
2014-11-29 04:59:23 +00:00
|
|
|
'(
|
2015-01-20 22:28:32 +00:00
|
|
|
alchemist
|
2015-06-09 03:28:27 +00:00
|
|
|
company
|
2014-11-29 04:59:23 +00:00
|
|
|
elixir-mode
|
2016-06-01 01:34:51 +00:00
|
|
|
flycheck
|
2016-06-07 07:42:35 +00:00
|
|
|
flycheck-mix
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
|
|
|
helm-gtags
|
2015-05-28 14:01:09 +00:00
|
|
|
popwin
|
2016-02-11 17:04:16 +00:00
|
|
|
smartparens
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
2016-06-01 01:34:51 +00:00
|
|
|
(defun elixir/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook elixir-mode)
|
|
|
|
(spacemacs|add-company-hook alchemist-iex-mode))
|
|
|
|
|
2016-05-27 04:22:47 +00:00
|
|
|
(defun elixir/init-alchemist ()
|
|
|
|
(use-package alchemist
|
|
|
|
:defer t
|
|
|
|
: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)
|
|
|
|
;; setup company backends
|
2016-05-27 04:22:47 +00:00
|
|
|
(push 'alchemist-company company-backends-elixir-mode)
|
|
|
|
(push 'alchemist-company company-backends-alchemist-iex-mode))
|
|
|
|
:config
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mc" "compile")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "me" "eval")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mp" "project")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mh" "help")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mt" "test")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "ms" "iex")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mm" "mix")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mx" "execute")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elixir-mode "mg" "goto")
|
|
|
|
(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
|
|
|
|
|
|
|
|
"pt" 'alchemist-project-find-test
|
|
|
|
"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
|
|
|
|
"hr" 'alchemist-help-search-marked-region
|
|
|
|
|
|
|
|
"m:" 'alchemist-mix
|
|
|
|
"mc" 'alchemist-mix-compile
|
|
|
|
"mx" 'alchemist-mix-run
|
|
|
|
"mh" 'alchemist-mix-help
|
|
|
|
|
|
|
|
"'" '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
|
|
|
|
"tt" 'alchemist-mix-test-at-point
|
|
|
|
"tf" 'alchemist-test-file
|
|
|
|
"tn" 'alchemist-test-jump-to-next-test
|
|
|
|
"tp" 'alchemist-test-jump-to-previous-test
|
|
|
|
"tr" 'alchemist-mix-rerun-last-test
|
|
|
|
|
|
|
|
"xb" 'alchemist-execute-this-buffer
|
|
|
|
"xf" 'alchemist-execute-file
|
|
|
|
"x:" 'alchemist-execute
|
|
|
|
|
|
|
|
"cb" 'alchemist-compile-this-buffer
|
|
|
|
"cf" 'alchemist-compile-file
|
|
|
|
"c:" 'alchemist-compile
|
|
|
|
|
|
|
|
"gg" 'alchemist-goto-definition-at-point
|
|
|
|
"," 'alchemist-goto-jump-back)
|
|
|
|
|
|
|
|
(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))))
|
|
|
|
|
2016-06-07 07:42:35 +00:00
|
|
|
(defun elixir/init-flycheck-mix ()
|
|
|
|
(use-package flycheck-mix
|
|
|
|
:commands (flycheck-mix-setup)
|
2016-06-01 01:34:51 +00:00
|
|
|
: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))
|
2016-06-26 18:04:13 +00:00
|
|
|
(add-hook 'elixir-mode-local-vars-hook
|
|
|
|
'spacemacs//elixir-enable-compilation-checking))))
|
2016-06-01 01:34:51 +00:00
|
|
|
|
|
|
|
(defun elixir/init-elixir-mode ()
|
|
|
|
(use-package elixir-mode
|
|
|
|
:defer t))
|
|
|
|
|
|
|
|
(defun elixir/post-init-flycheck ()
|
2016-06-01 02:15:19 +00:00
|
|
|
(spacemacs/add-flycheck-hook 'elixir-mode)
|
2016-06-01 15:28:10 +00:00
|
|
|
(add-hook 'elixir-mode-hook
|
|
|
|
'spacemacs//elixir-flycheck-check-on-save-only t))
|
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
|
|
|
|
"->" "end"
|
|
|
|
:when '(("RET"))
|
|
|
|
: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))))))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
|
|
|
(defun elixir/post-init-ggtags ()
|
|
|
|
(add-hook 'elixir-mode-hook #'spacemacs/ggtags-mode-enable))
|
|
|
|
|
|
|
|
(defun elixir/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'elixir-mode))
|