summaryrefslogtreecommitdiff
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el108
1 files changed, 78 insertions, 30 deletions
diff --git a/init.el b/init.el
index b3ff85a..b7ed7cb 100644
--- a/init.el
+++ b/init.el
@@ -12,6 +12,8 @@
12(setq-default user-full-name "Uko Kokņevičs" 12(setq-default user-full-name "Uko Kokņevičs"
13 user-email-address "perkontevs@gmail.com") 13 user-email-address "perkontevs@gmail.com")
14 14
15(defconst +emacs29+ (version< emacs-version "30.0"))
16
15(defconst +linux+ (eq system-type 'gnu/linux)) 17(defconst +linux+ (eq system-type 'gnu/linux))
16(defconst +mac+ (eq system-type 'darwin)) 18(defconst +mac+ (eq system-type 'darwin))
17(defconst +bsd+ (or +mac+ (eq system-type 'berkeley-unix))) 19(defconst +bsd+ (or +mac+ (eq system-type 'berkeley-unix)))
@@ -113,6 +115,14 @@
113 (eval-print-last-sexp))) 115 (eval-print-last-sexp)))
114 (load bootstrap-file)) 116 (load bootstrap-file))
115 117
118;; use-package
119(use-package use-package)
120
121;; compat
122(use-package compat-30
123 :if +emacs29+
124 :straight 'compat)
125
116;; I don't want these 126;; I don't want these
117(when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) 127(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
118(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) 128(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
@@ -143,9 +153,6 @@
143 153
144(add-hook 'before-save-hook #'delete-trailing-whitespace) 154(add-hook 'before-save-hook #'delete-trailing-whitespace)
145 155
146;; use-package
147(use-package use-package)
148
149;; HIC SVNT DRACONES 156;; HIC SVNT DRACONES
150 157
151(use-package ace-window 158(use-package ace-window
@@ -153,6 +160,11 @@
153 :bind (([remap other-window] . ace-window) 160 :bind (([remap other-window] . ace-window)
154 ("C-x o" . ace-window))) 161 ("C-x o" . ace-window)))
155 162
163(use-package amx
164 :straight t
165 :config
166 (amx-mode +1))
167
156(use-package auto-compile 168(use-package auto-compile
157 :straight t 169 :straight t
158 :hook ((emacs-lisp-mode . auto-compile-on-load-mode) 170 :hook ((emacs-lisp-mode . auto-compile-on-load-mode)
@@ -163,7 +175,11 @@
163 :straight '(c-ts-mode :type built-in) 175 :straight '(c-ts-mode :type built-in)
164 :mode ("\\.c\\'" 176 :mode ("\\.c\\'"
165 ("\\.cpp\\'" . c++-ts-mode)) 177 ("\\.cpp\\'" . c++-ts-mode))
166 :hook (c-ts-base-mode . (lambda () (set-tab-usage t) (set-tab-width c-ts-mode-indent-offset))) 178 :init
179 (defun arkta/c-setup ()
180 (set-tab-usage t)
181 (set-tab-width c-ts-mode-indent-offset))
182 :hook (c-ts-base-mode . arkta/c-setup)
167 :custom 183 :custom
168 (c-ts-mode-indent-offset 8) 184 (c-ts-mode-indent-offset 8)
169 (c-ts-mode-indent-style (lambda () 185 (c-ts-mode-indent-style (lambda ()
@@ -174,8 +190,11 @@
174 190
175(use-package centaur-tabs 191(use-package centaur-tabs
176 :straight t 192 :straight t
177 :hook ((after-init . (lambda () (centaur-tabs-mode +1))) 193 :demand t
178 (dashboard-mode . (lambda () (centaur-tabs-local-mode +1)))) 194 :init
195 (defun arkta/disable-centaur-tabs-mode ()
196 (centaur-tabs-local-mode +1))
197 :hook (dashboard-mode . arkta/disable-centaur-tabs-mode)
179 :bind (("C-x <C-right>" . centaur-tabs-forward) 198 :bind (("C-x <C-right>" . centaur-tabs-forward)
180 ("C-x <right>" . centaur-tabs-forward) 199 ("C-x <right>" . centaur-tabs-forward)
181 ("C-x <C-left>" . centaur-tabs-backward) 200 ("C-x <C-left>" . centaur-tabs-backward)
@@ -190,7 +209,9 @@
190 (centaur-tabs-set-close-button nil) 209 (centaur-tabs-set-close-button nil)
191 (centaur-tabs-set-modified-marker t) 210 (centaur-tabs-set-modified-marker t)
192 (centaur-tabs-modified-marker "●") 211 (centaur-tabs-modified-marker "●")
193 (centaur-tabs-cycle-scope 'tabs)) 212 (centaur-tabs-cycle-scope 'tabs)
213 :config
214 (centaur-tabs-mode +1))
194 215
195(use-package cmake-ts-mode 216(use-package cmake-ts-mode
196 :after treesit 217 :after treesit
@@ -222,16 +243,19 @@
222 243
223(use-package copyright 244(use-package copyright
224 :straight '(copyright :type built-in) 245 :straight '(copyright :type built-in)
225 :hook (before-save . (lambda () 246 :init
226 (save-mark-and-excursion 247 (defun arkta/maybe-fix-copyright ()
227 (copyright-update) 248 (save-mark-and-excursion
228 (copyright-fix-years)))) 249 (copyright-update)
250 (copyright-fix-years)))
251 :hook (before-save . arkta/maybe-fix-copyright)
229 :custom 252 :custom
230 (copyright-names-regexp "Eris\\|Ukko\\|Uko\\|Free Software") 253 (copyright-names-regexp "Eris\\|Ukko\\|Uko\\|Free Software")
231 (copyright-year-ranges t)) 254 (copyright-year-ranges t))
232 255
233(use-package counsel 256(use-package counsel
234 :straight t 257 :straight t
258 :after amx
235 :config 259 :config
236 (counsel-mode +1)) 260 (counsel-mode +1))
237 261
@@ -251,8 +275,8 @@
251 275
252(use-package dashboard 276(use-package dashboard
253 :straight t 277 :straight t
254 :hook ((after-init . dashboard-setup-startup-hook) 278 :demand t
255 (server-after-make-frame . dashboard-open)) 279 :hook (server-after-make-frame . dashboard-open)
256 :custom 280 :custom
257 (dashboard-center-content nil) 281 (dashboard-center-content nil)
258 (dashboard-startup-banner (expand-file-name "logo.png" user-emacs-directory)) 282 (dashboard-startup-banner (expand-file-name "logo.png" user-emacs-directory))
@@ -260,17 +284,29 @@
260 (dashboard-projects-backend 'project-el) 284 (dashboard-projects-backend 'project-el)
261 (dashboard-set-heading-icons t) 285 (dashboard-set-heading-icons t)
262 (dashboard-set-file-icons t) 286 (dashboard-set-file-icons t)
263 (dashboard-set-init-info t)) 287 (dashboard-set-init-info t)
288 :config
289 (dashboard-setup-startup-hook))
264 290
265(use-package display-fill-column-indicator 291(use-package display-fill-column-indicator
266 :straight '(display-fill-column-indicator :type built-in) 292 :straight '(display-fill-column-indicator :type built-in)
267 :hook ((after-init . (lambda () (global-display-fill-column-indicator-mode +1))) 293 :demand t
268 (dashboard-mode . (lambda () (display-fill-column-indicator-mode -1))))) 294 :init
295 (defun arkta/disable-dfci ()
296 (display-fill-column-indicator-mode -1))
297 :hook (dashboard-mode . arkta/disable-dfci)
298 :config
299 (global-display-fill-column-indicator-mode +1))
269 300
270(use-package display-line-numbers 301(use-package display-line-numbers
271 :straight '(display-line-numbers :type built-in) 302 :straight '(display-line-numbers :type built-in)
272 :hook ((after-init . (lambda () (global-display-line-numbers-mode +1))) 303 :demand t
273 (help-mode . (lambda () (display-line-numbers-mode -1))))) 304 :init
305 (defun arkta/disable-dln ()
306 (display-line-numbers-mode -1))
307 :hook (help-mode . arkta/disable-dln)
308 :config
309 (global-display-line-numbers-mode +1))
274 310
275(use-package dockerfile-ts-mode 311(use-package dockerfile-ts-mode
276 :after treesit 312 :after treesit
@@ -313,7 +349,10 @@
313(use-package elixir-mode 349(use-package elixir-mode
314 :straight t 350 :straight t
315 :mode "\\.exs?\\'" 351 :mode "\\.exs?\\'"
316 :hook (elixir-mode . (lambda () (add-hook 'before-save-hook #'elixir-format nil t)))) 352 :init
353 (defun arkta/elixir-setup ()
354 (add-hook 'before-save-hook #'elixir-format nil t))
355 :hook (elixir-mode . arkta/elixir-setup))
317 356
318(use-package emojify 357(use-package emojify
319 :straight t 358 :straight t
@@ -322,6 +361,7 @@
322 361
323(use-package envrc 362(use-package envrc
324 :straight t 363 :straight t
364 ;; This actually has to be hooked to after-init to be one of the first minor modes enabled
325 :hook (after-init . envrc-global-mode)) 365 :hook (after-init . envrc-global-mode))
326 366
327(use-package files 367(use-package files
@@ -370,11 +410,12 @@
370 :after treesit 410 :after treesit
371 :straight '(go-ts-mode :type built-in) 411 :straight '(go-ts-mode :type built-in)
372 :mode "\\.go\\'" 412 :mode "\\.go\\'"
373 :hook 413 :init
374 (go-ts-mode . (lambda () 414 (defun arkta/go-setup ()
375 (add-hook 'before-save-hook #'gofmt-before-save nil t) 415 (add-hook 'before-save-hook #'gofmt-before-save nil t)
376 (set-tab-usage t) 416 (set-tab-usage t)
377 (set-tab-width go-ts-mode-indent-offset)))) 417 (set-tab-width go-ts-mode-indent-offset))
418 :hook (go-ts-mode . arkta/go-setup))
378 419
379(use-package groovy-mode 420(use-package groovy-mode
380 :straight t 421 :straight t
@@ -404,13 +445,15 @@
404(use-package ivy 445(use-package ivy
405 :after (counsel swiper) 446 :after (counsel swiper)
406 :straight t 447 :straight t
407 :hook (after-init . (lambda () (ivy-mode +1))) 448 :demand t
408 :bind (("C-c r" . ivy-resume) 449 :bind (("C-c r" . ivy-resume)
409 ("C-c v" . ivy-push-view) 450 ("C-c v" . ivy-push-view)
410 ("C-c V" . ivy-pop-view)) 451 ("C-c V" . ivy-pop-view))
411 :custom 452 :custom
412 (ivy-use-virtual-buffers t) 453 (ivy-use-virtual-buffers t)
413 (ivy-count-format "(%d/%d) ")) 454 (ivy-count-format "(%d/%d) ")
455 :config
456 (ivy-mode +1))
414 457
415(use-package java-ts-mode 458(use-package java-ts-mode
416 :after treesit 459 :after treesit
@@ -456,7 +499,10 @@
456 :straight t 499 :straight t
457 :mode ("\\.asm\\'" 500 :mode ("\\.asm\\'"
458 "\\.inc\\'") 501 "\\.inc\\'")
459 :hook (nasm-mode . (lambda () (set-tab-width 4)))) 502 :init
503 (defun arkta/nasm-setup ()
504 (set-tab-width 4))
505 :hook (nasm-mode . arkta/nasm-setup))
460 506
461(use-package nerd-icons 507(use-package nerd-icons
462 :straight t 508 :straight t
@@ -465,8 +511,7 @@
465 (unless (find-font (font-spec :family nerd-icons-font-family)) 511 (unless (find-font (font-spec :family nerd-icons-font-family))
466 ;; TODO: Maybe also reinstall them every month or so 512 ;; TODO: Maybe also reinstall them every month or so
467 (nerd-icons-install-fonts t))) 513 (nerd-icons-install-fonts t)))
468 :hook 514 :hook (after-init . arkta/nerd-icons-maybe-install-fonts))
469 (after-init . arkta/nerd-icons-maybe-install-fonts))
470 515
471(use-package nix-mode 516(use-package nix-mode
472 :straight t 517 :straight t
@@ -559,7 +604,10 @@
559 604
560(use-package rainbow-mode 605(use-package rainbow-mode
561 :straight t 606 :straight t
562 :hook (prog-mode . (lambda () (rainbow-mode +1)))) 607 :init
608 (defun arkta/enable-rainbow ()
609 (rainbow-mode +1))
610 :hook (prog-mode . arkta/enable-rainbow))
563 611
564(use-package ruby-ts-mode 612(use-package ruby-ts-mode
565 :after treesit 613 :after treesit