forked from emacscollective/emacs.g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
257 lines (220 loc) · 7.99 KB
/
init.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
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
;;; init.el --- user-init-file -*- lexical-binding: t -*-
;;; Early birds
(progn ; startup
(defvar before-user-init-time (current-time)
"Value of `current-time' when Emacs begins loading `user-init-file'.")
(message "Loading Emacs...done (%.3fs)"
(float-time (time-subtract before-user-init-time
before-init-time)))
(setq user-init-file (or load-file-name buffer-file-name))
(setq user-emacs-directory (file-name-directory user-init-file))
(message "Loading %s..." user-init-file)
(setq package-enable-at-startup nil)
(setq inhibit-startup-buffer-menu t)
(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message "kevin")
(setq initial-buffer-choice t)
(setq initial-scratch-message "")
(setq load-prefer-newer t)
(scroll-bar-mode 0)
(tool-bar-mode 0)
(menu-bar-mode 0)
(add-to-list 'exec-path "/home/kevin/anaconda/bin"))
(progn ; `borg'
(add-to-list 'load-path (expand-file-name "lib/borg" user-emacs-directory))
(require 'borg)
(borg-initialize))
(progn ; `use-package'
(require 'use-package)
(setq use-package-verbose t))
(use-package auto-compile
:demand t
:config
(auto-compile-on-load-mode)
(auto-compile-on-save-mode)
(setq auto-compile-display-buffer nil)
(setq auto-compile-mode-line-counter t)
(setq auto-compile-source-recreate-deletes-dest t)
(setq auto-compile-toggle-deletes-nonlib-dest t)
(setq auto-compile-update-autoloads t)
(add-hook 'auto-compile-inhibit-compile-hook
'auto-compile-inhibit-compile-detached-git-head))
(use-package epkg
:defer t
:init (setq epkg-repository
(expand-file-name "var/epkgs/" user-emacs-directory)))
(use-package custom
:config
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file)))
(use-package server
:config (or (server-running-p) (server-mode)))
(progn ; startup
(message "Loading early birds...done (%.3fs)"
(float-time (time-subtract (current-time)
before-user-init-time))))
;;; Long tail
(use-package dash
:config (dash-enable-font-lock))
(use-package diff-hl
:config
(setq diff-hl-draw-borders nil)
(global-diff-hl-mode)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh t))
(use-package dired
:defer t
:config (setq dired-listing-switches "-alh"))
(use-package eldoc
:config (global-eldoc-mode))
(use-package help
:defer t
:config (temp-buffer-resize-mode))
(progn ; `isearch'
(setq isearch-allow-scroll t))
(use-package lisp-mode
:config
(add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'reveal-mode)
(defun indent-spaces-mode ()
(setq indent-tabs-mode nil))
(add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
(use-package man
:defer t
:config (setq Man-width 80))
(use-package paren
:config (show-paren-mode))
(use-package prog-mode
:config (global-prettify-symbols-mode)
(defun indicate-buffer-boundaries-left ()
(setq indicate-buffer-boundaries 'left))
(add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
(use-package recentf
:demand t
:config (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:"))
(use-package savehist
:config (savehist-mode))
(use-package saveplace
:config (save-place-mode))
(use-package simple
:config (column-number-mode))
(progn ; `text-mode'
(add-hook 'text-mode-hook #'indicate-buffer-boundaries-left))
(use-package company ; Graphical (auto-)completion
:init
(global-company-mode)
:config
(setq
company-tooltip-align-annotations t
company-tooltip-flip-when-above t
;; Easy navigation to candidates with M-<n>
company-show-numbers t
company-minimum-prefix-length 3
company-idle-delay 1)
:bind (:map company-active-map
;; Use C-n and C-p to navigate suggestions
("C-n" . company-select-next)
("C-p" . company-select-previous)))
(use-package elpy
:defer t
:init
(add-hook 'python-mode-hook #'elpy-mode)
(setq elpy-rpc-backend "jedi"))
(use-package ein
:config (setq ein:output-type-preference 'ein:output-type-prefer-pretty-text-over-html)
:commands (ein:notebooklist-open))
(use-package magit
:defer t
:bind (("C-x g" . magit-status)
("C-x M-g" . magit-dispatch-popup))
:config
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules-unpulled-from-upstream
'magit-insert-unpulled-from-upstream)
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules-unpulled-from-pushremote
'magit-insert-unpulled-from-upstream)
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules-unpushed-to-upstream
'magit-insert-unpulled-from-upstream)
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules-unpushed-to-pushremote
'magit-insert-unpulled-from-upstream)
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-submodules
'magit-insert-unpulled-from-upstream))
(use-package ivy ; Minibuffer completion
:defer t
:init (ivy-mode 1)
:bind (
("C-c b r" . ivy-resume)
("C-s" . swiper))
:config
;; Include recentf and bookmarks to switch buffer, and tune the count format.
(setq ivy-use-virtual-buffers t
ivy-count-format "(%d/%d) "
enable-recursive-minibuffers t
ivy-re-builders-alist
'((t . ivy--regex-fuzzy))) ;Uses flx-more matches, better sorting
:diminish ivy-mode)
(use-package which-key
:config (which-key-mode))
(use-package ace-window
:defer t
:config
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
:bind*
("M-p" . ace-window))
(use-package tramp
:defer t
:config
;; (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
(add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
(add-to-list 'tramp-default-proxies-alist
(list (regexp-quote (system-name)) nil nil)))
(use-package spacemacs-theme
:defer t
:init (load-theme 'spacemacs-dark t))
(add-to-list 'default-frame-alist
'(font . "Source Code Pro-10:weight=normal:width=normal"))
(use-package org
:defer t
:init
(add-hook 'org-mode-hook #'visual-line-mode) ;Wraps text based on word boundries
:config
(setq org-startup-indented t) ; Cleaner look
(setq org-log-done t)
(progn
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(shell . t)))))
(use-package org-bullets
:commands (org-bullets-mode)
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(progn ; startup
(message "Loading %s...done (%.3fs)" user-init-file
(float-time (time-subtract (current-time)
before-user-init-time)))
(add-hook 'after-init-hook
(lambda ()
(message
"Loading %s...done (%.3fs) [after-init]" user-init-file
(float-time (time-subtract (current-time)
before-user-init-time))))
t))
(progn ; personalize
(let ((file (expand-file-name (concat (user-real-login-name) ".el")
user-emacs-directory)))
(when (file-exists-p file)
(load file))))
(with-eval-after-load 'python
(defun python-shell-completion-native-try ()
"Return non-nil if can trigger native completion."
(let ((python-shell-completion-native-enable t)
(python-shell-completion-native-output-timeout
python-shell-completion-native-try-output-timeout))
(python-shell-completion-native-get-completions
(get-buffer-process (current-buffer))
nil "_"))))