-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
463 lines (368 loc) · 12.6 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
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
;;; init.el --- Sirex Configuration for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2024 Yauhen Artsiukhou
;; Author: Yauhen Artsiukhou <jsirex@gmail.com>
;; Keywords: lisp
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(eval-and-compile
(require 'cl-lib)
(require 'package)
(require 'use-package)
;; like add-to-list it is quite improper to setq a custom variable
;; setopt should be used for custom variables, but nobody cares
(cl-pushnew '("melpa" . "https://melpa.org/packages/") package-archives :test #'equal)
(setopt package-native-compile t
package-quickstart t
package-archive-priorities '(("gnu" . 0)
("nongnu" . 10)
("melpa" . 20)))
(setopt use-package-expand-minimally t
use-package-always-defer t
use-package-always-ensure t
use-package-use-theme nil))
(defconst +package-todo+
'(
;; Finished A,B,C,D,E
;; cargo-transient
;; csv-mode
eglot-java
;; flymake-clippy maybe, requires extra steps
;; flymake-ruby ; maybe just use info from eglot
;; flymake-yamllint
;; forge
;; format-all maybe later - looks good for formatting everything on save
;; geiser
;; geiser-guile
;; gerrit
;; go-mode
;; guix
;; nerd-icons
;; nerd-icons-completion
;; nerd-icons-corfu
;; nerd-icons-dired
;; nerd-icons-ibuffer
;; poly-ansible
;; poly-ansible
;; poly-markdown
;; poly-ruby
;; polymode
;; realgud - debugger frontend.. idk
;; rust-mode
;; terraform-mode
;; yard-mode
;; zerodark-theme -> all-the-icons -> maybe?
))
;; C-sources Core
(use-package emacs :ensure nil
:init
(setopt auto-save-list-file-name nil
create-lockfiles nil
fill-column 80
history-delete-duplicates t
history-length 500
inhibit-compacting-font-caches t
read-process-output-max (* 1 1024 1024)
scroll-conservatively 101
tab-width 4
x-stretch-cursor t
use-short-answers t
;; startup
auto-save-list-file-prefix nil
inhibit-startup-message t
initial-scratch-message (concat ";; Happy hacking, " user-login-name " - Emacs ♥ you!\n")
;; novice
disabled-command-function nil
;; runtime Lisp native compiler
native-comp-async-report-warnings-errors nil))
;; --- Internal Packages
(use-package autorevert :ensure nil
:init
(setopt global-auto-revert-mode t
auto-revert-mode-text ""))
(use-package delsel :ensure nil
:init
(setopt delete-selection-mode t))
(use-package dired :ensure nil
:init
(setopt dired-auto-revert-buffer t
dired-dwim-target t
dired-recursive-copies 'always
dired-recursive-deletes 'top))
(use-package compile :ensure nil
:init
(setopt compilation-ask-about-save nil
compilation-always-kill t
compilation-scroll-output 'first-error)
(keymap-global-set "<f9>" 'compile)
(keymap-global-set "C-<f9>" 'recompile))
(use-package cus-edit :ensure nil
:init
(setopt custom-file (locate-user-emacs-file "ignored-custom.el")))
(use-package desktop :ensure nil
:init
(setopt desktop-save-mode t
desktop-save t
desktop-auto-save-timeout 600
desktop-restore-frames nil))
(use-package editorconfig :ensure nil
:init
(setopt editorconfig-mode t
editorconfig-mode-lighter ""))
(use-package eglot :ensure nil
:init
(setopt eglot-autoshutdown t)
(add-hook 'prog-mode-hook #'eglot-ensure))
(use-package elec-pair :ensure nil
:init
(setopt electric-pair-mode t))
(use-package files :ensure nil
:init
(setopt auto-save-default nil
make-backup-files nil
require-final-newline t)
(dolist (mode-map '((c-mode . c-ts-mode)
(c++-mode . c++-ts-mode)
(csharp-mode . csharp-ts-mode)
(dockerfile-mode . dockerfile-ts-mode)
(python-mode . python-ts-mode)
(sh-mode . bash-ts-mode)
(yaml-mode . yaml-ts-mode)))
(cl-pushnew mode-map major-mode-remap-alist :test #'equal)))
(use-package fira-code-mode :diminish
:init
(add-hook 'prog-mode-hook #'fira-code-mode))
(use-package flymake :ensure nil
:init
(setopt flymake-no-changes-timeout 5)
(add-hook 'sh-base-mode-hook #'flymake-mode)
)
(use-package hl-line :ensure nil
:init
(setopt global-hl-line-mode t))
(use-package hippie-exp :ensure nil
:init
(keymap-global-set "M-/" #'hippie-expand))
(use-package ibuffer :ensure nil
:init
(keymap-global-set "C-x C-b" #'ibuffer-jump))
(use-package indent :ensure nil
:init
(setopt tab-always-indent 'complete))
(use-package minibuffer :ensure nil
:init
(setopt completion-cycle-threshold nil
completion-styles '(basic partial-completion orderless)
completion-category-overrides '((file (styles basic partial-completion)))))
(use-package paragraphs :ensure nil
:init
(setopt sentence-end-double-space nil))
(use-package paren :ensure nil
:init
(setopt show-paren-mode t))
(use-package recentf :ensure nil
:init
(setopt recentf-mode t
recentf-max-saved-items 100
recentf-exclude '("/tmp/" "/ssh:")))
(use-package subword :ensure nil :diminish
:init
(add-hook 'prog-mode-hook #'subword-mode))
(use-package savehist :ensure nil
;; Save minibuffer history
:init
(setopt savehist-mode t
savehist-autosave-interval (* 1 60 60)))
(use-package saveplace :ensure nil
:init
(setopt save-place-mode t))
(use-package simple :ensure nil
:init
(setopt column-number-mode t
indent-tabs-mode nil
line-number-mode t))
(use-package so-long :ensure nil
:init
(setopt global-so-long-mode t))
(use-package wdired :ensure nil
:init
(setopt wdired-allow-to-change-permissions t))
(use-package whitespace :ensure nil :diminish
:init
(setopt global-whitespace-mode t
whitespace-action '(auto-cleanup warn-if-read-only)
whitespace-style '(face trailing tabs space-after-tab space-before-tab missing-newline-at-eof)))
(use-package which-key :ensure nil :diminish
:init
(setopt which-key-mode t))
(use-package windmove :ensure nil
:init
(setopt windmove-mode t
windmove-default-keybindings '(nil control)
windmove-swap-states-default-keybindings '(nil control shift)))
(use-package window :ensure nil
:init
(setopt split-width-threshold 160
split-height-threshold 100))
(use-package winner :ensure nil
:init
(setopt winner-mode t))
;;; -- External Packages
(use-package avy
:init
(setopt avy-timeout-seconds 0.3)
(keymap-global-set "C-'" #'avy-goto-line)
(keymap-global-set "C-;" #'avy-goto-char-timer))
(use-package avy-zap
:init
(keymap-global-set "M-z" #'avy-zap-up-to-char-dwim))
(use-package cape
:init
(add-hook 'completion-at-point-functions #'cape-file))
(use-package color-theme-sanityinc-tomorrow
:init
(load-theme 'sanityinc-tomorrow-eighties t))
(use-package consult
:init
(keymap-global-set "<remap> <isearch-forward>" #'consult-line)
(keymap-global-set "<remap> <switch-to-buffer>" #'consult-buffer)
(keymap-global-set "<remap> <switch-to-buffer-other-window>" #'consult-buffer-other-window)
(keymap-global-set "<remap> <yank-pop>" #'consult-yank-pop)
(keymap-global-set "<remap> <goto-line>" #'consult-goto-line))
;; (use-package consult-ag)
;; (use-package consult-project-extra)
(use-package corfu
:init
(setopt global-corfu-mode t
corfu-indexed-mode t
corfu-auto nil
corfu-count 20
corfu-max-width 200
corfu-min-width 50
corfu-popupinfo-delay '(0.5 . 0.1)
corfu-popupinfo-mode t)
:config
(keymap-set corfu-map "M-q" #'corfu-quick-complete))
(use-package diff-hl
:init
(add-hook 'dired-mode-hook #'diff-hl-dired-mode)
(add-hook 'prog-mode-hook #'diff-hl-mode))
(use-package diminish)
(use-package dired-subtree
:init
(setopt dired-subtree-line-prefix " ")
(with-eval-after-load 'dired
(keymap-set dired-mode-map "<tab>" #'dired-subtree-toggle)
(keymap-set dired-mode-map ";" #'dired-subtree-remove)))
(use-package diredfl
:init
(add-hook 'dired-mode-hook #'diredfl-mode))
(use-package docker
:init
(setopt docker-command "podman")
(defalias 'podman 'docker))
(use-package embark
:init
(keymap-global-set "C-." #'embark-act)
(keymap-global-set "C-c C-o" #'embark-export))
(use-package embark-consult)
(use-package expand-region
:init
(keymap-global-set "C-=" #'er/expand-region))
(use-package git-modes)
(use-package git-timemachine)
(use-package gptel)
(use-package magit
:config
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))
;; magit-push is part of magit package, but hook after load is different
(use-package magit-push :ensure nil
:config
(transient-append-suffix 'magit-push "-n"
'("-gm" "GitLab Create Merge Request" "--push-option=merge_request.create")))
(use-package magit-todos)
(use-package marginalia
:init
(setopt marginalia-mode t
marginalia-annotators '(marginalia-annotators-heavy)))
;; TODO: markdown-ts-mode
;; (use-package markdown-ts-mode
;; :mode ("\\.md\\'" . markdown-ts-mode)
;; :defer 't
;; :config
;; (add-to-list 'treesit-language-source-alist '(markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "split_parser" "tree-sitter-markdown/src"))
;; (add-to-list 'treesit-language-source-alist '(markdown-inline "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "split_parser" "tree-sitter-markdown-inline/src")))
(use-package markdown-mode)
(use-package move-dup :diminish
:init
(setopt global-move-dup-mode t))
(use-package multiple-cursors :demand t
:init
(keymap-global-set "C->" #'mc/mark-next-like-this)
(keymap-global-set "C-<" #'mc/mark-previous-like-this)
(keymap-global-set "C-c m m" #'mc/mark-all-dwim)
(keymap-global-set "C-S-<mouse-1>" #'mc/toggle-cursor-on-click)
:config
;; bug with mc/toggle-cursor-on-click
(cl-pushnew 'mc/toggle-cursor-on-click mc--default-cmds-to-run-once)
(keymap-set mc/keymap "M-<return>" #'mc/skip-to-next-like-this))
(use-package nginx-mode)
(use-package orderless)
(use-package phi-search
:init
(with-eval-after-load 'multiple-cursors
(keymap-set mc/keymap "C-s" #'phi-search)
(keymap-set mc/keymap "C-r" #'phi-search-backward)))
(use-package rainbow-delimiters
:init
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
(use-package sly
:config
;; this to keys I use for symbol overlay
(keymap-unset sly-editing-mode-map "M-p")
(keymap-unset sly-editing-mode-map "M-n"))
(use-package sly-asdf)
(use-package switch-window
:init
(setopt switch-window-shortcut-style 'qwerty)
(keymap-global-set "C-x o" #'switch-window)
(keymap-global-set "C-x 0" #'switch-window-then-delete))
(use-package symbol-overlay :diminish
:init
(setopt symbol-overlay-mode t)
(add-hook 'prog-mode-hook #'symbol-overlay-mode)
(keymap-global-set "M-i" #'symbol-overlay-put)
(keymap-global-set "M-n" #'symbol-overlay-jump-next)
(keymap-global-set "M-p" #'symbol-overlay-jump-prev))
(use-package systemd)
(use-package treesit-auto
:init
(setopt treesit-auto-install 'prompt))
(use-package vertico
:init
(setopt vertico-mode t
vertico-count 20)
:config
(keymap-set vertico-map "TAB" #'minibuffer-complete)
(keymap-set vertico-map "M-q" #'vertico-quick-exit))
(use-package wgrep
:init
(setopt wgrep-too-many-file-length 20
wgrep-auto-save-buffer t))
(use-package zoom :diminish
:init
(setopt zoom-mode t
zoom-ignored-major-modes '(dired-mode)
zoom-size '(0.618 . 0.618)))
(provide 'init)
;;; init.el ends here