summary refs log tree commit diff stats
path: root/init.el
blob: e2f8c4231672d41941d62259cd945e977d114cd3 (plain)
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
;; init.el ~ acdw -*- lexical-binding: t -*-

(server-start)

(setq confirm-kill-processes nil)

(setq user-full-name "Case Duckworth")
(setq user-mail-address "acdw@acdw.net")
(setq calendar-location-name "Baton Rouge, LA")
(setq calendar-latitude 30.39)
(setq calendar-longitude -91.83)

(setq show-paren-style 'mixed)
(show-paren-mode 1)

(setq backup-directory-alist
      `((".*" . ,(concat user-emacs-directory "saves/"))))
(setq delete-old-versions t)
(setq kept-new-versions 6)
(setq kept-old-versions 4)
(setq version-control t)

(setq auto-save-file-name-transforms
      `((".*" ,(concat user-emacs-directory "saves/") t)))
(auto-save-mode 1)

(defun full-auto-save ()
  (interactive)
  (save-excursion
    (dolist (buf (buffer-list))
      (set-buffer buf)
      (if (and (buffer-file-name) (buffer-modified-p))
	  (basic-save-buffer)))))
(add-hook 'auto-save-hook 'full-auto-save)
(add-hook 'focus-out-hook 'full-auto-save) ;; this might be resource intensive?

(setq save-place-file (expand-file-name "places" user-emacs-directory))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))

(blink-cursor-mode 0)

(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(fset 'yes-or-no-p 'y-or-n-p)
(global-prettify-symbols-mode t)

(save-place-mode 1)

(global-visual-line-mode 1)

(display-time-mode 1)

(add-hook 'before-save-hook #'delete-trailing-whitespace)
(add-hook 'prog-mode-hook (lambda ()
			    (if (and (fboundp 'display-line-numbers-mode)
				     (display-graphic-p))
				#'display-line-numbers-mode
			      #'linum-mode)))

(set-face-attribute 'default nil :font "GoMono Nerd Font-11")

;;; packages

;; exwm
(use-package exwm
  :demand
  :custom
  (exwm-layout-show-all-buffers t)
  (mouse-autoselect-window t)
  (exwm-workspace-number 4)
  (exwm-input-global-keys
	`(
	  ([?\s-r] . exwm-reset)
	  ([?\s-w] . exwm-workspace-switch)
	  ([?\s-&] . (lambda (command)
		       (interactive (list (read-shell-command "$ ")))
		       (start-process-shell-command command nil command)))
	  ,@(mapcar (lambda (i)
		      `(,(kbd (format "s-%d" i)) .
			(lambda ()
			  (interactive)
			  (exwm-workspace-switch-create ,i))))
		    (number-sequence 0 9))))
  (exwm-input-simulation-keys
   '(([?\C-b] . [left])
     ([?\M-b] . [C-left])
     ([?\C-f] . [right])
     ([?\M-f] . [C-right])
     ([?\C-p] . [up])
     ([?\C-n] . [down])
     ([?\C-a] . [home])
     ([?\C-e] . [end])
     ([?\M-v] . [prior])
     ([?\C-v] . [next])
     ([?\C-d] . [delete])
     ([?\C-k] . [S-end delete])
     ([?\C-s] . [?\C-f])
     ([?\C-w] . [?\C-x])
     ([?\M-w] . [?\C-c])
     ([?\C-y] . [?\C-v])))
  :hook
  ((exwm-update-class .
		      (lambda () "Rename buffer to window's class name"
			(exwm-workspace-rename-buffer exwm-class-name)))
   (exwm-update-title .
		      (lambda () "Update workspace name to window title"
			(when (not exwm-instance-name)
			  (exwm-workspace-rename-buffer exwm-title))))
   (exwm-init .
	      (lambda () "Autostart"
		(start-process-shell-command "cmst" nil "cmst -m -w 5")
		(start-process-shell-command "keepassxc" nil "keepassxc")
		(start-process-shell-command
		 "pa-applet" nil
		 "pa-applet --disable-key-grabbing --disable-notifications")
		(start-process-shell-command "cbatticon" nil "cbatticon"))))
  :config
  (require 'exwm)
  (exwm-enable)
  (require 'exwm-systemtray)
  (exwm-systemtray-enable))

(use-package exwm-firefox-core
  :after exwm
  :straight (exwm-firefox-core
	     :type git
	     :host github
	     :repo "walseb/exwm-firefox-core"))

(use-package exwm-firefox
  :after exwm-firefox-core
  :straight (exwm-firefox
	     :type git
	     :host github
	     :repo "ieure/exwm-firefox")
  :config
  (exwm-firefox-mode))

;; (use-package mini-modeline
;;   :quelpa (mini-modeline
;; 	   :repo "kiennq/emacs-mini-modeline"
;; 	   :fetcher github)
;;   :custom
;;   (mini-modeline-enhance-viusual t)
;;   (mini-modeline-display-gui-line t)
;;   (mini-modeline-right-padding 7) ;; characters -- for systemtray
;;   (mini-modeline-face-attr nil)
;;   :config
;;   (mini-modeline-mode t))

(use-package desktop-environment
  :hook (exwm-init . desktop-environment-mode)
  :custom
  (desktop-environment-update-exwm-global-keys :global)
  (desktop-environment-brightness-get-command "light")
  (desktop-environment-brightness-set-command "light %s")
  (desktop-environment-brightness-get-regexp "^\\([0-9]+\\)")
  (desktop-environment-brightness-normal-increment "-A 10")
  (desktop-environment-brightness-normal-decrement "-U 10")
  (desktop-environment-brightness-small-increment "-A 5")
  (desktop-environment-brightness-small-decrement "-U 5")
  (desktop-environment-volume-get-command "pavolume get")
  (desktop-environment-volume-set-command "pavolume %s")
  (desktop-environment-volume-toggle-command "pavolume mute toggle")
  (desktop-environment-volume-get-regexp "^\\([0-9]+\\)")
  (desktop-environment-volume-normal-increment "inc 10")
  (desktop-environment-volume-normal-decrement "dec 10")
  (desktop-environment-volume-small-increment "inc 5")
  (desktop-environment-volume-small-decrement "dec 5"))

(use-package trashed
  :custom
  (delete-by-moving-to-trash t))

(use-package switch-window
  :custom
  (switch-window-shortcut-style 'qwerty)
  :bind
  ("M-o" . switch-window))

;; modeline
(use-package doom-modeline
   :custom
   (doom-modeline-height 16)
   (doom-modeline-icon nil)
   (doom-modeline-enable-word-count t)
   (doom-modeline-mu4e t)
   (doom-modeline-gnus nil)
   (doom-modeline-irc t)
   :custom-face
   (doom-modeline-vspc-face ((t (:inherit nil))))
   :config
   (doom-modeline-mode t))

(use-package zoom
  :custom
  (zoom-size '(0.618 . 0.618)))

;; themes
(defun my/sunrise ()
  (enable-theme 'modus-operandi)
  (start-process-shell-command "light" nil "light -S 60"))

(use-package modus-operandi-theme
  :if window-system
  :custom
  (modus-operandi-theme-slanted-constructs t)
  (modus-operandi-theme-bold-constructs t)
  (modus-operandi-theme-3d-modeline t)
  :config
  (load-theme 'modus-operandi t t)
  (run-at-time (nth 1 (split-string (sunrise-sunset)))
	       (* 60 60 24) #'my/sunrise))

(defun my/sunset ()
  (enable-theme 'modus-vivendi)
  (start-process-shell-command "light" nil "light -S 35"))

(use-package modus-vivendi-theme
  :if window-system
  :custom
  (modus-vivendi-theme-slanted-constructs t)
  (modus-vivendi-theme-bold-constructs t)
  (modus-vivendi-theme-3d-modeline t)
  :config
  (load-theme 'modus-vivendi t t)
  (run-at-time (nth 4 (split-string (sunrise-sunset)))
	       (* 60 60 24) #'my/sunset)
  (run-at-time "12am" (* 60 60 24) #'my/sunset))

;; sudo
(use-package su
  :config
  (su-mode 1))

;; minibuffer completion
(use-package ivy
  :custom
  (ivy-use-virtual-buffers t)
  (ivy-wrap t)
  (ivy-count-format "(%d/%d) ")
  (enable-recursive-minibuffers t)
  :config
  (ivy-mode 1))

(use-package swiper
  :bind ("C-s" . swiper-isearch))

(use-package counsel
  :config
  (counsel-mode 1))

(use-package ivy-rich
  :after (ivy)
  :config
  (ivy-rich-mode 1)
  (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line))

(use-package savehist
  :config
  (savehist-mode 1))

(use-package magit
  :bind
  ("M-g" . magit))

;; mu4e
(use-package mu4e
  :straight (mu4e
	      :host github
	      :repo "emacsmirror/mu4e"
	      :files (:defaults "mu4e/*.el"))
  :init
  (require 'smtpmail-async)
  :custom
  (mu4e-headers-skip-duplicates t)
  (mu4e-view-show-images t)
  (mu4e-view-show-addresses t)
  (mu4e-compose-format-flowed t)
  (mu4e-date-format "%Y-%m-%d")
  (mu4e-headers-date-format "%Y-%m-%d")
  (mu4e-change-filenames-when-moving t)
  (mu4e-attachments-dir "~/Downloads")
  (message-kill-buffer-on-exit t)
  (mu4e-update-interval (* 60 60))
  (mu4e-maildir "~/Mail/fastmail")
  (mu4e-refile-folder "/Archive")
  (mu4e-sent-folder "/Sent")
  (mu4e-drafts-folder "/Drafts")
  (mu4e-trash-folder "/Trash")
  (message-send-mail-function 'async-smtpmail-send-it)
  (smtpmail-default-smtp-server "smtp.fastmail.com")
  (smtpmail-smtp-server "smtp.fastmail.com")
  (smtpmail-smtp-service 465)
  (smtpmail-stream-type 'ssl)
  :config
  (fset 'my-move-to-trash "mTrash")
  (define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash)
  (define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash))

;; try packages out
;(use-package try)

;; vterm babeee
;(use-package vterm)

(use-package which-key
  :custom
  (which-key-mode 1))

(use-package company
  :custom
  (company-idle-delay 0.1)
  :hook
  (prog-mode . company-mode))

;;; gemini/gopher
(use-package elpher
  :straight
  (elpher
   :repo "git://thelambdalab.xyz/elpher.git"))

(use-package gemini-mode
  :straight
  (gemini-mode
   :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))

(use-package gemini-write
  :straight
  (gemini-write
   :repo "https://alexschroeder.ch/cgit/gemini-write"))