summaryrefslogtreecommitdiff
path: root/emacs/init.el
blob: 4b47b962c624cd0d1d8e9982ecc733f34eff1a0b (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
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
;;; -*- LEXICAL-binding: t -*-

(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.
 '(comment-style 'extra-line)
 '(connection-local-criteria-alist
   '(((:application vc-git :protocol "ssh" :user "tmu" :machine
                    "cnoserver")
      autogenerated-connection-local-profile/\(:application\ vc-git\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\))
     ((:application vc-git) vc-git-connection-default-profile)
     ((:application tramp :protocol "kubernetes")
      tramp-kubernetes-connection-local-default-profile)
     ((:application tramp :protocol "flatpak")
      tramp-container-connection-local-default-flatpak-profile
      tramp-flatpak-connection-local-default-profile)
     ((:application tramp)
      tramp-connection-local-default-system-profile
      tramp-connection-local-default-shell-profile)
     ((:application eshell) eshell-connection-default-profile)))
 '(connection-local-profile-alist
   '((autogenerated-connection-local-profile/\(:application\ vc-git\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\)
      (vc-git--program-version . "2.48.1"))
     (vc-git-connection-default-profile (vc-git--program-version))
     (tramp-flatpak-connection-local-default-profile
      (tramp-remote-path "/app/bin" tramp-default-remote-path "/bin"
                         "/usr/bin" "/sbin" "/usr/sbin"
                         "/usr/local/bin" "/usr/local/sbin"
                         "/local/bin" "/local/freeware/bin"
                         "/local/gnu/bin" "/usr/freeware/bin"
                         "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin"
                         "/opt/sbin" "/opt/local/bin"))
     (tramp-kubernetes-connection-local-default-profile
      (tramp-config-check . tramp-kubernetes--current-context-data)
      (tramp-extra-expand-args 97
                               (tramp-kubernetes--container
                                (car tramp-current-connection))
                               104
                               (tramp-kubernetes--pod
                                (car tramp-current-connection))
                               120
                               (tramp-kubernetes--context-namespace
                                (car tramp-current-connection))))
     (tramp-container-connection-local-default-flatpak-profile
      (tramp-remote-path "/app/bin" tramp-default-remote-path "/bin"
                         "/usr/bin" "/sbin" "/usr/sbin"
                         "/usr/local/bin" "/usr/local/sbin"
                         "/local/bin" "/local/freeware/bin"
                         "/local/gnu/bin" "/usr/freeware/bin"
                         "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin"
                         "/opt/sbin" "/opt/local/bin"))
     (tramp-connection-local-darwin-ps-profile
      (tramp-process-attributes-ps-args "-acxww" "-o"
                                        "pid,uid,user,gid,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                        "-o" "state=abcde" "-o"
                                        "ppid,pgid,sess,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etime,pcpu,pmem,args")
      (tramp-process-attributes-ps-format (pid . number)
                                          (euid . number)
                                          (user . string)
                                          (egid . number) (comm . 52)
                                          (state . 5) (ppid . number)
                                          (pgrp . number)
                                          (sess . number)
                                          (ttname . string)
                                          (tpgid . number)
                                          (minflt . number)
                                          (majflt . number)
                                          (time . tramp-ps-time)
                                          (pri . number)
                                          (nice . number)
                                          (vsize . number)
                                          (rss . number)
                                          (etime . tramp-ps-time)
                                          (pcpu . number)
                                          (pmem . number) (args)))
     (tramp-connection-local-busybox-ps-profile
      (tramp-process-attributes-ps-args "-o"
                                        "pid,user,group,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                        "-o" "stat=abcde" "-o"
                                        "ppid,pgid,tty,time,nice,etime,args")
      (tramp-process-attributes-ps-format (pid . number)
                                          (user . string)
                                          (group . string) (comm . 52)
                                          (state . 5) (ppid . number)
                                          (pgrp . number)
                                          (ttname . string)
                                          (time . tramp-ps-time)
                                          (nice . number)
                                          (etime . tramp-ps-time)
                                          (args)))
     (tramp-connection-local-bsd-ps-profile
      (tramp-process-attributes-ps-args "-acxww" "-o"
                                        "pid,euid,user,egid,egroup,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                        "-o"
                                        "state,ppid,pgid,sid,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etimes,pcpu,pmem,args")
      (tramp-process-attributes-ps-format (pid . number)
                                          (euid . number)
                                          (user . string)
                                          (egid . number)
                                          (group . string) (comm . 52)
                                          (state . string)
                                          (ppid . number)
                                          (pgrp . number)
                                          (sess . number)
                                          (ttname . string)
                                          (tpgid . number)
                                          (minflt . number)
                                          (majflt . number)
                                          (time . tramp-ps-time)
                                          (pri . number)
                                          (nice . number)
                                          (vsize . number)
                                          (rss . number)
                                          (etime . number)
                                          (pcpu . number)
                                          (pmem . number) (args)))
     (tramp-connection-local-default-shell-profile
      (shell-file-name . "/bin/sh") (shell-command-switch . "-c"))
     (tramp-connection-local-default-system-profile
      (path-separator . ":") (null-device . "/dev/null"))
     (eshell-connection-default-profile (eshell-path-env-list))))
 '(custom-safe-themes
   '("6f5e3fd2b4245ffe660da69ea5c13ab392337e94776dfb23cc1d8d0f80e3baa2"
     "1b8c2fd98bf6777d8b95f8cf98fdaede88feee3419ec3e5008f94b56618ac6ca"
     "0cc5046b7981609166c28b64f6185fa5f73bcb00d21e037f304794c6aaa1f340"
     "9f2e4e8b2ddbfdd392eedbc123649d94654278dee5a53b899557224416413d35"
     "6dafb31ade9ff07229faaf05c41c2ae475c44731362b792f65f3930b1a2c9cfd"
     "dc77e008092a5a4aa6b6ed8e4826bebf8f2fb930a8de073bf7f458efd884cca8"
     "d1ff3e66028f9c527298580d2a64f9e3280f07f9e94d4dada72b67ef15069441"
     "3d4e3644e237a95683daa73e397c4c0d1ae06bbaaf8040104232591a28bc1315"
     "12a07bc38295e4b06a8965db261f51ea7ea61fbf91b3ef41298bbb549d1d9403"
     default))
 '(ede-project-directories
   '("/home/tmu/Desktop/eway/sway" "/home/tmu/Desktop/eway/cage"
     "/home/tmu/Desktop/eway/wlroots" "/home/tmu/Desktop/eway/comp"
     "/home/tmu/Desktop/eway"))
 '(eglot-events-buffer-config '(:size 0 :format full))
 '(gdb-non-stop-setting nil)
 '(helm-minibuffer-history-key "M-p")
 '(menu-bar-mode nil)
 '(package-selected-packages
   '(2048-game all-the-icons-completion amsreftex auctex avy-flycheck
               balanced-windows benchmark-init bongo buffer-move cape
               chinese-conv cmake-mode company-go corfu corfu-terminal
               counsel-projectile cuda-mode dockerfile-mode
               doom-modeline dumb-jump eat edit-indirect eglot
               embark-consult ement emms-player-simple-mpv emms-state
               esh-help eshell-fringe-status eshell-vterm esup
               evil-collection evil-easymotion evil-snipe
               evil-surround exwm-firefox-evil exwm-modeline eyebrowse
               fish-mode flycheck flycheck-aspell flymake-aspell
               flymake-diagnostic-at-point fold-this folding free-keys
               frog-jump-buffer gdscript-mode gxref haskell-mode
               helm-exwm helm-hoogle highlight hindent hl-todo
               ibuffer-project ibuffer-projectile imenu-anywhere
               ivy-hydra ivy-prescient lsp-haskell magit marginalia
               markdown-preview-mode minions nginx-mode oauth2
               orderless pass password-store
               persp-mode-projectile-bridge popwin pyim-basedict
               pyim-cangjiedict pyvenv racket-mode rainbow-delimiters
               rustic sdcv sideline-flycheck sideline-flymake
               sideline-lsp simple-httpd spell-fu telephone-line
               tempel tree-sitter-langs treemacs treemacs-evil
               vertico-prescient vimgolf visible-mark volume which-key
               winum workgroups yaml-mode))
 '(pyim-assistant-scheme 'cangjie)
 '(safe-local-variable-values '((LEXICAL-binding . t)))
 '(scroll-bar-mode nil)
 '(tags-revert-without-query t)
 '(tool-bar-mode nil)
 '(transient-mark-mode nil)
 '(whitespace-style
   '(face trailing tabs lines-tail missing-newline-at-eof indentation
          space-after-tab space-before-tab tab-mark) t))

;; ---------------------------------------------------------------------
;; non-package specific config

;; performance stuff
(setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook
          (lambda ()
            (setq gc-cons-threshold (expt 2 23))))

;; allow using emacsclient
(require 'server)
(unless (server-running-p) (server-start))

;; buffer preferences
(with-current-buffer "*scratch*" (emacs-lock-mode 'kill))
(setq kill-buffer-query-functions
      (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
;; don't ask about killing buffers
(setq confirm-kill-processes nil)
;; don't ask about kill processes


(setq async-shell-command-buffer 'new-buffer)
;; start additional async shell commands in new buffers without asking
(setq-default proced-auto-update-flag t)
(setq-default proced-auto-update-interval 1)
;; always auto update proced

;; this is to avoid loading evil entirely, and ease some of the
;; internconnection complexity of the config
(setq want-evil nil)

;; --------------------------------------------------------------------
;; external packages

(use-package benchmark-init
  :config
  ;; To disable collection of benchmark data after init is done.
  (add-hook 'after-init-hook 'benchmark-init/deactivate))

;; enable external packages
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(push "~/.emacs.d/site-lisp/" load-path)
(package-initialize)
(require 'use-package-ensure)
(setq use-package-always-ensure t)
;; (setq use-package-always-demand t)

(use-package vertico
  ;; better minibuffer complete
  :init
  (vertico-mode)
  ;; (vertico-flat-mode)
  (setq vertico-cycle t))

(use-package marginalia
  :init
  (marginalia-mode)
  (keymap-set minibuffer-local-map "M-A" 'marginalia-cycle)
  :custom
  (marginalia-max-relative-age 0)
  (marginalia-align 'right))

(use-package embark
  :bind
  (("C-." . embark-act)         ;; pick some comfortable binding
   ("C-," . embark-dwim)        ;; good alternative: M-.
   ("C-h B" . embark-bindings)  ;; alternative for `describe-bindings'
   )
  :init
  ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
  :config
  ;; Hide the mode line of the Embark live/completions buffers
  (add-to-list 'display-buffer-alist
               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                 nil
                 (window-parameters (mode-line-format . none)))))

(use-package orderless
  ;; ordering (minibuffer) completions
  :custom
  (completion-styles '(orderless basic))
  (orderless-matching-styles '(orderless-prefixes orderless-initialism orderless-literal orderless-regexp))
  ;; (orderless-skip-highlighting t)
  )

(use-package corfu
  ;; in buffer completion
  :init
  (global-corfu-mode 1)
  (defun corfu-commit-single ()
    "Complete without asking if there is only one candidate."
    (when (and (corfu--popup-visible-p)
               (= (length corfu--candidates) 1))
      (corfu-accept)))
  (add-hook 'corfu-post-command-hook 'corfu-commit-single)
  :custom
  (corfu-cycle t)
  (corfu-quit-no-match t)
  :bind (("M-/" . completion-at-point)))

(use-package corfu-terminal
  :init
  (corfu-terminal-mode 1)
  :custom
  (corfu-terminal-disable-on-gui nil))

(use-package cape
  ;; extend completion frameworks
  :bind ("C-c p" . cape-prefix-map)
  :config
  (advice-add 'pcomplete-completions-at-point :around 'cape-wrap-silent)
  (advice-add 'pcomplete-completions-at-point :around 'cape-wrap-purify)
  :init
  (setq completion-at-point-functions '(tags-completion-at-point-function
                                        cape-keyword
                                        cape-dabbrev
                                        cape-symbol
                                        cape-dict)))

(use-package dabbrev
  :bind (("C-M-/" . dabbrev-expand))
  :config
  (add-to-list 'dabbrev-ignored-buffer-regexps "\\` ")
  ;; Since 29.1, use `dabbrev-ignored-buffer-regexps' on older.
  (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode)
  (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)
  (add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode))

(use-package tempel
  :after (cape)
  :custom
  (tempel-path "~/.emacs.d/templates/*.eld")
  ;; (tempel-trigger-prefix "<")

  :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
         ("M-*" . tempel-insert))

  :config
  ;; Setup completion at point
  (defun tempel-setup-capf ()
    ;; Add the Tempel Capf to `completion-at-point-functions'.
    ;; `tempel-expand' only triggers on exact matches. Alternatively use
    ;; `tempel-complete' if you want to see all matches, but then you
    ;; should also configure `tempel-trigger-prefix', such that Tempel
    ;; does not trigger too often when you don't expect it. NOTE: We add
    ;; `tempel-expand' *before* the main programming mode Capf, such
    ;; that it will be tried first.
    (setq-local completion-at-point-functions
                (cons #'tempel-expand
                      completion-at-point-functions)))

  (add-hook 'conf-mode-hook 'tempel-setup-capf)
  (add-hook 'prog-mode-hook 'tempel-setup-capf)
  (add-hook 'text-mode-hook 'tempel-setup-capf)

  ;; Optionally make the Tempel templates available to Abbrev,
  ;; either locally or globally. `expand-abbrev' is bound to C-x '.
  ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
  ;; (global-tempel-abbrev-mode)
  )

;; (use-package tempel-collection
;;   :after tempel)

(use-package magit)

(use-package which-key
  :init
  (which-key-mode))

(use-package ibuffer
  :custom
  (ibuffer-formats
   '((mark modified read-only " "
           (name 50 50 :left :elide) ; was originally 18
           " "
           (size 9 -1 :right)
           " "
           (mode 16 16 :left :elide)
           " " filename-and-process)
     (mark " "
           (name 16 -1)
           " " filename)))
  :bind
  ("C-x C-b" . ibuffer)
  :hook
  (ibuffer . (lambda ()
               (unless (eq ibuffer-sorting-mode 'alphabetic)
                 (ibuffer-do-sort-by-alphabetic)))))

(use-package buffer-move
  :bind ("C-x -" . buf-move-right))

(use-package winum
  :init
  (winum-mode 1))

(use-package consult
  :custom (consult-preview-excluded-buffers t)
  :bind (("C-x b" . consult-buffer)))

;; (use-package beacon
;;   :init
;;   (beacon-mode 1)
;;   (push 'vterm-mode beacon-dont-blink-major-modes))

(use-package visible-mark
  :init
  (global-visible-mark-mode 1)
  (set-face-attribute 'visible-mark-active nil
                      :foreground 'unspecified
                      :background 'unspecified
                      :box '(:line-width (-1 . -1)
                                         :color "deep pink"
                                         :style nil))
  :custom
  (visible-mark-max 1)
  )

(use-package avy
  :bind (("C-'" . avy-goto-char-2)))

(use-package balanced-windows
  :bind ("C-x w b" . balanced-windows-mode))

;; eshell stuff
(use-package eshell
  :init
  (use-package esh-help)
  (setup-esh-help-eldoc)
  (require 'em-hist)
  (require 'em-term)
  (keymap-set eshell-hist-mode-map "C-p" 'eshell-previous-input)
  (keymap-set eshell-hist-mode-map "C-n" 'eshell-next-input)
  (keymap-set eshell-hist-mode-map "C-c C-n" 'next-line)
  (keymap-set eshell-hist-mode-map "C-c C-p" 'previous-line)
  (keymap-set eshell-mode-map "C-l" 'eshell/clear)
  (add-hook 'eshell-mode-hook 'eldoc-mode)
  (if want-evil
      (add-hook 'eshell-mode-hook (lambda () (evil-local-mode -1)))))

(use-package eat
  :init
  (eat-eshell-mode)
  (eat-eshell-visual-command-mode))

(use-package hl-todo)

;; file browser
(use-package treemacs
  :bind (("C-c t" . treemacs)))

;; password integration
(use-package password-store)
(use-package auth-source-pass
  :init (auth-source-pass-enable))
(use-package pass
  :custom
  (pass-supress-confirmations t))
(setq epg-pinentry-mode 'loopback)

;; make tramp not prompt for autosaving root owned files
(setq tramp-allow-unsafe-temporary-files t)

;; ----------------------------------------------------------------------
;; my custom stuff

(if want-evil (require 'evil-config))
(require 'my-funcs)
(require 'my-binds)
(require 'coding-config)
(require 'modeline-config)
(require 'general-text)
(require 'single-header)
(require 'exwm-pref)
(require 'irc-config)

;; ----------------------------------------------------------------------
;; theme stuff

(require 'tmu-custom-theme)
(push "~/.emacs.d/site-lisp/" custom-theme-load-path)
(load-theme 'tmu-custom t)

;; comfy scratch buffer
(require 'iimage)
(setq inhibit-startup-screen t)
(setq initial-scratch-message (concat (propertize ";; " 'invisible t)
                                      "</home/tmu/.emacs.d/splashLaputa.png>
;; scratch for lisp evaluation and unsaved text

"))
(add-hook 'emacs-startup-hook (lambda ()
                                (with-current-buffer "*scratch*"
                                  (iimage-mode 1))))

;; ----------------------------------------------------------------------
;; Things emacs sets programatically
(put 'dired-find-alternate-file 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'list-timers 'disabled nil)
(put 'narrow-to-region 'disabled nil)

(load-theme 'tmu-custom 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.
 )