summaryrefslogtreecommitdiff
path: root/init.el
blob: cb3e098b77c23cb8a0059286ee1ebf8cdd07e9f8 (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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
;;; Use package initialization.
;;; WARNING: Install use-package BEFORE uncommenting these lines.
(eval-when-compile
  (require 'use-package))

(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-enabled-themes '(doom-oceanic-next))
 '(custom-safe-themes
   '("c5878086e65614424a84ad5c758b07e9edcf4c513e08a1c5b1533f313d1b17f1"
     "9013233028d9798f901e5e8efb31841c24c12444d3b6e92580080505d56fd392"
     "34cf3305b35e3a8132a0b1bdf2c67623bc2cb05b125f8d7d26bd51fd16d547ec"
     "7c28419e963b04bf7ad14f3d8f6655c078de75e4944843ef9522dbecfcd8717d"
     "571661a9d205cb32dfed5566019ad54f5bb3415d2d88f7ea1d00c7c794e70a36"
     "f5f80dd6588e59cfc3ce2f11568ff8296717a938edd448a947f9823a4e282b66"
     "37b6695bae243145fa2dfb41440c204cd22833c25cd1993b0f258905b9e65577"
     "df6dfd55673f40364b1970440f0b0cb8ba7149282cf415b81aaad2d98b0f0290"
     "4990532659bb6a285fee01ede3dfa1b1bdf302c5c3c8de9fad9b6bc63a9252f7"
     "f4d1b183465f2d29b7a2e9dbe87ccc20598e79738e5d29fc52ec8fb8c576fcfd"
     "c8b3d9364302b16318e0f231981e94cbe4806cb5cde5732c3e5c3e05e1472434"
     "38c0c668d8ac3841cb9608522ca116067177c92feeabc6f002a27249976d7434"
     "dd4582661a1c6b865a33b89312c97a13a3885dc95992e2e5fc57456b4c545176"
     "691d671429fa6c6d73098fc6ff05d4a14a323ea0a18787daeb93fde0e48ab18b"
     "c1d5759fcb18b20fd95357dcd63ff90780283b14023422765d531330a3d3cec2"
     "32f22d075269daabc5e661299ca9a08716aa8cda7e85310b9625c434041916af"
     "dfb1c8b5bfa040b042b4ef660d0aab48ef2e89ee719a1f24a4629a0c5ed769e8"
     "02d422e5b99f54bd4516d4157060b874d14552fe613ea7047c4a5cfa1288cf4f"
     "8c7e832be864674c220f9a9361c851917a93f921fedb7717b1b5ece47690c098"
     "7ec8fd456c0c117c99e3a3b16aaf09ed3fb91879f6601b1ea0eeaee9c6def5d9"
     "13096a9a6e75c7330c1bc500f30a8f4407bd618431c94aeab55c9855731a95e1"
     "8b148cf8154d34917dfc794b5d0fe65f21e9155977a36a5985f89c09a9669aa0"
     "456697e914823ee45365b843c89fbc79191fdbaff471b29aad9dcbe0ee1d5641"
     "6f1f6a1a3cff62cc860ad6e787151b9b8599f4471d40ed746ea2819fcd184e1a"
     "d6b934330450d9de1112cbb7617eaf929244d192c4ffb1b9e6b63ad574784aad"
     "4ade6b630ba8cbab10703b27fd05bb43aaf8a3e5ba8c2dc1ea4a2de5f8d45882"
     "4e2e42e9306813763e2e62f115da71b485458a36e8b4c24e17a2168c45c9cf9d"
     "dccf4a8f1aaf5f24d2ab63af1aa75fd9d535c83377f8e26380162e888be0c6a9"
     "b5fd9c7429d52190235f2383e47d340d7ff769f141cd8f9e7a4629a81abc6b19"
     "014cb63097fc7dbda3edf53eb09802237961cbb4c9e9abd705f23b86511b0a69"
     "4c7a1f0559674bf6d5dd06ec52c8badc5ba6e091f954ea364a020ed702665aa1"
     "a6920ee8b55c441ada9a19a44e9048be3bfb1338d06fc41bce3819ac22e4b5a1"
     "ddffe74bc4bf2c332c2c3f67f1b8141ee1de8fd6b7be103ade50abb97fe70f0c"
     "00cec71d41047ebabeb310a325c365d5bc4b7fab0a681a2a108d32fb161b4006"
     "1a1ac598737d0fcdc4dfab3af3d6f46ab2d5048b8e72bc22f50271fd6d393a00"
     "7e068da4ba88162324d9773ec066d93c447c76e9f4ae711ddd0c5d3863489c52"
     "7ea883b13485f175d3075c72fceab701b5bf76b2076f024da50dff4107d0db25"
     "8d3ef5ff6273f2a552152c7febc40eabca26bae05bd12bc85062e2dc224cde9a"
     "b54376ec363568656d54578d28b95382854f62b74c32077821fdfd604268616a"
     "3fe1ebb870cc8a28e69763dde7b08c0f6b7e71cc310ffc3394622e5df6e4f0da"
     "b99e334a4019a2caa71e1d6445fc346c6f074a05fcbb989800ecbe54474ae1b0"
     "a9abd706a4183711ffcca0d6da3808ec0f59be0e8336868669dc3b10381afb6f"
     "8d8207a39e18e2cc95ebddf62f841442d36fcba01a2a9451773d4ed30b632443"
     "251ed7ecd97af314cd77b07359a09da12dcd97be35e3ab761d4a92d8d8cf9a71"
     "be84a2e5c70f991051d4aaf0f049fa11c172e5d784727e0b525565bb1533ec78"
     "b9761a2e568bee658e0ff723dd620d844172943eb5ec4053e2b199c59e0bcc22"
     "9d29a302302cce971d988eb51bd17c1d2be6cd68305710446f658958c0640f68"
     "2721b06afaf1769ef63f942bf3e977f208f517b187f2526f0e57c1bd4a000350"
     "da75eceab6bea9298e04ce5b4b07349f8c02da305734f7c0c8c6af7b5eaa9738"
     "f053f92735d6d238461da8512b9c071a5ce3b9d972501f7a5e6682a90bf29725"
     "ff24d14f5f7d355f47d53fd016565ed128bf3af30eb7ce8cae307ee4fe7f3fd0"
     "991ca4dbb23cab4f45c1463c187ac80de9e6a718edc8640003892a2523cb6259"
     "1aa4243143f6c9f2a51ff173221f4fd23a1719f4194df6cef8878e75d349613d"
     "dc8285f7f4d86c0aebf1ea4b448842a6868553eded6f71d1de52f3dcbc960039"
     "2853dd90f0d49439ebd582a8cbb82b9b3c2a02593483341b257f88add195ad76"
     "5586a5db9dadef93b6b6e72720205a4fa92fd60e4ccfd3a5fa389782eab2371b"
     "683b3fe1689da78a4e64d3ddfce90f2c19eb2d8ab1bab1738a63d8263119c3f4"
     "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2"
     "467dc6fdebcf92f4d3e2a2016145ba15841987c71fbe675dcfe34ac47ffb9195"
     "4ff1c4d05adad3de88da16bd2e857f8374f26f9063b2d77d38d14686e3868d8d"
     "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc"
     "016f665c0dd5f76f8404124482a0b13a573d17e92ff4eb36a66b409f4d1da410"
     "49acd691c89118c0768c4fb9a333af33e3d2dca48e6f79787478757071d64e68"
     "eca44f32ae038d7a50ce9c00693b8986f4ab625d5f2b4485e20f22c47f2634ae"
     "aec7b55f2a13307a55517fdf08438863d694550565dee23181d2ebd973ebd6b8"
     "2e05569868dc11a52b08926b4c1a27da77580daa9321773d92822f7a639956ce"
     "512ce140ea9c1521ccaceaa0e73e2487e2d3826cc9d287275550b47c04072bc4"
     "bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e"
     "680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426"
     "a44e2d1636a0114c5e407a748841f6723ed442dc3a0ed086542dc71b92a87aee"
     "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b"
     "a138ec18a6b926ea9d66e61aac28f5ce99739cf38566876dc31e29ec8757f6e2"
     "2dd4951e967990396142ec54d376cced3f135810b2b69920e77103e0bcedfba9"
     "6945dadc749ac5cbd47012cad836f92aea9ebec9f504d32fe89a956260773ca4"
     "7a424478cb77a96af2c0f50cfb4e2a88647b3ccca225f8c650ed45b7f50d9525"
     "18624b2da7749af193a4eeaa7be1dc2abe94a97a8562ba69f5ee0f06d6dd156e"
     default))
 '(elfeed-feeds
   '("https://news.nononsenseapps.com/index.atom"
     "https://archlinux.org/feeds/news/"
     "https://www.propublica.org/feeds/propublica/main"
     "https://www.badgamehalloffame.com/feed"
     "https://lablogdeloto.wordpress.com/atom"
     "https://gatooscuro.xyz/rss"
     "https://ephemeralenigmascom.wordpress.com/feed"
     "https://esculpiendoeltiempocomtech.com/feed"
     "https://itsfoss.com/rss/"
     "https://kimimithegameeatingshemonster.com/feed"
     "https://silosneeded.com/feed.xml"
     "https://yosoyira.medium.com/feed" "https://thatsnot.fun/rss/"
     "https://bss.zone/feed/rss" "https://r3d.mx/rss"
     "https://ff8isthe.best/rss" "https://pluralistic.net/rss"
     "https://solar.lowtechmagazine.com/posts/index.xml"
     "https://moddedbear.com/blog/index.xml"
     "https://benjaminhollon.com/musings/feed"
     "https://thatsnot.fun/rss" "https://utf9k.net/rss.xml"
     "http://www.aaronsw.com/2002/feeds/pgessays.rss"
     "https://simonwillison.net/atom/everything/"
     "https://niclake.me/feed" "https://aint.johnmark.org/feed/"
     "https://lucumr.pocoo.org/feed.atom"
     "https://blog.dshr.org/feeds/posts/default"
     "https://adactio.com/rss/"))
 '(flycheck-disabled-checkers '(python-mypy python-pylint))
 '(global-display-line-numbers-mode t)
 '(org-babel-load-languages '((awk . t) (emacs-lisp . t) (python . t) (ruby . t)))
 '(package-selected-packages
   '(all-the-icons blackboard-theme cmake-mode company dape dashboard
		   doom-themes elfeed elfeed-dashboard elfeed-goodies
		   elfeed-web elixir-mode flycheck flycheck-hledger
		   flycheck-inline helm hledger-mode jinja2-mode magit
		   markdown-mode org-babel org-modern page-break-lines
		   plantuml-mode po-mode polymode projectile pyvenv
		   realgud realgud-ipdb restclient scad-mode
		   subatomic-theme tagedit treemacs
		   treemacs-all-the-icons treemacs-magit
		   treemacs-projectile web-mode yaml-mode yasnippet
		   yasnippet-snippets znc))
 '(znc-servers
   '(("silosneeded.com" 6697 t
      ((liberachat "luis_sebastian/liberachat"
		   "PapiEsteYaEsMiBouncerEOO"))))))
(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 (:family "SourceCodeVF" :foundry "ADBO" :slant normal :weight regular :height 140 :width normal)))))

;;; Hide toolbar, menu bar and scroll bar.
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

;;; Enable line numbers globally
(global-display-line-numbers-mode 1) ;; enable line numbers globally
(setq linum-format "%4d \u2502 ")  ;; format line number spacing

;;; MELPA setup.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)

;; Refresh the packages available.
(unless package-archive-contents
  (package-refresh-contents))

;;; Package listing and installation.
;;; Add the packages you wish emacs to install here.
(defvar myPackages
  '(helm
    subatomic-theme
    doom-themes
    all-the-icons
    use-package
    page-break-lines
    projectile
    dashboard
    flycheck
    flycheck-inline
    company
    pyvenv
    org-modern
    jinja2-mode
    yasnippet
    yasnippet-snippets
    plantuml-mode
    magit
    restclient
    treemacs
    treemacs-projectile
    treemacs-magit
    treemacs-all-the-icons
    magit
    tagedit
    web-mode
    markdown-mode
    elfeed
    elfeed-goodies
    elfeed-dashboard
    elfeed-web
    dape
    znc
    yaml-mode
    hledger-mode
    flycheck-hledger
    scad-mode
    cmake-mode
    blackboard-theme
    page-break-lines
    elixir-mode
    po-mode
    polymode
    ))

;; Install the packages.
(mapc #'(lambda (package)
	  (unless (package-installed-p package)
	    (package-install package)))
      myPackages)

;;; Helm configuration.
(helm-mode 1)
(global-set-key (kbd "C-x C-f") 'helm-find-files)

;;; Windmove configuration
(global-set-key (kbd "s-<down>") 'windmove-down)

;; Rebind tab for helm completion.
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
;; Make tab work in terminal
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
;; Open helm buffer inside current window.
(setq helm-split-window-inside-p t)
;; Move to end or beginning of source when reaching top or bottom of source.
(setq helm-move-to-line-cycle-in-source t)
;; Search for library in `require' and `declare-function' sexp.
(setq helm-ff-search-library-in-sexp t)
;; Scroll 8 lines other window using M-<next>/M-<prior>
(setq helm-scroll-amount 8)
(setq helm-ff-file-name-history-use-recentf t)
(setq helm-echo-input-in-header-line t)

;;; All-the-icons configuration.
(use-package all-the-icons
  :if (display-graphic-p))


;;; Projectile configuration
(use-package projectile
  :ensure t
  :init
  (projectile-mode +1)
  :bind (:map projectile-mode-map
	      ("C-c p" . projectile-command-map)))

;;; Dashboard configuration.
(use-package dashboard
  :ensure t
  :config
  (dashboard-setup-startup-hook)
  :custom
  (dashboard-startup-banner "~/.emacs.d/moebius.png")
  (dashboard-banner-logo-title "All of them have ribbon insignias!")
  (dashboard-center-content t)
  (dashboard-icon-type 'all-the-icons)
  (dashboard-set-heading-icons t)
  (dashboard-set-file-icons t)
  (dashboard-items '((recents . 5)
		     (projects . 1))))

;;; Flycheck configuration.
(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

;; Disable checkers
;; (setq-default flycheck-disabled-checkers '(python-mypy))

;; Enable flycheck inline.
(with-eval-after-load 'flycheck
  (add-hook 'flycheck-mode-hook #'flycheck-inline-mode))

;;; Company mode configuration.
(add-hook 'after-init-hook 'global-company-mode)

;;; Eglot modes.

;; C mode
(add-hook 'c-mode-hook 'eglot-ensure)

;; C++ mode
(add-hook 'c++-mode-hook 'eglot-ensure)

;; Python mode
(add-hook 'python-mode-hook 'eglot-ensure)

(require 'eglot)

;; OpenSCAD mode
(add-to-list 'eglot-server-programs '(scad-mode "/home/luis/.cargo/bin/openscad-lsp" "--stdio"))
(add-hook 'scad-mode 'eglot-ensure)

;; Elixir mode
(add-hook 'elixir-mode-hook 'eglot-ensure)

(add-to-list 'eglot-server-programs '(elixir-mode "/home/luis/Programs/elixir-ls-v0.23.0/language_server.sh"))

;; C/C++ mode - load compile commands
(add-to-list 'eglot-server-programs '(c-mode "clangd" "--compile-commands-dir=./build/"))

(add-to-list 'eglot-server-programs '(c++-mode "clangd" "--compile-commands-dir=./build/"))

;; RP2040's PIO (poly)mode
(define-hostmode poly-pio-hostmode
  :mode 'asm-mode)

(define-innermode poly-pio-c-innermode
  :mode 'c-mode
  :head-matcher "^% c-sdk {$"
  :tail-matcher "^%}$"
  :head-mode 'host
  :tail-mode 'host)

(define-polymode poly-pio-mode
  :hostmode 'poly-pio-hostmode
  :innermodes '(poly-pio-c-innermode))

(add-to-list 'auto-mode-alist '("\\.pio$" . poly-pio-mode))

;;; Web mode and eglot
(require 'web-mode)
;; Liquid
(define-derived-mode liquid-mode web-mode "liquid"
  "A major mode for editing liquid files.")
(add-to-list 'auto-mode-alist '("\\.liquid\\'" . liquid-mode))
(add-hook 'liquid-mode-hook #'eglot-ensure)
(add-to-list 'eglot-server-programs '(liquid-mode "vscode-html-language-server" "--stdio"))
;; Css
(define-derived-mode lsp-css-mode web-mode "lspCSS"
  "A major mode for editing CSS files, with LSP support.")
(add-to-list 'auto-mode-alist '("\\.css\\'" . lsp-css-mode))
(add-hook 'lsp-css-mode-hook #'eglot-ensure)
(add-to-list 'eglot-server-programs '(lsp-css-mode "vscode-css-language-server" "--stdio"))

;; JavaScript mode
(add-hook 'js-mode-hook 'eglot-ensure)


;;; Org mode configuration
(setq org-hide-emphasis-markers t
      org-pretty-entities t
      org-auto-align-tags nil
      org-tags-column 0
      org-ellipsis "…"
      org-catch-invisible-edits 'show-and-error
      org-special-ctrl-a/e t
      org-insert-heading-respect-content t)

;; Setup org-modern globally.
(with-eval-after-load 'org (global-org-modern-mode))

;;; Mode global enabling.
(add-to-list 'auto-mode-alist '("\\.jinja\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.uml\\'" . plantuml-mode))
(add-to-list 'auto-mode-alist '("\\.journal\\'" . hledger-mode))
(add-to-list 'auto-mode-alist '("\\.scad\\'" . scad-mode))

;;; YASnippets configuration
(add-to-list 'load-path
	     "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)

;;; Treemacs configuration
(keymap-global-set "C-c b" 'treemacs)
(require 'treemacs-all-the-icons)
(treemacs-load-theme "all-the-icons")


;;; PlantUML mode configuration
(setq plantuml-jar-path "~/.emacs.d/plantuml-1.2024.4.jar")
(setq plantuml-default-exec-mode 'jar)

;;; Dape configuration
(require 'dape)
;; Dape configs
(add-to-list 'dape-configs
	     `(debugpy-flask
	       modes (python-mode jinja2-mode)
	       command "python"
	       command-args ["-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport]
	       port :autoport
	       :type "python"
	       :request "launch"
	       :module "flask"
	       :args ["--app" "src/main" "run" "--no-debugger" "--no-reload"]
	       :console "integratedTerminal"
	       :showReturnValue t
	       :justMyCode nil
	       :jinja t
	       :cwd dape-cwd-fn))

;;; znc-erc configuration
(require 'znc)

;;; Flyspell configuration
(dolist (hook '(markdown-mode-hook))
  (add-hook hook (lambda () (flyspell-mode 1))))

(setq ispell-dictionary "es")
(setq ispell-program-name "aspell")
(setq ispell-silently-savep t)

(defun flyspell-spanish ()
  (interactive)
  (ispell-change-dictionary "default")
  (flyspell-buffer))

(defun flyspell-english ()
  (interactive)
  (ispell-change-dictionary "en")
  (flyspell-buffer))

;;; Hledger-mode
(setq hledger-jfile "/home/luis/Documents/Finanzas/2024.journal")

;;; GDB
(setq gdb-many-windows t gdb-show-main t)

;;; init.el ends here