-
Notifications
You must be signed in to change notification settings - Fork 17
/
init.el
204 lines (171 loc) · 5.66 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
;;; init.el --- -*- lexical-binding: t; -*-
;;; Commentary:
;; Use this at the top of your .emacs file for local overrides:
;; (let ((init "~/.emacs.d/init.elc"))
;; (if (file-exists-p init)
;; (load-file init)
;; (load-file (substring init 0 -1))))
;;; Code:
(make-directory (locate-user-emacs-file "local") :no-error)
(add-to-list 'load-path "~/.emacs.d/lisp")
(add-to-list 'load-path
(format "~/.emacs.d/site-lisp/%s" emacs-version))
(add-to-list 'load-path
(format "~/.emacs.d/site-lisp/%s/lisp" emacs-version))
(add-to-list 'load-path
(format "~/.emacs.d/site-lisp/%s/etc" emacs-version))
;; Package bootstrap
(load-file "~/.emacs.d/packages.el")
(require 'autoloads)
(setf package-enable-at-startup nil)
(require 'use-package)
;; "Local" packages
(require 'unannoy)
(require 'extras)
;; Some global keybindings
(global-set-key (kbd "C-x k") #'kill-this-buffer)
;;; auto-mode-alist entries
(add-to-list 'auto-mode-alist '("\\.mom$" . nroff-mode))
(add-to-list 'auto-mode-alist '("[._]bash.*" . shell-script-mode))
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
(add-to-list 'auto-mode-alist '("[Mm]akefile" . makefile-gmake-mode))
(add-to-list 'auto-mode-alist '("\\.mak$" . makefile-gmake-mode))
(add-to-list 'auto-mode-alist '("\\.make$" . makefile-gmake-mode))
;; Frames and fonts
(defvar my-preferred-fonts
'("Noto Mono-10"
"Inconsolata-12"))
(defun my-set-preferred-font (&optional frame)
"Set the first available font from `my-preferred-fonts'."
(catch 'done
(with-selected-frame (or frame (selected-frame))
(dolist (font my-preferred-fonts)
(when (ignore-errors (x-list-fonts font))
(set-frame-font font)
(throw 'done nil))))))
(defun my-set-frame-fullscreen (&optional frame)
(set-frame-parameter frame 'fullscreen 'fullheight))
(add-hook 'after-make-frame-functions #'my-set-preferred-font)
(add-hook 'after-make-frame-functions #'my-set-frame-fullscreen t)
;;; Individual package configurations
(use-package dabbrev
:defer t
:init (setf abbrev-file-name (locate-user-emacs-file "local/abbrev_defs"))
:config (setf dabbrev-case-fold-search nil))
(use-package dired
:defer t
:config
(progn
(add-hook 'dired-mode-hook #'toggle-truncate-lines)
(setf dired-listing-switches "-alhG"
dired-guess-shell-alist-user
'(("\\.pdf\\'" "evince")
("\\(\\.ods\\|\\.xlsx?\\|\\.docx?\\|\\.csv\\)\\'" "libreoffice")
("\\(\\.png\\|\\.jpe?g\\)\\'" "qiv")
("\\.gif\\'" "animate")))))
(use-package elfeed
:defer t
:bind ("C-x w" . elfeed)
:init (setf url-queue-timeout 30)
:config
(require 'feed-setup)
(push "-k" elfeed-curl-extra-arguments)
(setf bookmark-default-file (locate-user-emacs-file "local/bookmarks")))
(use-package youtube-dl
:defer t
:bind ("C-x y" . youtube-dl-list))
(use-package lisp-mode
:defer t
:config
(progn
(defun ert-all ()
(interactive)
(ert t))
(defun ielm-repl ()
(interactive)
(pop-to-buffer (get-buffer-create "*ielm*"))
(ielm))
(define-key emacs-lisp-mode-map (kbd "C-c C-z") #'ielm-repl)
(defalias 'lisp-interaction-mode 'emacs-lisp-mode)))
(use-package evil
:init
(setf evil-want-C-u-scroll t)
:config
(evil-mode)
(defvar my-leader-map
(let ((map (make-sparse-keymap)))
(prog1 map
(define-key map "w" 'elfeed))))
(define-key evil-normal-state-map "\\" my-leader-map)
(add-to-list 'evil-emacs-state-modes 'elfeed-search-mode)
(add-to-list 'evil-emacs-state-modes 'elfeed-show-mode)
(add-to-list 'evil-emacs-state-modes 'special-mode)
(add-to-list 'evil-emacs-state-modes 'youtube-dl-list-mode)
(add-to-list 'evil-emacs-state-modes 'process-menu-mode)
(evil-select-search-module 'evil-search-module 'evil-search)
(setf evil-ex-search-highlight-all nil)
(add-hook 'with-editor-mode-hook 'evil-insert-state)
(add-hook 'emacs-lisp-mode-hook (lambda () (modify-syntax-entry ?- "w")))
(add-hook 'c-mode-common-hook (lambda () (modify-syntax-entry ?_ "w"))))
(use-package time
:config
(progn
(setf display-time-default-load-average nil
display-time-use-mail-icon t
display-time-24hr-format t)
(display-time-mode t)))
(use-package modus-vivendi-theme
:ensure t
:config
(load-theme 'modus-vivendi t)
(global-hl-line-mode 1))
(use-package simple
:defer t
:config
(progn
;; disable so I don't use it by accident
(define-key visual-line-mode-map (kbd "M-q") (expose (lambda ())))
(add-hook 'tabulated-list-mode-hook #'hl-line-mode)))
(use-package uniquify
:defer t
:config
(setf uniquify-buffer-name-style 'post-forward-angle-brackets))
(use-package winner
:config
(winner-mode 1)
(windmove-default-keybindings))
(use-package calc
:defer t
:config (setf calc-display-trail nil))
(use-package paren
:config (show-paren-mode))
(use-package icomplete
:init
(icomplete-mode)
:bind (:map icomplete-minibuffer-map
("<C-tab>" . minibuffer-force-complete)))
(use-package browse-url
:defer t
:init
(setf url-cache-directory (locate-user-emacs-file "local/url"))
:config
(when (executable-find "firefox")
(setf browse-url-browser-function #'browse-url-firefox)))
(use-package uuid-simple
:demand t
:bind ("C-x !" . uuid-insert)
:config (random (make-uuid)))
(use-package jekyll
:demand t
:functions httpd-send-header
:config
(progn
(setf jekyll-home "~/src/skeeto.github.com/")
(when (file-exists-p jekyll-home)
(ignore-errors
(jekyll/start)))))
(use-package help-mode
:defer t
:config
(define-key help-mode-map (kbd "f") #'push-first-button))
(provide 'init) ; make (require 'init) happy