2015-08-02 13:04:12 +00:00
|
|
|
;;; packages.el --- elm Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-08-02 13:04:12 +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
|
|
|
|
|
|
|
|
(setq elm-packages
|
|
|
|
'(
|
|
|
|
company
|
|
|
|
elm-mode
|
2018-08-30 13:04:45 +00:00
|
|
|
elm-test-runner
|
2015-08-02 13:04:12 +00:00
|
|
|
flycheck
|
2017-07-03 07:52:54 +00:00
|
|
|
(flycheck-elm :requires flycheck)
|
2015-08-02 13:04:12 +00:00
|
|
|
popwin
|
|
|
|
smartparens
|
|
|
|
))
|
|
|
|
|
2016-05-27 04:22:47 +00:00
|
|
|
(defun elm/post-init-company ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-elm :modes elm-mode)
|
|
|
|
(add-hook 'elm-mode-hook 'elm-oracle-setup-completion))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
(defun elm/post-init-flycheck ()
|
2016-12-27 22:44:03 +00:00
|
|
|
(add-hook 'elm-mode-hook 'flycheck-mode))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun elm/init-flycheck-elm ()
|
|
|
|
"Initialize flycheck-elm"
|
|
|
|
(use-package flycheck-elm
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-30 02:39:21 +00:00
|
|
|
:init (add-hook 'flycheck-mode-hook 'flycheck-elm-setup t)))
|
2016-05-27 04:22:47 +00:00
|
|
|
|
|
|
|
(defun elm/init-elm-mode ()
|
|
|
|
"Initialize elm-mode"
|
|
|
|
(use-package elm-mode
|
|
|
|
:mode ("\\.elm\\'" . elm-mode)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/register-repl 'elm-mode 'elm-repl-load "elm")
|
|
|
|
|
|
|
|
(defun spacemacs/init-elm-mode ()
|
|
|
|
"Disable electric-indent-mode and let indentation cycling feature work"
|
|
|
|
(if (fboundp 'electric-indent-local-mode)
|
|
|
|
(electric-indent-local-mode -1)))
|
|
|
|
|
|
|
|
(add-hook 'elm-mode-hook 'spacemacs/init-elm-mode))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'elm-mode
|
2016-07-07 02:09:25 +00:00
|
|
|
;; format
|
|
|
|
"=b" 'elm-mode-format-buffer
|
2016-05-27 04:22:47 +00:00
|
|
|
;; make
|
|
|
|
"cb" 'elm-compile-buffer
|
|
|
|
"cB" 'spacemacs/elm-compile-buffer-output
|
|
|
|
"cm" 'elm-compile-main
|
|
|
|
;; oracle
|
2016-10-03 02:09:25 +00:00
|
|
|
"hh" 'elm-oracle-doc-at-point
|
2016-05-27 04:22:47 +00:00
|
|
|
"ht" 'elm-oracle-type-at-point
|
2016-06-06 17:03:40 +00:00
|
|
|
;; refactoring
|
|
|
|
"ri" 'elm-sort-imports
|
2016-05-27 04:22:47 +00:00
|
|
|
;; repl
|
|
|
|
"'" 'elm-repl-load
|
|
|
|
"si" 'elm-repl-load
|
|
|
|
"sf" 'elm-repl-push-decl
|
|
|
|
"sF" 'spacemacs/elm-repl-push-decl-focus
|
|
|
|
"sr" 'elm-repl-push
|
|
|
|
"sR" 'spacemacs/elm-repl-push-focus
|
|
|
|
;; reactor
|
|
|
|
"Rn" 'elm-preview-buffer
|
|
|
|
"Rm" 'elm-preview-main
|
|
|
|
;; package
|
|
|
|
"pi" 'elm-import
|
|
|
|
"pc" 'elm-package-catalog
|
|
|
|
"pd" 'elm-documentation-lookup)
|
|
|
|
|
2016-07-07 02:09:25 +00:00
|
|
|
(dolist (x '(("m=" . "format")
|
2016-05-27 04:22:47 +00:00
|
|
|
("mc" . "compile")
|
|
|
|
("mh" . "help")
|
|
|
|
("mp" . "package")
|
2016-07-07 02:09:25 +00:00
|
|
|
("mR" . "reactor")
|
2016-06-06 17:03:40 +00:00
|
|
|
("mr" . "refactor")
|
2016-05-27 04:22:47 +00:00
|
|
|
("ms" . "repl")))
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elm-mode (car x) (cdr x)))
|
|
|
|
|
|
|
|
(evilified-state-evilify elm-package-mode elm-package-mode-map
|
|
|
|
"g" 'elm-package-refresh
|
|
|
|
"v" 'elm-package-view
|
|
|
|
"m" 'elm-package-mark
|
|
|
|
"u" 'elm-package-unmark
|
|
|
|
"x" 'elm-package-install
|
|
|
|
"q" 'quit-window))))
|
|
|
|
|
2018-08-30 13:04:45 +00:00
|
|
|
(defun elm/init-elm-test-runner ()
|
|
|
|
(use-package elm-test-runner
|
|
|
|
:after elm-mode
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elm-mode "mt" "test")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'elm-mode
|
|
|
|
"tb" 'elm-test-runner-run
|
|
|
|
"td" 'elm-test-runner-run-directory
|
|
|
|
"tp" 'elm-test-runner-run-project
|
|
|
|
"tr" 'elm-test-runner-rerun
|
|
|
|
"tw" 'elm-test-runner-watch
|
|
|
|
"t TAB" 'elm-test-runner-toggle-test-and-target
|
|
|
|
))))
|
|
|
|
|
2016-05-27 04:22:47 +00:00
|
|
|
(defun elm/pre-init-popwin ()
|
|
|
|
(spacemacs|use-package-add-hook popwin
|
|
|
|
:post-config
|
|
|
|
(push '("*elm*" :tail t :noselect t) popwin:special-display-config)
|
|
|
|
(push '("*elm-make*" :tail t :noselect t) popwin:special-display-config)))
|
|
|
|
|
2018-03-04 04:37:53 +00:00
|
|
|
(defun elm/post-init-smartparens ()
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
(add-hook 'elm-mode-hook #'smartparens-strict-mode)
|
|
|
|
(add-hook 'elm-mode-hook #'smartparens-mode)))
|