This repository was archived by the owner on Nov 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackages.el
More file actions
118 lines (105 loc) · 3.64 KB
/
Copy pathpackages.el
File metadata and controls
118 lines (105 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
;;; packages.el --- crystal layer packages file for Spacemacs.
;;
;; Copyright (C) 2017 Brantou
;;
;; Author: Brantou <brantou89@gmail.com>
;; URL: https://github.com/brantou/spacemacs-crystal-layer
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Code:
(defconst crystal-packages
'(
company
flycheck
(flycheck-crystal :toggle (configuration-layer/package-usedp 'flycheck))
crystal-mode
play-crystal
inf-crystal
ob-crystal
(ameba :location (recipe :fetcher github
:repo "veelenga/ameba.el"
:files ("ameba.el")))
))
(defun crystal/post-init-company()
(spacemacs|add-company-hook crystal-mode))
(defun crystal/post-init-flycheck()
(spacemacs/add-flycheck-hook 'crystal-mode))
(defun crystal/init-flycheck-crystal ()
(use-package flycheck-crystal
:init (add-hook 'crystal-mode-hook 'flycheck-mode)))
(defun crystal/init-crystal-mode()
(use-package crystal-mode
:defer t
:config
(progn
(add-hook 'crystal-mode-hook
(lambda () (add-hook 'before-save-hook 'crystal-tool-format nil 'local)))
(defun spacemacs/crystal-run-main ()
(interactive)
(let ((default-directory (crystal-find-project-root)))
(shell-command
(format "crystal run %s"
(shell-quote-argument (buffer-file-name))))))
(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 "mu" "tool")
(spacemacs/declare-prefix-for-mode 'crystal-mode "mx" "execute")
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
"ga" 'crystal-spec-switch
"xx" 'spacemacs/crystal-run-main
"tb" 'crystal-spec-buffer
"tp" 'crystal-spec-all
"uc" 'crystal-tool-context
"ue" 'crystal-tool-expand
"uf" 'crystal-tool-format
"ui" 'crystal-tool-imp))))
(defun crystal/init-play-crystal()
(use-package play-crystal
:defer t
:config
(progn
(spacemacs/declare-prefix-for-mode 'crystal-mode "me" "play")
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
"eb" 'play-crystal-submit-buffer
"er" 'play-crystal-submit-region
"ee" 'play-crystal-browse
"ei" 'play-crystal-insert))))
(defun crystal/init-inf-crystal()
(use-package inf-crystal
:init
(progn
(spacemacs/register-repl 'inf-crystal 'inf-crystal "inf-crystal")
(add-hook 'crystal-mode-hook 'inf-crystal-minor-mode))
:config
(progn
(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 ())
(defun crystal/init-ameba()
(use-package ameba
:init
(add-hook 'crystal-mode-hook 'ameba-mode)
:config
(progn
(spacemacs/declare-prefix-for-mode 'crystal-mode "ma" "ameba")
(spacemacs/set-leader-keys-for-major-mode 'crystal-mode
"af" 'ameba-check-current-file
"ad" 'ameba-check-directory
"ap" 'ameba-check-project))))
;;; packages.el ends here