-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.el
More file actions
241 lines (186 loc) · 6.9 KB
/
init.el
File metadata and controls
241 lines (186 loc) · 6.9 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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
;; EMACS(-A) INIT FILE - the monumental one
;; (for writing source code)
;; =====================================================================
;; Make this file run faster by making GC run less often
;; Remember to reset this value at the end!
(setq gc-cons-threshold 100000000)
;; MELPA
;; =====================================================================
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; Require(s)
;; =====================================================================
(eval-when-compile
(require 'bind-key)
(require 'use-package))
;; Defaults etc.
;; =====================================================================
;; Frame title
(setq frame-title-format '("" "%b :: Emacs NT 4.0 Workstation"))
;; Tame Cocoa Emacs
(setq mac-option-modifier nil
mac-command-modifier 'meta
x-select-enable-clipboard t)
;; Load common config
;; =====================================================================
(load (concat user-emacs-directory "common.el"))
;; General Emacs customization
;; =====================================================================
;; Load up inferior lisp in the same window. This tweak alone improves
;; my sanity by at least 10%.
(add-to-list 'display-buffer-alist
'("\\*inferior-lisp\\*" (display-buffer-same-window)))
;; Modes and Languages
;; =====================================================================
;; Web mode
;; --------
(use-package web-mode
:ensure t
:mode ("\\.tt2\\'"
"\\.dtl\\'"
"\\.html\\'")
:init
(defun web-mode-custom-indent ()
(setq web-mode-markup-indent-offset nanont/indent-level)
(setq web-mode-css-indent-offset nanont/indent-level)
(setq web-mode-code-indent-offset nanont/indent-level)
(setq web-mode-indent-style nanont/indent-level))
(add-hook 'web-mode-hook 'web-mode-custom-indent)
:config
;; Stop web-mode from placing quotes like `abbr=""` the
;; second you type the equal sign
(setq web-mode-enable-auto-quoting nil))
;; CSS Mode
;; --------
(setq css-indent-offset nanont/indent-level)
;; Perl oddities
;; -------------
;; Test files
(add-to-list 'auto-mode-alist '("\\.t\\'" . perl-mode))
;; Indentation
(setq perl-indent-level nanont/indent-level)
;; Align ( ) like { }
(setq perl-indent-parens-as-block t)
;; Get rid of displaying whitespace as underlines
(setq perl-invalid-face nil)
;; Lua oddities
;; ------------
(setq lua-indent-level nanont/indent-level)
;; Go oddities
;; -----------
;; Run goimports as a formatter
(setq gofmt-command "goimports")
(defun nanont/go-mode-before-save-hook ()
(when (eq major-mode 'go-mode)
(gofmt-before-save)))
(add-hook 'before-save-hook 'nanont/go-mode-before-save-hook)
;; Company
;; =====================================================================
(use-package company
:ensure t
:init
(bind-key* "C-#" 'company-complete)
(add-hook 'after-init-hook 'global-company-mode))
;; FZF
;; =====================================================================
(use-package fzf
; :ensure t
:init
; This actually Does The Right Thing by asking
; for a path if not in a git directory! Funky!
(bind-key* "C-c C-f" 'fzf-git))
;; Editing
;; =====================================================================
;; Highlight current line
(global-hl-line-mode 1)
;; Highlight matching parentheses on "hovering" over them
(show-paren-mode 1)
;; Enable EditorConfig
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
;; Org
;; =====================================================================
;; org-journal
(use-package org-journal
:ensure t
:defer t
:custom
(org-journal-dir (if (member system-type '(windows-nt cygwin))
"~/Documents/org/journal"
"~/org/journal"))
(org-journal-file-format "journal%Y%m%d.txt")
(org-journal-file-type 'weekly))
(bind-key* "C-c C-j" 'org-journal-new-entry)
;; Manual bloat-loading facilities
;; =====================================================================
(defun load-bloat ()
(interactive)
(load (concat user-emacs-directory "bloat.el")))
;; Theming
;; =====================================================================
(push (substitute-in-file-name "~/.emacs.d/themes/")
custom-theme-load-path)
;; I seriously do NOT get low-contrast people.
(set-background-color "#000000")
(set-foreground-color "#ffffff")
(defun ensure-face (face)
(or (facep face)
(make-empty-face face)))
(ensure-face 'font-lock-comment-face)
(ensure-face 'font-lock-string-face)
(ensure-face 'font-lock-number-face)
(ensure-face 'font-lock-keyword-face)
(ensure-face 'font-lock-type-face)
(ensure-face 'font-lock-function-name-face)
(ensure-face 'font-lock-function-call-face)
(ensure-face 'font-lock-variable-name-face)
(ensure-face 'font-lock-builtin-face)
;(ensure-face 'font-lock-function-name-face)
;(ensure-face 'font-lock-function-call-face)
;; Minimal yet practical colour scheme.
;; Tip: List the currently applied face at POINT with M-x describe-char
(set-face-foreground 'font-lock-comment-face "#ffffff")
(set-face-background 'font-lock-comment-face "#333333")
(set-face-foreground 'font-lock-string-face "#ff0000")
(set-face-foreground 'font-lock-number-face "#ff0000")
(set-face-foreground 'font-lock-keyword-face "#ffffff")
(set-face-foreground 'font-lock-type-face "#ffffff")
(set-face-foreground 'font-lock-function-name-face "#ff0000")
(set-face-foreground 'font-lock-function-call-face "#ff0000")
(set-face-foreground 'font-lock-variable-name-face "#ffffff")
(set-face-foreground 'font-lock-builtin-face "#ffffff")
(set-face-foreground 'minibuffer-prompt "#ffffff")
(set-face-background 'minibuffer-prompt "midnight blue")
(set-face-background 'show-paren-match "#ff0000")
(set-face-foreground 'show-paren-match "#000000")
(set-face-background 'hl-line "midnight blue")
;; Make fringes use the default background colour
(set-face-attribute 'fringe nil
:foreground (face-foreground 'default)
:background (face-background 'default))
;; Disable left fringe (right one is sufficient)
(set-fringe-mode '(0 . nil))
;; No tool bar
(tool-bar-mode -1)
;; No menu bar (except for Cocoa)
(unless (eq window-system 'ns)
(menu-bar-mode -1))
;; No scroll bar
(scroll-bar-mode -1)
;; Mouse color
(set-mouse-color "#20B2AA")
;; Per-Device Customization
;; =====================================================================
(juni/load-local)
;; Post-init
;; =====================================================================
(custom-reevaluate-setting 'gc-cons-threshold)