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
|
;; Based on emacs bedrock config: https://git.sr.ht/~ashton314/emacs-bedrock/tree/main/item/init.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Boot
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Improve boot speed
(setq gc-cons-threshold 10000000)
(setq byte-compile-warnings '(not obsolete))
(setq warning-suppress-log-types '((comp) (bytecomp)))
(setq native-comp-async-report-warnings-errors 'silent)
;; Silence stupid startup message
(setq inhibit-startup-echo-area-message (user-login-name))
;; Default frame configuration: full screen, good-looking title bar on macOS
(setq frame-resize-pixelwise t)
(setq default-frame-alist '((fullscreen . maximized)
;; You can turn off scroll bars by uncommenting these lines:
(vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil)
;; Setting the face in here prevents flashes of
;; color as the theme gets activated
(background-color . "#000000")
(ns-appearance . dark)
(ns-transparent-titlebar . t)))
;; Profile emacs startup
(add-hook 'emacs-startup-hook
(lambda ()
(message "*** Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Setup
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Melpa
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/"))
(unless (bound-and-true-p package--initialized)
(package-initialize))
;; Fixed error on Guix emacs
(require 'use-package)
(setq use-package-always-ensure t)
;; Automatically reread from disk if the underlying file changes
(setq auto-revert-interval 1)
(setq auto-revert-check-vc-info t)
(global-auto-revert-mode)
;; Windmove keybinding (move between windows with CTRL+Arrows)
(windmove-default-keybindings 'control)
;; Make right-click do something sensible
(when (display-graphic-p)
(context-menu-mode))
;; Recent files
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; Auto-save files in auto-saves/
(let ((emacs-auto-save-folder (concat user-emacs-directory "auto-saves/")))
(if (file-directory-p emacs-auto-save-folder) nil
(make-directory emacs-auto-save-folder))
(setq auto-save-file-name-transforms
`((".*" ,emacs-auto-save-folder t))))
;; Backup files in backups/
(let ((emacs-backup-folder (concat user-emacs-directory "backups/")))
(if (file-directory-p emacs-backup-folder) nil
(make-directory emacs-backup-folder))
(setq backup-directory-alist
`(("." . ,(expand-file-name
emacs-backup-folder)))))
;; Which key
(use-package which-key
:ensure t
:config
(which-key-mode))
;; Tramp
(setq remote-file-name-inhibit-cache nil)
(setq vc-ignore-dir-regexp
(format "%s\\|%s"
vc-ignore-dir-regexp
tramp-file-name-regexp))
(setq tramp-verbose 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Custom variables snippet
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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
'("32f22d075269daabc5e661299ca9a08716aa8cda7e85310b9625c434041916af" "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc" default))
'(org-agenda-files '("~/Projects/org-files/agenda/financeiro.org"))
'(package-selected-packages
'(yaml-mode lsp-ui lsp-mode pet editorconfig geiser-guile paredit git-auto-commit-mode elpy rust-mode lua-mode sass-mode poetry markdown-mode flymake-cursor gdscript-mode magit org-pomodoro org-tracktable doom-themes which-key))
'(pyvenv-tracking-mode t)
'(safe-local-variable-values '((git-auto-commit-mode . 1) (git-auto-commit-mode . 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.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Minibuffer
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion
(setq enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer
(setq completion-cycle-threshold 1) ; TAB cycles candidates
(setq completions-detailed t) ; Show annotations
(setq tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent
(setq completion-styles '(basic initials substring)) ; Different styles to match input to candidates
(setq completion-auto-help 'always) ; Open completion always; `lazy' another option
(setq completions-max-height 20) ; This is arbitrary
(setq completions-detailed t)
(setq completions-format 'one-column)
(setq completions-group t)
(setq completion-auto-select 'second-tab) ; Much more eager
;(setq completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values
(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Better UI
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Inibit
(setq inhibit-splash-screen t)
;; Disable graphical toolbars
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(menu-bar-mode -1)
;; Disable blinking cursos
(blink-cursor-mode 0)
;; Display time
(setq display-time-day-and-date t)
(display-time)
;; Display Battery
(display-battery-mode 1)
;; Column number mode
(column-number-mode)
(global-display-line-numbers-mode t)
(global-hl-line-mode +1)
(dolist (mode '(term-mode-hook
shell-mode-hook
eshell-mode-hook
treemacs-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
(set-face-attribute 'default nil :font "Fira Code" :height 120)
;; Enable horizontal scrolling
(setq mouse-wheel-tilt-scroll t)
(setq mouse-wheel-flip-direction t)
;; Best theme
(use-package doom-themes
:config
(load-theme 'doom-fairy-floss))
;; Fix TUI background
(add-to-list 'default-frame-alist '(background-color . "#464258"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Text Modes
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Helpful packages for org mode
(use-package org-tracktable)
(use-package org-pomodoro)
(use-package git-auto-commit-mode)
(defun set-auto-commit-settings ()
(setq gac-automatically-push-p t))
(add-hook 'org-mode-hook 'set-auto-commit-settings)
;; Truncate lines and word wrap
(defun set-truncate-lines-mode-hook ()
"Custom hook."
(setq word-wrap t)
(setq truncate-lines nil))
(add-hook 'org-mode-hook #'set-truncate-lines-mode-hook)
(add-hook 'markdown-mode-hook #'set-truncate-lines-mode-hook)
;; Markdown
(use-package markdown-mode
:ensure t
:mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Programming modes
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Editor config
(use-package editorconfig
:ensure t)
(editorconfig-mode 1)
;; Flymake errors under cursor
(use-package flymake-cursor
:ensure t)
(eval-after-load 'flymake '(require 'flymake-cursor))
;; Disable automatic eldoc
(setq eglot-managed-mode-hook (list (lambda () (eldoc-mode -1))))
;; Install magit
(use-package magit
:ensure t)
;; Guile related packages
(use-package paredit
:ensure t)
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(use-package geiser-guile
:ensure t)
;; LSP
(use-package lsp-mode
:ensure t
:init
(setq lsp-keymap-prefix "C-c l")
:hook ((python-mode . lsp))
:commands lsp
)
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode)
;; python mode
(use-package poetry
:ensure t
:hook
(python-mode . poetry-tracking-mode))
;; Lua mode
(use-package lua-mode
:ensure t)
;; YAML mode
(use-package yaml-mode
:ensure t)
;; Rust mode
(use-package rust-mode
:ensure t)
;; GDScript mode
(use-package gdscript-mode)
(add-hook 'gdscript-mode-hook 'eglot-ensure)
(put 'dired-find-alternate-file 'disabled nil)
;; Sass mode
(use-package sass-mode)
|