-
Notifications
You must be signed in to change notification settings - Fork 0
/
scala-config.el
84 lines (68 loc) · 2.59 KB
/
scala-config.el
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
(require 'package) ;; You might already have this line
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(url (concat (if no-ssl "http" "https") "://stable.melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa-stable" url) t))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
;;We have "sbt" and "scala" in /usr/local/bin so we add this path to the PATH environment
(setq exec-path (append exec-path '("/usr/local/bin")))
(setq exec-path (append exec-path '("/usr/local/sbin")))
(setenv "PATH" (shell-command-to-string "/bin/bash -c 'echo -n $PATH'"))
(use-package smartparens
:diminish smartparens-mode
:commands
smartparens-strict-mode
smartparens-mode
sp-restrict-to-pairs-interactive
sp-local-pair
:init
(setq sp-interactive-dwim t)
:config
(require 'smartparens-config)
(sp-use-smartparens-bindings)
(sp-pair "(" ")" :wrap "C-(") ;; how do people live without this?
(sp-pair "[" "]" :wrap "s-[") ;; C-[ sends ESC
(sp-pair "{" "}" :wrap "C-{")
;; WORKAROUND https://github.com/Fuco1/smartparens/issues/543
(bind-key "C-<left>" nil smartparens-mode-map)
(bind-key "C-<right>" nil smartparens-mode-map)
(bind-key "s-<delete>" 'sp-kill-sexp smartparens-mode-map)
(bind-key "s-<backspace>" 'sp-backward-kill-sexp smartparens-mode-map))
(use-package projectile
:demand
:init (setq projectile-use-git-grep t)
:config (projectile-global-mode t)
:bind (("s-f" . projectile-find-file)
("s-F" . projectile-grep)))
(use-package flycheck-cask
:commands flycheck-cask-setup
:config (add-hook 'emacs-lisp-mode-hook (flycheck-cask-setup)))
(use-package eldoc
:ensure nil
:diminish eldoc-mode
:commands eldoc-mode)
(use-package yasnippet
:diminish yas-minor-mode
:commands yas-minor-mode
:config (yas-reload-all))
(use-package ensime
:ensure t
:pin melpa-stable)
(defun scala-mode-newline-comments ()
"Custom newline appropriate for `scala-mode'."
;; shouldn't this be in a post-insert hook?
(interactive)
(newline-and-indent)
(scala-indent:insert-asterisk-on-multiline-comment))
(add-hook 'scala-mode-hook
(lambda ()
(show-paren-mode)
(smartparens-mode)
(yas-minor-mode)
(company-mode)
(ensime-mode)
(scala-mode:goto-start-of-code)
(bind-key "RET" 'scala-mode-newline-comments scala-mode-map)))