2018-05-21 07:11:59 +00:00
|
|
|
;;; packages.el --- Crystal Layer packages File for Spacemacs
|
|
|
|
;;
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2018-05-21 07:11:59 +00:00
|
|
|
;;
|
|
|
|
;; Author: Brantou <brantou89@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(defconst crystal-packages
|
2020-11-10 21:43:18 +00:00
|
|
|
'((ameba :location (recipe :fetcher github
|
2018-05-21 07:11:59 +00:00
|
|
|
:repo "veelenga/ameba.el"
|
|
|
|
:files ("ameba.el")))
|
|
|
|
company
|
|
|
|
crystal-mode
|
|
|
|
flycheck
|
|
|
|
(flycheck-crystal :requires flycheck)
|
|
|
|
inf-crystal
|
|
|
|
ob-crystal
|
2020-11-10 21:43:18 +00:00
|
|
|
play-crystal))
|
|
|
|
|
|
|
|
(defun crystal/post-init-company ()
|
|
|
|
(spacemacs//crystal-setup-company))
|
2018-05-21 07:11:59 +00:00
|
|
|
|
2021-02-10 07:51:55 +00:00
|
|
|
(defun crystal/init-ameba ()
|
2018-05-21 07:11:59 +00:00
|
|
|
(use-package ameba
|
|
|
|
:defer t
|
2020-11-10 21:43:18 +00:00
|
|
|
:init
|
2018-05-21 07:11:59 +00:00
|
|
|
(progn
|
2020-11-10 21:43:18 +00:00
|
|
|
(add-hook 'crystal-mode-hook 'ameba-mode)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "mua" "ameba")
|
2018-05-21 07:11:59 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
|
2020-11-10 21:43:18 +00:00
|
|
|
"uad" 'ameba-check-directory
|
|
|
|
"uaf" 'ameba-check-current-file
|
|
|
|
"uap" 'ameba-check-project))))
|
2018-05-21 07:11:59 +00:00
|
|
|
|
2021-02-10 07:51:55 +00:00
|
|
|
(defun crystal/init-crystal-mode ()
|
2018-05-21 07:11:59 +00:00
|
|
|
(use-package crystal-mode
|
|
|
|
:defer t
|
2020-11-10 21:43:18 +00:00
|
|
|
:init
|
2018-05-21 07:11:59 +00:00
|
|
|
(progn
|
|
|
|
(add-hook 'crystal-mode-hook 'spacemacs//crystal-auto-format-setup)
|
2020-11-10 21:43:18 +00:00
|
|
|
(add-hook 'crystal-mode-hook #'spacemacs//crystal-setup-backend)
|
2018-05-21 07:11:59 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "mu" "tool")
|
2020-11-10 21:43:18 +00:00
|
|
|
(unless (eq (spacemacs//crystal-backend) 'lsp)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "mg" "goto")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "mt" "test")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "ma" "action"))
|
2018-05-21 07:11:59 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
|
|
|
|
"ga" 'crystal-spec-switch
|
|
|
|
"tb" 'crystal-spec-buffer
|
|
|
|
"tp" 'crystal-spec-all
|
|
|
|
"uc" 'crystal-tool-context
|
|
|
|
"ue" 'crystal-tool-expand
|
|
|
|
"uf" 'crystal-tool-format
|
|
|
|
"ui" 'crystal-tool-imp
|
2020-11-10 21:43:18 +00:00
|
|
|
"ax" 'spacemacs/crystal-run-main))))
|
2018-05-21 07:11:59 +00:00
|
|
|
|
2021-02-10 07:51:55 +00:00
|
|
|
(defun crystal/post-init-flycheck ()
|
2018-05-21 07:11:59 +00:00
|
|
|
(spacemacs/enable-flycheck 'crystal-mode))
|
|
|
|
|
|
|
|
(defun crystal/init-flycheck-crystal ()
|
2020-11-10 21:43:18 +00:00
|
|
|
(use-package flycheck-crystal))
|
2018-05-21 07:11:59 +00:00
|
|
|
|
2021-02-10 07:51:55 +00:00
|
|
|
(defun crystal/init-inf-crystal ()
|
2018-05-21 07:11:59 +00:00
|
|
|
(use-package inf-crystal
|
2018-06-11 03:59:12 +00:00
|
|
|
:defer t
|
2018-05-21 07:11:59 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/register-repl 'inf-crystal 'inf-crystal "inf-crystal")
|
2020-11-10 21:43:18 +00:00
|
|
|
(add-hook 'crystal-mode-hook 'inf-crystal-minor-mode)
|
2018-05-21 07:11:59 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "ms" "repl")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
|
|
|
|
"'" 'inf-crystal
|
|
|
|
"sb" 'crystal-send-buffer
|
|
|
|
"sB" 'crystal-send-buffer-and-go
|
|
|
|
"sf" 'crystal-send-definition
|
|
|
|
"sF" 'crystal-send-definition-and-go
|
|
|
|
"si" 'inf-crystal
|
|
|
|
"sr" 'crystal-send-region
|
|
|
|
"sR" 'crystal-send-region-and-go
|
|
|
|
"ss" 'crystal-switch-to-inf))))
|
|
|
|
|
|
|
|
(defun crystal/pre-init-ob-crystal ()
|
|
|
|
(spacemacs|use-package-add-hook org
|
|
|
|
:post-config
|
|
|
|
(use-package ob-crystal
|
|
|
|
:init (add-to-list 'org-babel-load-languages '(crystal . t)))))
|
|
|
|
(defun crystal/init-ob-crystal ())
|
|
|
|
|
2021-02-10 07:51:55 +00:00
|
|
|
(defun crystal/init-play-crystal ()
|
2018-05-21 07:11:59 +00:00
|
|
|
(use-package play-crystal
|
|
|
|
:defer t
|
2018-06-11 06:15:47 +00:00
|
|
|
:init
|
2018-05-21 07:11:59 +00:00
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'crystal-mode "me" "play")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
|
|
|
|
"eb" 'play-crystal-submit-buffer
|
|
|
|
"ee" 'play-crystal-browse
|
|
|
|
"ei" 'play-crystal-insert
|
|
|
|
"er" 'play-crystal-submit-region))))
|