/
.emacs
221 lines (187 loc) · 5.85 KB
/
.emacs
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
;; Steps to install:
;; 0. Install Haskell tools:
;; * ghc
;; * cabal
;; * stylish-haskell
;; * fast-tags
;; * hoogle
;; 1. Copy ~/.emacs up to ;; PACKAGES ;;
;; 2. Restart Emacs
;; 3. Install packages (M-x list-packages) and then (i to mark for installation and "x" to install all)
;; * <color theme of choice>
;; * company
;; * company-ghci
;; * evil
;; * exec-path-from-shell
;; * haskell-mode
;; * markdown-mode
;; * rainbow-delimeters
;; * smart-mode-line
;; * smex
;; * use-package
;; 4. Copy the rest of .emacs file
;; 5. Restart and enjoy!
;; disable package signature check (dirty hack to make it work)
(setq package-check-signature nil)
;; Configure MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
)
(package-initialize)
;; set default startup screen
(setq inhibit-startup-screen t)
;; disable toolbars and menus
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
(column-number-mode 1)
;; disable annoying beeping and blinking
(setq visible-bell t)
(setq ring-bell-function 'ignore)
;; set font
(set-frame-font "Ubuntu Mono-14")
;; put all auto-save files in a separate directory
(setq backup-directory-alist '(("." . "~/.emacs_saves")))
;; save desktop session on quit
(desktop-save-mode 1)
;; automatically update buffers when files change
(global-auto-revert-mode t)
;;;;;;;;;;;;;;
;; PACKAGES ;;
;;;;;;;;;;;;;;
;; use-package: simple package configuration
(require 'use-package)
;; set $PATH from user shell
(exec-path-from-shell-initialize)
;; ido (file navigation)
(require 'ido)
(ido-mode t)
;; smex (like ido but for commands)
(require 'smex)
(global-set-key (kbd "M-x") 'smex)
;; vim bindings
(require 'evil)
(evil-mode t)
(add-hook
'evil-insert-state-exit-hook
(lambda () (call-interactively #'save-buffer))
)
;; rainbow delimeters
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
;; git diff highlight
(require 'diff-hl)
(global-diff-hl-mode t)
;; smart-mode-line
(setq sml/no-confirm-load-theme t)
(sml/setup)
(setq
sml/theme 'dark
sml/shorten-directory t
sml/shorten-modes t
)
;; markdown
(use-package markdown-mode
:ensure t
:commands (markdown-mode gfm-mode)
:mode
( ("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)
)
:init (setq markdown-command "multimarkdown")
)
;;;;;;;;;;;;;
;; HASKELL ;;
;;;;;;;;;;;;;
(require 'haskell-mode)
(require 'haskell-interactive-mode)
(require 'haskell-process)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode) ;; enable interactive mode
(add-hook 'haskell-mode-hook 'flyspell-prog-mode) ;; spell checking in Haskell files
(add-hook 'haskell-mode-hook 'haskell-auto-insert-module-template) ;; default template
;;; configure interactive mode
(setq
haskell-process-type 'cabal-repl
haskell-process-log t
haskell-interactive-popup-errors nil
haskell-process-auto-import-loaded-modules t
haskell-process-suggest-remove-import-lines t
haskell-process-suggest-hoogle-imports t
)
;;: formatting
(setq haskell-stylish-on-save t)
;;; haskell layout offsets
(setq
haskell-indentation-ifte-offset 4
haskell-indentation-layout-offset 4
haskell-indentation-left-offset 4
haskell-indentation-starter-offset 4
haskell-indentation-where-post-offset 2
haskell-indentation-where-pre-offset 2
)
;;; haskell hotkeys
(define-key haskell-mode-map (kbd "<f8>") 'haskell-navigate-imports)
(define-key haskell-mode-map (kbd "M-g") 'haskell-mode-tag-find)
;;; haskell autocompletion
(require 'company-ghci)
(push 'company-ghci company-backends)
(add-hook 'haskell-mode-hook 'company-mode)
(add-hook
'haskell-mode-hook
(lambda ()
(set (make-local-variable 'company-backends)
(append '((company-capf company-dabbrev-code)) company-backends)
)
)
)
;; (setq haskell-tags-on-save t)
;;;;;;;;;;;;;;;;;;;;;;;;;;
;; V generated by emacs ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (dracula)))
'(custom-safe-themes
(quote
("947190b4f17f78c39b0ab1ea95b1e6097cc9202d55c73a702395fc817f899393" "47ec21abaa6642fefec1b7ace282221574c2dd7ef7715c099af5629926eb4fd7" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "2eb1f5551310e99101f0f9426485ab73aa5386054da877aacd15d438382bb72e" default)))
'(frame-brackground-mode (quote dark))
'(package-selected-packages
(quote
(use-package markdown-mode dracula-theme smart-mode-line company company-ghci exec-path-from-shell diff-hl haskell-mode rainbow-delimiters evil smex))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; /\ generated by emacs /\ ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EDITOR AND COLOR SETTINGS
;; Set cursor color to white
(set-cursor-color "#ffffff")
;; higlight line
(require 'hl-line)
(global-hl-line-mode t)
(set-face-background 'hl-line "#20385E")
;; whitespace mode
(require 'whitespace)
(setq whitespace-line-column 120) ;; higlight long lines
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(set-face-attribute 'whitespace-space nil :background nil)
(set-face-attribute 'whitespace-indentation nil :background nil)
(set-face-attribute 'whitespace-newline nil
:background nil
:foreground "gray30"
)
(setq whitespace-display-mappings
'(
(space-mark 32 [32])
(newline-mark 10 [182 10])
(tab-mark 9 [10148])
)
)