init.el 8.7 KB

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