]> crepu.dev Git - config.git/blob - tarro/emacs/init.el
f996f7d60f54a409c3d5383dc1c1fd1a88806e59
[config.git] / tarro / emacs / init.el
1 ;; Initw.el -*- lexical-binding: t; -*-
2
3 (menu-bar-mode -1) ;; Oculta la barra del menú
4 (scroll-bar-mode -1)
5 (horizontal-scroll-bar-mode nil) ;; Oculta la barra de desplazamiento
6 (tool-bar-mode -1) ;; Oculta la barra de herramientas
7 (customize-set-variable 'delete-selection-mode 1) ;; Borra la región seleccionada
8 (column-number-mode) ;; Número de la columna en la línea de modo
9 (global-visual-line-mode 1)
10 (global-auto-revert-mode 1)
11 (set-fringe-mode 0)
12 (fset 'yes-or-no-p 'y-or-n-p)
13
14 (setq-default cursor-in-non-selected-windows nil
15 frame-title-format '("%f [%m]"))
16 (setq default-fill-column 100
17 make-backup-files nil
18 inhibit-startup-message t
19 custom-file "~/.emacs.d/custom.el"
20 global-auto-revert-non-file-buffers t
21 message-kill-buffer-on-exit t
22 large-file-warning-threshold nil)
23 (load custom-file)
24
25 (require 'package)
26 (setq package-archives '(("melpa" . "https://melpa.org/packages/")
27 ("nongnu" . "https://elpa.nongnu.org/nongnu/")
28 ("elpa" . "https://elpa.gnu.org/packages/")))
29 (package-initialize)
30 (unless package-archive-contents
31 (package-refresh-contents))
32
33 (unless (package-installed-p 'use-package)
34 (package-install 'use-package))
35 (require 'use-package)
36 (setq use-package-always-ensure t)
37
38 (use-package vertico
39 :ensure t
40 :init
41 (vertico-mode))
42
43 (use-package vertico-directory
44 :after vertico
45 :ensure nil
46 :bind (:map vertico-map
47 ("RET" . vertico-directory-enter)
48 ("DEL" . vertico-directory-delete-char)
49 ("M-DEL" . vertico-directory-delete-word))
50 :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
51
52 (use-package savehist
53 :init
54 (savehist-mode))
55
56 (use-package marginalia
57 :after vertico
58 :ensure t
59 :init
60 (marginalia-mode)
61 :custom
62 (marginalia-align 'right))
63
64 (use-package orderless
65 :ensure t
66 :after vertico
67 :custom
68 (completion-styles '(orderless basic)))
69
70 (use-package embark
71 :ensure t
72 :bind (("C-." . embark-act)
73 ("C-;" . embark-dwim)
74 ("C-h B" . embark-bindings))
75 :init
76 (setq prefix-help-command #'embark-prefix-help-command)
77 :config
78 (add-to-list 'display-buffer-alist
79 '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
80 nil
81 (window-parameters (mode-line-format . none)))))
82
83 (use-package corfu
84 :custom
85 (corfu-auto t)
86 (corfu-quit-no-match t)
87 (corfu-separator ?\s)
88 :init
89 (global-corfu-mode))
90
91 (use-package corfu-terminal
92 :config
93 (unless (display-graphic-p)
94 (corfu-terminal-mode +1)))
95
96 (use-package which-key
97 :defer 0
98 :config
99 (which-key-mode)
100 (setq which-key-idle-delay 0.3))
101
102 (use-package magit
103 :bind ("C-x g" . magit-status))
104
105 (use-package modus-themes
106 :if window-system
107 :init
108 (load-theme 'modus-vivendi t))
109
110 (use-package smartparens
111 :hook (prog-mode . smartparens-mode))
112
113 (use-package dired
114 :ensure nil
115 :defer 1
116 :config
117 (setq dired-recursive-copies 'always
118 dired-listing-switches "--group-directories-first -alh"))
119
120 (use-package dired-hide-dotfiles
121 :after dired
122 :hook (dired-mode . dired-hide-dotfiles-mode)
123 :config
124 (define-key dired-mode-map "." #'dired-hide-dotfiles-mode))
125
126 (use-package pdf-tools
127 :defer t)
128
129 (pdf-loader-install)
130
131 (use-package pdf-view-restore
132 :after pdf-tools
133 :config
134 (add-hook 'pdf-view-mode-hook 'pdf-view-restore-mode))
135
136 (use-package elfeed
137 :no-require t
138 :bind ("C-x w" . elfeed))
139
140 (use-package elfeed-org
141 :ensure t
142 :after elfeed
143 :config
144 (elfeed-org)
145 (setq rmh-elfeed-org-files (list "~/.emacs.d/elfeed.org")))
146
147 (use-package latex
148 :ensure auctex
149 :defer t
150 :custom
151 (TeX-source-correlate-mode t)
152 (TeX-source-correlate-start-server t)
153 :config
154 (setq TeX-view-program-selection '((output-pdf "PDF Tools")))
155 (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
156
157 (use-package markdown-mode
158 :ensure t
159 :commands (markdown-mode gfm-mode)
160 :mode (("README\\.md\\'" . gfm-mode)
161 ("\\.md\\'" . markdown-mode)
162 ("\\.markdown\\'" . markdown-mode)))
163
164 (use-package org
165 :commands (org-capture org-agenda)
166 :bind (("C-c l" . org-store-link)
167 ("C-c a" . org-agenda)
168 ("C-c c" . org-capture))
169 :custom
170 (org-export-backends
171 '(beamer html icalendar latex md odt))
172 (org-capture-templates
173 '(("h" "Por hacer" entry
174 (file+headline "agenda.org" "Cosas por hacer")
175 "** TODO %?")
176 ("r" "Reunión" entry
177 (file+headline "agenda.org" "Cosas por hacer")
178 "** REUNIÓN %^{¿De qué?|JGM|HSS|BANDA|DOJO|VECINOS}\n %^T")
179 ("e" "Evento")
180 ("ec" "Cumpleaños" entry
181 (file+headline "agenda.org" "Eventos")
182 "** CUMPLE %^{¿De quién?}\n SCHEDULED %^T")
183 ("ef" "Funeral" entry
184 (file+headline "agenda.org" "Eventos")
185 "** FUNERAL %^{¿De quién?}\n SCHEDULED %^T")
186 ("em" "Matrimonio" entry
187 (file+headline "agenda.org" "Eventos")
188 "** MATRI %^{¿De quién?}\n SCHEDULED %^T")))
189 :config
190 (setq org-agenda-files '("~/org/agenda.org")
191 org-ellipsis " ▾"
192 org-footnote-auto-adjust t
193 org-return-follows-link t
194 org-log-done 'time
195 org-capture-bookmark nil
196 org-html-validation-link nil
197 org-startup-indented t
198 org-startup-folded nil))
199
200 (with-eval-after-load 'org
201 (org-babel-do-load-languages
202 'org-babel-load-languages
203 '((C . t)
204 (scheme . t)
205 (python . t)
206 (shell . t)))
207 (add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images))
208
209 (use-package citar
210 :defer t
211 :bind (("C-c b" . citar-insert-citation)
212 ("M-p" . citar-org-update-prefix-suffix)
213 :map minibuffer-local-map
214 ("M-b" . citar-insert-preset))
215 :custom
216 (citar-bibliography '("./referencias.bib"))
217 :hook
218 (LaTeX-mode . citar-capf-setup)
219 (org-mode . citar-capf-setup))
220
221 (use-package org-bullets
222 :no-require t
223 :custom
224 (org-bullets-bullet-list '("◉" "●" "○" "●" "○" "●")))
225
226 (use-package hide-lines)
227
228 (use-package hide-mode-line
229 :defer t)
230
231 (defun terror/slide-setup ()
232 (global-hl-line-mode -1)
233 (setq org-hide-emphasis-markers t)
234 (org-bullets-mode 1)
235 (setq text-scale-mode-amount 3)
236 (text-scale-mode 1)
237 (set-frame-parameter (selected-frame)
238 'internal-border-width 75)
239 (org-display-inline-images)
240 (toggle-frame-fullscreen)
241 (hide-mode-line-mode 1)
242 (hide-lines-matching "#\\+begin")
243 (hide-lines-matching "#\\+end"))
244
245 (defun terror/slide-end ()
246 (global-hl-line-mode 1)
247 (setq org-hide-emphasis-markers nil)
248 (org-bullets-mode -1)
249 (setq text-scale-mode-amount 0)
250 (text-scale-mode -1)
251 (set-frame-parameter (selected-frame)
252 'internal-border-width 20)
253 (toggle-frame-fullscreen)
254 (hide-mode-line-mode -1)
255 (hide-lines-show-all)
256 (org-fold-show-all))
257
258 (use-package org-tree-slide
259 :after org
260 :bind ("C-c p" . org-tree-slide-mode)
261 :hook ((org-tree-slide-play . terror/slide-setup)
262 (org-tree-slide-stop . terror/slide-end))
263 :config
264 (setq org-tree-slide-slide-in-effect nil
265 org-image-actual-width nil
266 org-tree-slide-header t
267 org-tree-slide-breadcrumbs " > "
268 org-tree-slide-activate-message "Let's begin..."
269 org-tree-slide-deactivate-message "The end :)"))
270
271 (use-package org-roam
272 :ensure t
273 :init
274 (setq org-roam-v2-ack t)
275 :custom
276 (org-roam-directory (file-truename "~/org/roam"))
277 (org-roam-capture-templates
278 '(("a" "Autor" plain
279 (file "~/.emacs.d/templates/roam/author.org")
280 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
281 "#+title: ${title}\n")
282 :unnarrowed t)
283 ("c" "Concepto" plain
284 (file "~/.emacs.d/templates/roam/concept.org")
285 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
286 "#+title: ${title}\n")
287 :unnarrowed t)
288 ("d" "Por defecto" plain
289 "%?"
290 :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
291 :unnarrowed t)
292 ("q" "Cita" plain
293 (file "~/.emacs.d/templates/roam/quote.org")
294 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
295 "#+title: ${title}\n")
296 :unnarrowed t)))
297 :bind (("C-c n l" . org-roam-buffer-toggle)
298 ("C-c n f" . org-roam-node-find)
299 ("C-c n i" . org-roam-node-insert)
300 ("C-c n g" . org-roam-ui-mode)
301 ("C-c n c" . org-roam-capture)
302 ("C-c n j" . org-roam-dailies-capture-today))
303 :config
304 (setq org-roam-node-display-template
305 (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
306 (org-roam-setup)
307 (require 'org-roam-protocol))
308
309 (use-package org-roam-ui
310 :after org-roam
311 :config
312 (setq org-roam-ui-sync-theme t
313 org-roam-ui-follow t
314 org-roam-ui-update-on-save t
315 org-roam-ui-open-on-start t))
316
317 ;;; Happy hacking! ;;;