-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs.debian
508 lines (444 loc) · 17.3 KB
/
.emacs.debian
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
;;; .emacs --- Emacs customizations
;;; Commentary:
;;
;; My Emacs customizations. Is there more to say?
;;
;; Packges:
;;
;; ac-emoji
;; ace-window
;; ample-theme
;; auto-complete
;; column-enforce-mode
;; emms
;; emms-player
;; emojify
;; fill-column-indicator
;; flycheck
;; flx-ido
;; helm
;; highlight-parentheses
;; image+
;; magit
;; markdown-mode
;; mic-paren
;; multiple-cursors
;; nlinum
;; org-plus
;; pdf-tools
;; projectile-mode
;; twittering-mode
;;; Code:
;; General Modifications
(setq inhibit-splash-screen t)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;;(global-linum-mode t)
(column-number-mode t)
(line-number-mode -1)
(set-frame-font "DejaVu Sans Mono")
(display-time-mode t)
;; (display-battery-mode t)
(fringe-mode 1) ; Shrink fringes to 1 pixel
;; (set-face-attribute 'default nil :height 120)
(global-hl-line-mode t)
(set-face-background 'hl-line "#3C3C3C") ; this wasn't working?
;; (ido-mode 1)
;; (setf ido-enable-flex-matching t) ;makes switches stuff easier
(setq-default tab-width 2)
(global-auto-revert-mode t)
(setq confirm-kill-emacs #'y-or-n-p) ;Asks if you wish to leave emacs
(setq org-src-fontify-natively t) ;syntax highlighting in org-modesource blocks
(setq browse-url-browser-function 'eww-browse-url)
(setq visible-bell 1)
(setq fill-column 80)
;; Work
;; You may need to get rid of the -default on the indent ones
(setq-default js-indent-level 2)
(setq-default js2-indent-level 2)
(setq-default js2-basic-offset 2)
(setq-default js2-strict-trailing-comma-warning nil) ;I don't care about commas
(setq-default typescript-indent-level 2)
(setq-default indent-tabs-mode nil)
(add-hook 'after-init-hook #'global-emojify-mode) ;gimme emojis EVERYWHERE! 🖕
(setq backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.backups")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;; MEPLA setup
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(add-to-list
'package-archives
'("org" . "http://orgmode.org/elpa/")
t)
(package-initialize))
;; For some reason I think this loads images faster
(setq imagemagick-enabled-types t)
;; EMMS setup
(add-to-list 'load-path "/home/kdb/.emacs.d/elpa/emms-*.*/")
(require 'emms-setup)
(emms-minimalistic) ;I like things minimal
;; (emms-default-players)
;; I want to use mpv!
(require 'emms-player-mpv)
(add-to-list 'emms-player-list 'emms-player-mpv)
;; Show me info in the mode-line
(require 'emms-mode-line)
;; (emms-mode-line 1)
;; Show me the playing time
(require 'emms-playing-time)
(emms-playing-time 1)
;; (setq emms-mode-line-format "") ;Don't show me the file name
(setq emms-playing-time-style (quote time)) ;make it show the time
;; Removes trailing whitespace before saving.
(add-hook 'before-save-hook (lambda ()
(delete-trailing-whitespace)))
;; Thou shall use 2 spaces indenting
;; (setq typescript-indent-level 2)
;; Enable a line at the 80 character column for certain modes
(setq fci-rule-column 80)
;; Enable some good modes when editing source files
(add-hook 'prog-mode-hook
(lambda ()
(nlinum-mode 1)
(auto-complete-mode 1)
(fci-mode 1)
(flycheck-mode 1)
(paren-activate)))
(add-hook 'html-mode-hook
(lambda ()
(nlinum-mode 1)
(auto-complete-mode 1)
(fci-mode 1)
(flycheck-mode 1)
(flyspell-mode -1)
(paren-activate)))
(add-hook 'image-mode-hook 'imagex-sticky-mode)
;; Lets not forget the text modes!
(add-hook 'text-mode-hook
(lambda ()
(column-enforce-mode 1)
(nlinum-mode 1)
(auto-fill-mode 1)
(flyspell-mode 1)))
(add-hook 'markdown-mode-hook
(lambda ()
(column-enforce-mode 1)
(auto-fill-mode 1)
(nlinum-mode 1)
(flyspell-mode 1)))
(defun org-table-copy-down-no-inc (&optional arg)
"Copy the previous cell's value without incrementing.
ARG is needed for `kill-word'."
(interactive "p")
(kill-word arg)
(yank)
(org-return)
(org-table-blank-field)
(yank)
(org-table-align))
(add-hook ' org-mode-hook
(lambda ()
(local-set-key (kbd "C-S-<down>") 'org-table-copy-down-no-inc)))
(add-hook 'latex-mode-hook
(lambda ()
(fci-mode 1)
(nlinum-mode 1)
(flycheck-mode 1)
(column-enforce-mode 1)
(auto-fill-mode 1)
(flyspell-mode 1)))
(add-hook 'erc-mode-hook
(lambda ()
(erc-notify-mode 1)
(flyspell-mode 1)))
;; Enable M-RET to add another comment line. This is mainly for typing long
;; explainations that take more than 1 line. For example, this comment...
;; Note: Since the other languages I use have things like /* */, they don't
;; need this feature.
(add-hook 'emacs-lisp-mode-hook
'(lambda () (local-set-key (kbd "M-RET") 'comment-indent-new-line)))
(add-hook 'common-lisp-mode-hook
'(lambda () (local-set-key (kbd "M-RET") 'comment-indent-new-line)))
(add-hook 'lisp-mode-hook
'(lambda () (local-set-key (kbd "M-RET") 'comment-indent-new-line)))
(add-hook 'sh-mode-hook
'(lambda () (local-set-key (kbd "M-RET") 'comment-indent-new-line)))
(add-hook 'R-mode-hook
'(lambda () (local-set-key (kbd "M-RET") 'comment-indent-new-line)))
;; Make backtab go backwards for links, like any normal person would want it
(add-hook 'eww-mode-hook
'(lambda ()
(local-set-key (kbd "<backtab>") 'shr-previous-link)
(local-set-key (kbd "&") 'eww-external-browser-seamonkey)))
;; Personal Keybindings
(global-set-key (kbd "C-x o") 'ace-window)
(global-set-key (kbd "M-C c") 'comment-region)
(global-set-key (kbd "M-C C") 'capitalize-word)
(global-set-key (kbd "M-C u") 'uncomment-region)
(global-set-key (kbd "C-x &") 'calendar)
(global-set-key (kbd "C-:") 'avy-goto-char)
(global-set-key (kbd "C-'") 'avy-goto-char-2)
(global-set-key (kbd "M-g f") 'avy-goto-line)
(global-set-key (kbd "M-g M-f") 'avy-goto-line)
(global-set-key (kbd "M-g w") 'avy-goto-word-1)
(global-set-key (kbd "M-g M-w") 'avy-goto-word-1)
(global-set-key (kbd "M-G G") 'magit-status)
;; (global-set-key (kbd "C-|") 'pop-global-mark) ;return to last cursor position
(global-set-key (kbd "C-x B") 'list-buffers)
(global-set-key (kbd "C-x C-b") 'ido-switch-buffer)
(global-set-key (kbd "C-x p f") 'projectile-find-file)
;; C-x M for Multicursor or Music (for emms controls)
;; Notice for the music controls, previous and next are upper case!
(global-set-key (kbd "C-x M d") 'mc/mark-all-dwim) ;d for dwim
(global-set-key (kbd "C-x M l") 'mc/mark-next-lines) ;l for lines
(global-set-key (kbd "C-x M a") 'mc/mark-all-like-this) ;a for all
(global-set-key (kbd "C-x M n") 'mc/mark-next-like-this) ;n for next
(global-set-key (kbd "C-x M p") 'emms-pause) ;p for pause
(global-set-key (kbd "C-x M P") 'emms-previous) ;P for previous
(global-set-key (kbd "C-x M N") 'emms-next) ;N for next
(global-set-key (kbd "C-x M s") 'emms-show) ;s for show
(global-set-key (kbd "C-x M f") 'emms-play-file) ;play (f)ile
(global-set-key (kbd "C-x M D") 'emms-play-directory) ;play (D)irectory
(global-set-key (kbd "C-x M v") 'emms-playlist-mode-go) ;(v)iew playlist
(global-set-key (kbd "C-x H a") 'helm-apropos)
;; For easy emoji finding
(global-set-key (kbd "C-x E a") 'emojify-apropos-emoji)
;; Comment line. Only useful on Emacs version < 25
(defun comment-line ()
"Comment or uncomment the current line. Your cursor doesn't move."
(interactive)
(comment-or-uncomment-region (point-at-bol) (point-at-eol)))
(global-set-key (kbd "C-x C-;") 'comment-line)
;; Undo trees are amazing.
(require 'undo-tree)
(global-undo-tree-mode)
(defun backward-delete-word-no-kill-ring (arg)
"Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-region (point) (progn (backward-word arg) (point))))
(defun forward-delete-word-no-kill-ring (arg)
"Delete characters forward until encountering the beginning of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))
(global-set-key (kbd "M-d") 'forward-delete-word-no-kill-ring)
(global-set-key (kbd "M-<backspace>") 'backward-delete-word-no-kill-ring)
(global-set-key (kbd "M-D") 'kill-word)
(global-set-key (kbd "M-S-<backspace>") 'backward-kill-word)
(defun vsplit-last-buffer ()
(interactive)
(split-window-vertically)
(other-window 1 nil)
(switch-to-next-buffer))
(defun hsplit-last-buffer ()
(interactive)
(split-window-horizontally)
(other-window 1 nil)
(switch-to-next-buffer))
(global-set-key (kbd "C-x 2") 'vsplit-last-buffer)
(global-set-key (kbd "C-x 3") 'hsplit-last-buffer)
(defun kill-and-delete-window ()
(interactive)
(kill-buffer)
(if (equal 1 (length (window-list)))
nil
(delete-window)))
(global-set-key (kbd "C-x K") 'kill-and-delete-window)
;; Allows me to see the battery level and status on my Chromebook
;; Maybe one day I'll add it to the mode line
(defun battery-level ()
(interactive)
(let (charge-now charge-full status)
(with-temp-buffer
(insert-file-contents "/sys/class/power_supply/sbs-20-000b/charge_now")
(goto-char (point-min))
(kill-line)
(setq charge-now (car kill-ring))
(insert-file-contents "/sys/class/power_supply/sbs-20-000b/charge_full")
(goto-char (point-min))
(kill-line)
(setq charge-full (car kill-ring))
(insert-file-contents "/sys/class/power_supply/sbs-20-000b/status")
(goto-char (point-min))
(kill-line)
(setq status (car kill-ring)))
(setq charge-now (concat charge-now ".0")) ;make it a float
(setq charge-full (concat charge-full ".0")) ;make it a float
(message "%s, %s"
(* 100 (/ (string-to-number charge-now)
(string-to-number charge-full)))
status)))
(global-set-key (kbd "M-<f1>") 'battery-level)
(require 'flx-ido)
(ido-mode 1)
(ido-everywhere 1)
(flx-ido-mode 1)
;; disable ido faces to see flx highlights.
(setq ido-enable-flex-matching t)
;; (setq ido-use-faces nil)
;;; Others
(setq ispell-program-name "/usr/bin/aspell")
;; (setq inferior-R-program-name "/usr/bin/R")
(setq erc-nick "nuclearkev")
;;; Set Your lisp system and, optionally, some contribs
(require 'slime-autoloads)
(setq inferior-lisp-program "/usr/bin/sbcl")
(require 'slime)
(slime-setup)
(setq slime-contribs '(slime-fancy))
;;(slime-setup '(slime-company))
;;(global-company-mode)
;; Twittering-mode
(setq twittering-use-master-password t) ;allows me to automatically login to my twitter account
(setq twittering-icon-mode t) ;gimme pictures
;; eshell
;; Run "alias sudo 'eshell/sudo $*'" sudo to work right
(require 'em-tramp)
(setq eshell-prefer-lisp-functions t)
(setq eshell-prefer-lisp-variables t)
(setq password-cache t) ; enable password caching
(setq password-cache-expiry 300) ; for 5 minutes (time in secs)
(setq tramp-histfile-override "/dev/null")
(defun browse-url-seamonkey-new-tab (url &optional new-window)
;; new-window ignored
"Open URL in a new tab in Seamonkey."
(interactive (browse-url-interactive-arg "URL: "))
(unless
(string= ""
(shell-command-to-string
(concat "seamonkey -remote 'openURL(" url ",new-tab)'")))
(message "Starting Seamonkey...")
(start-process (concat "seamonkey " url) nil "seamonkey" url)
(message "Starting Seamonkey...done")))
(defun eww-external-browser-seamonkey (&optional url)
"Open *eww* webpage in external browser. URL won't be used."
(interactive)
(eww-copy-page-url)
(browse-url-seamonkey-new-tab (car kill-ring)))
;; jul-mode stuff
;(add-to-list 'load-path "~/jul-mode")
;(load "jul-mode.el")
;; Enable pdf-tools all day
(pdf-tools-install)
(setq output-dir "~/Desktop/") ;make sure to have the '/' at the end
(defun youtube-dl-video (url)
"Easily download youtube videos in Emacs!
Pass it the URL of the video you wish to download. Then it will
place the full youtube-dl command in your kill ring. Yank this
to an eshell buffer or something."
(interactive "sURL: ")
(kill-append (concat "youtube-dl --output " output-dir
"\%\(title\)s.\%\(ext\)s ")
t))
(defun youtube-dl-ogg (url)
"Easily download youtube videos in Emacs!
Pass it the URL of the video you wish to convert to ogg and
download. Then it will place the full youtube-dl command in
your kill ring. Yank this to an eshell buffer or something."
(interactive "sURL: ")
(kill-append (concat "youtube-dl -x --audio-format vorbis "
"--output " output-dir
"\%\(title\)s.\%\(ext\)s ")
t))
(defun screen-shot (delay-time)
"Easily take a screenshot your screen.
DELAY-TIME will specify how long until the screenshot is taken."
(interactive "sDelay Time:")
(shell-command (concat "scrot -d " delay-time))
(shell-command (concat "mv *_scrot.png " output-dir)))
(defun screen-select ()
"Easily take a screenshot of a cursor selected area."
(interactive)
(shell-command (concat "scrot -s"))
(shell-command (concat "mv *_scrot.png " output-dir)))
(defun screen-record ()
"Easily record your screen!"
(interactive)
(async-shell-command (concat "avconv -f alsa -ac 1 -i hw:1 -f x11grab -r 25 "
"-s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 "
output-dir "screen-capture.mkv")))
;; Start projectile once everything is loaded
(projectile-mode)
;; IDK if this even works
(require 'flycheck)
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(javascript-jshint)))
(flycheck-add-mode 'javascript-eslint 'web-mode)
(flycheck-add-mode 'javascript-eslint 'typescript-mode)
;; Temp fixes to auto-complete and fci-mode issue
(defvar sanityinc/fci-mode-suppressed nil)
(defadvice popup-create (before suppress-fci-mode activate)
"Suspend fci-mode while popups are visible"
(set (make-local-variable 'sanityinc/fci-mode-suppressed) fci-mode)
(when fci-mode
(turn-off-fci-mode)))
(defadvice popup-delete (after restore-fci-mode activate)
"Restore fci-mode when all popups have closed"
(when (and (not popup-instances) sanityinc/fci-mode-suppressed)
(setq sanityinc/fci-mode-suppressed nil)
(turn-on-fci-mode)))
;; Haskell
(require 'haskell-interactive-mode)
(require 'haskell-process)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
;; (el-get-bundle slack)
;; (use-package slack
;; :commands (slack-start)
;; :init
;; (setq slack-buffer-emojify t) ;; if you want to enable emoji, default nil
;; (setq slack-prefer-current-team t)
;; :config
;; (slack-register-team
;; :name "sked"
;; :default t
;; :client-id "57522817143.163641867380"
;; :client-secret "b8a838e03ffabc43b4dad802e77bfaad"))
;; ;; :token "aaaa-sssssssssss-88888888888-hhhhhhhhhhh-jjjjjjjjjj"
;; ;; :subscribed-channels '(test-rename rrrrr)))
;; (use-package alert
;; :commands (alert)
;; :init
;; (setq alert-default-style 'notifier))
(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.
'(ansi-color-names-vector
["#454545" "#cd5542" "#6aaf50" "#baba36" "#5180b3" "#ab75c3" "#68a5e9" "#bdbdb3"])
'(battery-status-function (quote battery-linux-sysfs))
'(custom-enabled-themes (quote (ample)))
'(custom-safe-themes
(quote
("938d8c186c4cb9ec4a8d8bc159285e0d0f07bad46edf20aa469a89d0d2a586ea" "750153eac49be640ea0d01754b4178756129e8fc6cbfc75312b0f5a5c96e29bf" "990690b46d1d999ac9c92e0228fb362e5486a6c1e48325e19784ca75f0e5cc1d" "9e6e8b2377c0a176f702934794a1e7b8909a46147790b52e1be94ac7bb0bf333" "93b3b86e65d36de17a7a9d45c8797ea1a1134a1f997824daf439ac0ae2f60426" "4ab95b35f7720043592b49d890003874aa1954a3cf299edde13657c6a9182d85" "e1876e272a7e7a82a6196818a5f50551910dbdffcba557de5cdb71c7307b1144" "7557aa0d3854c7e910121ba2ef94f4c4e70de7d32ddebb609719f545f7f7be0d" "0c9cd73bf12f4bea0009c9fe520d362180c1fcf72d7590b484c0f20e20d109dc" "366f94b5c9428b25dbc2ed7f80cd96314b7124acab404e30d201ebe9aac0ff9d" default)))
'(eww-download-directory "~/Downloads")
'(fill-column 80)
'(org-agenda-files (quote ("~/org/Schedule.org")))
'(org-s5-theme-file nil)
'(package-selected-packages
(quote
(ac-emoji markdown-mode org-plus-contrib pdf-tools emojify emms-player-mpv emms image+ twittering-mode nlinum multiple-cursors mic-paren magit highlight-parentheses helm flycheck fill-column-indicator column-enforce-mode auto-complete ample-theme ace-window)))
'(send-mail-function (quote smtpmail-send-it))
'(smtpmail-smtp-server "stmp.openmailbox.org" t)
'(smtpmail-smtp-service 25 t))
(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.
'(hl-line ((t (:background "#343333"))))
'(region ((t (:background "#3C3C3C")))))
(provide '.emacs)
;;; .emacs ends here