summaryrefslogtreecommitdiff
path: root/init.el
blob: 5ae298086c99d2826514b647640ed68b07d6f89f (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
;; Disable package.el
(setq package-enable-at-startup nil)

;; straight.el booststrap (https://github.com/raxod502/straight.el#getting-started)
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;; [package] use-package
(straight-use-package 'use-package)

;; [config] straight: use use-package by default
(use-package straight
  :custom (straight-use-package-by-default t))
9
;; [package] acme-mouse
(use-package acme-mouse
  :init
  (delete-selection-mode -1))

;; [package] magit
(use-package magit)

;; [package] vertico: better selection buffer
(use-package vertico
  :init
  (vertico-mode))

;; [config] disable electric indent
(electric-indent-mode -1)
(add-hook 'after-change-major-mode-hook (lambda()
					  (electric-indent-mode -1)))

;; [package] pdf-tools: opens pdfs
(use-package pdf-tools)

;; [package] rust-mode: mode for rust syntax highlighting
(use-package rust-mode
  :init
  (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)))

;; [package] hare-mode: mode for hare
(use-package hare-mode
  :straight (hare-mode :type git :host nil
		       :repo "https://git.sr.ht/~bbuccianti/hare-mode")
  :init
  (add-to-list 'auto-mode-alist '("\\.ha\\'" . hare-mode)))

;; [package] tex: latex stuff
(use-package tex
  :straight auctex
  :init
  (setq TeX-auto-save t)
  (setq TeX-parse-self t)
  (setq-default TeX-master nil))

(use-package org-fragtog
  :init
  (add-hook 'org-mode-hook 'org-fragtog-mode))

;; [package] tmr: useful timers (finally, because I used to use my phone
;; previously)
(use-package tmr
  :straight (tmr :type git :host nil
		 :repo "https://git.sr.ht/~protesilaos/tmr"))

;; [package] plz: (dep) ement
(use-package plz
  :straight (plz :type git :host nil
		   :repo "https://github.com/alphapapa/plz.el"))

;; [package] ement: matrix client
(use-package ement
  :straight (ement :type git :host nil
		   :repo "https://github.com/alphapapa/ement.el"))

;; [config] set modus-vivendi theme
(use-package modus-themes
  :init
  (modus-themes-load-themes)
  (modus-themes-load-vivendi))

;; [config] display line numbers
(global-display-line-numbers-mode 1)

;; [config] disable menu-bar-mode  scroll-bar and menu-bar
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)

;; [config] more natural scrolling
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't)
(pixel-scroll-precision-mode)

;; [config] highlighting
(global-hl-line-mode 1)

;; [config] backups in fixed directory
(setq backup-directory-alist `(("." . "~/.saves")))

;; [config] keyboard exit modal: add M-c as alias for C-g
(define-key key-translation-map (kbd "M-c") (kbd "C-g"))

;; [INTERFACE] set with the custom interface
(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.
 '(custom-safe-themes
   '("02fff7eedb18d38b8fd09a419c579570673840672da45b77fde401d8708dc6b5" default))
 '(ement-notify-notification-predicates
   '(ement-notify--event-mentions-session-user-p ement-notify--event-mentions-room-p))
 '(fill-nobreak-predicate '(fill-french-nobreak-p)))
(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.
 '(default ((t (:inherit nil :extend nil :stipple nil :background "#000000" :foreground "#ffffff" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight regular :height 120 :width normal :foundry "PfEd" :family "Go Mono"))))
 '(fringe ((t (:inherit background)))))


;; [command] open-line-above: mimicks vim shift+o behavior
(defun open-line-above ()
  (interactive)
  (move-beginning-of-line nil)
  (newline-and-indent)
  (forward-line -1)
  (indent-according-to-mode))

(global-set-key (kbd "M-o") 'open-line-above)

;; [config] set tabs
(setq indent-tabs-mode t)
(setq tab-width 4)
(defvaralias 'c-basic-offset 'tab-width)

(add-hook 'java-mode-hook (lambda ()
			    (setq c-basic-offset 4
				  tab-width 4
				  indent-tabs-mode nil)))

(put 'dired-find-alternate-file 'disabled nil)

(autoload 'delete-selection-helper "delsel")
(defun vz/delete-mouse-selection-pre-hook ()
  (when (and vz/delete-mouse-selection-mode
             (use-region-p) (mouse-region-match)
             (not buffer-read-only))
    (delete-selection-helper (and (symbolp this-command)
                                  (get this-command 'delete-selection)))))

(define-minor-mode vz/delete-mouse-selection-mode
  "Replace the region by typed text if it was selected using the mouse.
Otherwise, typed text is just inserted."
  :global t
  (if vz/delete-mouse-selection-mode
      (add-hook 'pre-command-hook #'vz/delete-mouse-selection-pre-hook)
    (remove-hook 'pre-command-hook #'vz/delete-mouse-selection-pre-hook)))

(vz/delete-mouse-selection-mode 1)

(global-set-key (kbd "C-x C-b") 'switch-to-buffer)
(windmove-default-keybindings)