README.org 22.9 KB
Newer Older
Benjamin James's avatar
Benjamin James committed
1
2
3
4
5
6
7
#+TITLE: My Emacs Configuration
#+OPTIONS: toc:nil num:nil

* Init.el
#+begin_src emacs-lisp :tangle init.el
(add-to-list 'load-path (expand-file-name "recipes/" (file-name-directory load-file-name)))
(require 'package-management-rcp)
8
(require 'async-rcp)
Benjamin James's avatar
Benjamin James committed
9
(require 'default-rcp)
Benjamin James's avatar
Benjamin James committed
10
11
(require 'theme-rcp)  
(require 'ligatures-rcp)
Benjamin James's avatar
Benjamin James committed
12
13
14
15
(require 'evil-rcp)
(require 'helpful-rcp)
(require 'counsel-rcp)
(require 'org-rcp)
Benjamin James's avatar
Benjamin James committed
16
(require 'org-roam-rcp)
Benjamin James's avatar
Benjamin James committed
17
18
19
(require 'ivy-rcp)
(require 'snippets-rcp)
(require 'company-rcp)
20
(require 'company-local-rcp)
Benjamin James's avatar
Benjamin James committed
21
22
23
(require 'lsp-rcp)
(require 'rustic-rcp)
(require 'ccls-rcp)
Benjamin James's avatar
Benjamin James committed
24
25
(require 'haskell-rcp)
(require 'python-rcp)
Benjamin James's avatar
Benjamin James committed
26
27
(require 'treesitter-rcp)
(require 'projectile-rcp)
Benjamin James's avatar
Benjamin James committed
28
29
(require 'keybinds-rcp)
(require 'which-key-rcp)
30
(require 'spellcheck-rcp)
Benjamin James's avatar
Benjamin James committed
31
(require 'email-rcp)
Benjamin James's avatar
Benjamin James committed
32
33
34
35
#+end_src

* default-rcp
#+begin_src emacs-lisp :tangle recipes/default-rcp.el
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
(setq inhibit-startup-message t)        ;; Disable startup messages
(scroll-bar-mode -1)                    ;; Disable the scroll bar
(tool-bar-mode -1)                      ;; Disable the tool bar
(tooltip-mode -1)                       ;; Disable tooltips
(set-fringe-mode 5)                     ;; Give some breathing room
(menu-bar-mode -1)                      ;; Diable menubar
(recentf-mode 0)
(electric-pair-mode 1)                  ;; Enable automatically adding pair brackets

(use-package rainbow-delimiters         ;; Enable color for pair brackets
  :ensure t
  :defer t
  :hook ((prog-mode org-src-mode) . rainbow-delimiters-mode)
  :config (rainbow-delimiters-mode t))

(setq backup-directory-alist '(("." . "~/MyEmacsBackups")))

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
  (load custom-file))

(setq mouse-wheel-scroll-amount '(2 ((shift) . 1))) ;; Five line at a time
(setq mouse-wheel-progressive-speed nil)            ;; don't accelarate scrolling
(setq mouse-wheel-follow-mouse 't)                  ;; scroll window under mouse
(setq scroll-step 1)                                ;; Keyboard scrolling set to one line at a time

(column-number-mode 1)
(global-display-line-numbers-mode t)
(setq display-line-numbers-type 'relative)
;; Enable line numbers in specifiv modes
(dolist (mode '(text-mode-hook
    prog-mode-hook
    cond-mode-hook))
  (add-hook mode (lambda () (display-line-numbers-mode 1))))

(setq-default indent-tabs-mode nil
    tab-width 4)

(setq-default tab-always-indent nil)

(setq tabify-regexp "^\t* [ \t]+")

Benjamin James's avatar
Benjamin James committed
78
79
80
81
82
83
84
85
86
87
(fset 'yes-or-no-p 'y-or-n-p)

(setq require-final-newline t)

(setq next-line-add-newlines nil)

(setq message-log-max 100)

(require 'paren) (show-paren-mode t)

88
(provide 'default-rcp)
Benjamin James's avatar
Benjamin James committed
89
90
#+end_src

Benjamin James's avatar
Benjamin James committed
91
92
93
* Keybinds
#+begin_src emacs-lisp :tangle recipes/keybinds-rcp.el
(global-set-key (kbd "C-x C-b") 'ibuffer)
94
(global-set-key (kbd "M-s") 'flyspell-correct-at-point)
Benjamin James's avatar
Benjamin James committed
95
96
(provide 'keybinds-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
* Package management
#+begin_src emacs-lisp :tangle recipes/package-management-rcp.el
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("melpa-stable" . "https://stable.melpa.org/packages/")
                         ("org" . "https://orgmode.org/elpa/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))

(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

(package-install 'use-package)

(provide 'package-management-rcp)
#+end_src

* Themes
#+begin_src emacs-lisp :tangle recipes/theme-rcp.el
115
;; Theme
Benjamin James's avatar
Benjamin James committed
116
117
118
119
120
121
122
(use-package doom-themes
  :ensure t
  :config
  (load-theme 'doom-acario-dark t)      ;; Setting theme name
  (doom-themes-visual-bell-config)      ;; Enabling flahing modeline for errors
  (doom-themes-org-config))             ;; Corrects org-mode's native fontification.

123
;; Modeline theme
Benjamin James's avatar
Benjamin James committed
124
125
126
127
128
(use-package doom-modeline
  :ensure t
  :init (doom-modeline-mode 1)
  :custom ((doom-modeline-height 15)))

129
;; Fonts
Benjamin James's avatar
Benjamin James committed
130
(defun daemon/set-font-faces ()
131
  ;; Transperent background
Benjamin James's avatar
Benjamin James committed
132
133
  (set-frame-parameter (selected-frame) 'alpha '(90 90))
  (add-to-list 'default-frame-alist '(alpha 90 90))
134
  
Benjamin James's avatar
Benjamin James committed
135
136
137
138
  ;; Setting default font
  (set-face-attribute 'default nil
                      :family "JetBrainsMono"
                      :weight 'light
139
                      :foreground "white"
Benjamin James's avatar
Benjamin James committed
140
141
142
143
144
145
                      :height 130)

  ;; Setting fixed pitched font
  (set-face-attribute 'fixed-pitch nil
                      :family "JetBrainsMono"
                      :weight 'light
146
                      :foreground "white"
Benjamin James's avatar
Benjamin James committed
147
148
149
150
151
152
                      :height 130)

;; Setting variable pitched font
  (set-face-attribute 'variable-pitch nil
                      :family "Iosevka Aile"
                      :weight 'regular
153
                      :foreground "white"
Benjamin James's avatar
Benjamin James committed
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
                      :height 140))

(if (daemonp)
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (setq doom-modeline-icon t)
                (with-selected-frame frame
                  (daemon/set-font-faces))))
  (daemon/set-font-faces))

(provide 'theme-rcp)
#+end_src

* Evil
#+begin_src emacs-lisp :tangle recipes/evil-rcp.el
(use-package undo-tree
170
  :ensure t
Benjamin James's avatar
Benjamin James committed
171
172
173
174
175
  :init
  (setq evil-undo-system 'undo-tree)
  :config
  (setq undo-limit 400000           ; 400kb (default is 160kb)
        undo-strong-limit 3000000   ; 3mb   (default is 240kb)
Benjamin James's avatar
Benjamin James committed
176
177
        undo-outer-limit 48000000)  ; 48mb  (default is 24mb)
  (global-undo-tree-mode t))
Benjamin James's avatar
Benjamin James committed
178
179

(use-package evil
180
  :ensure t
181
  :defer t
Benjamin James's avatar
Benjamin James committed
182
183
  :init
  (setq evil-want-integration t)
Benjamin James's avatar
Benjamin James committed
184
  (setq evil-want-fine-undo t)
Benjamin James's avatar
Benjamin James committed
185
186
187
188
189
190
191
192
193
194
  (setq evil-want-keybinding t)
  (setq evil-respect-visual-line-mode t)
  (setq evil-want-fine-undo t) 
  (evil-mode 1))
(provide 'evil-rcp)
#+end_src

* Which key
#+begin_src emacs-lisp :tangle recipes/which-key-rcp.el
(use-package which-key
195
  :ensure t
196
  :defer t
Benjamin James's avatar
Benjamin James committed
197
198
199
200
201
202
203
204
205
  :init
  (setq which-key-sort-order #'which-key-key-order-alpha
        which-key-sort-uppercase-first nil
        which-key-add-column-padding 1
        which-key-max-display-columns nil
        which-key-min-display-lines 6
        which-key-side-window-slot -10)
  :hook (doom-first-input . which-key-mode)
  :config
Benjamin James's avatar
Benjamin James committed
206
207
  (setq which-key-idle-delay 0.1))
(which-key-mode)
Benjamin James's avatar
Benjamin James committed
208
209
210
211
212
213
(provide 'which-key-rcp)
#+end_src

* Counsel
  #+begin_src emacs-lisp :tangle recipes/counsel-rcp.el
(use-package counsel
214
  :ensure t
215
  :defer t
Benjamin James's avatar
Benjamin James committed
216
  :bind (("M-x" . counsel-M-x)
217
218
219
220
221
222
         ("<menu>" . counsel-M-x)
         ("C-x b" . counsel-switch-buffer)
         ("C-x C-f" . counsel-find-file)
         ("C-x d" . counsel-dired)
         :map minibuffer-local-map
         ("C-r" . 'counsel-minibuffer-history))
Benjamin James's avatar
Benjamin James committed
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  :config
  (setq ivy-initial-inputs-alist nil))
(provide 'counsel-rcp)
  #+end_src

* Helpful
#+begin_src emacs-lisp :tangle recipes/helpful-rcp.el
(use-package helpful
  :ensure t
  :defer t
  :bind
  ([remap describe-callable]    . helpful-callable)
  ([remap describe-function]    . helpful-function)
  ([remap describe-variable]    . helpful-variable)
  ([remap describe-key]         . helpful-key)
  ([remap view-emacs-debugging] . helpful-at-point))

(provide 'helpful-rcp)
#+end_src
* Indent Guide
#+begin_src emacs-lisp :tangle recipes/indent-guide-rcp.el
(use-package highlight-indent-guides
245
  :ensure t
246
  :defer t
Benjamin James's avatar
Benjamin James committed
247
248
249
250
251
252
253
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character
        highlight-indent-guides-supress-auto-error t))
#+end_src
* Snippets
#+begin_src emacs-lisp :tangle recipes/snippets-rcp.el
254
255
256
257
258
259
260
261
(use-package yasnippet-snippets                          
  :ensure t                                              
  :defer t)                                              
                                                         
(use-package yasnippet                                   
  :ensure t                                              
  :defer t                                               
  :init (setq yas-snippet-dirs '("~/.config/emacs/snippets"))
Benjamin James's avatar
Benjamin James committed
262
263
264
265
266
267
268
269
  :config
  (add-hook 'prog-mode-hook #'yas-minor-mode)
  (yas-reload-all))

(provide 'snippets-rcp)
#+end_src
* Org
#+begin_src emacs-lisp :tangle recipes/org-rcp.el
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
(defun efs/org-font-setup ()
  (font-lock-add-keywords 'org-mode
                          '(("^ *\\([-]\\) "
                             (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))

  (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0))
  
  ;; Set faces for heading levels
  (set-face-attribute 'org-document-title nil :font "Iosevka Aile" :weight 'bold :height 1.3)
  (dolist (face '((org-level-1 . 1.2)
                (org-level-2 . 1.1)
                (org-level-3 . 1.05)
                (org-level-4 . 1.0)
                (org-level-5 . 1.1)
                (org-level-6 . 1.1)
                (org-level-7 . 1.1)
                (org-level-8 . 1.1)))
  (set-face-attribute (car face) nil :font "Iosevka Aile" :weight 'regular :height (cdr face)))

;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil    :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil    :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil  :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil     :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil    :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil  :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))

;;(setq org-latex-listings 'minted
;;      org-latex-packages-alist '(("" "minted"))
;;      org-latex-pdf-process
;;      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

;; Turn on indentation and auto-fill mode for Org files
(defun efs/org-mode-setup ()
      (org-indent-mode)
      (variable-pitch-mode 1)
      (auto-fill-mode 0)
      (visual-line-mode 1)
      (display-line-numbers-mode 0)
      (setq evil-auto-indent nil))

(use-package org
  :ensure t
  :defer t
  :hook (org-mode . efs/org-mode-setup)
  :config
  (setq org-ellipsis " ▾"
        org-hide-emphasis-markers t
        org-src-fontify-natively t
        org-fontify-quote-and-verse-blocks t
        org-src-tab-acts-natively 1
        org-edit-src-content-indentation 2
        org-hide-block-startup nil
        org-src-preserve-indentation 1
        org-startup-folded 'content)
  (efs/org-font-setup))

(defun efs/org-mode-visual-fill ()
  (setq visual-fill-column-width 115
        visual-fill-column-center-text t)
  (visual-fill-column-mode 1))

(use-package visual-fill-column
  :ensure t
  :defer t
  :defer t
  :hook (org-mode . efs/org-mode-visual-fill))

(use-package org-bullets
  :ensure t
  :defer t
  :after org
  :hook (org-mode . org-bullets-mode)
  :custom
  (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))

(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src sh"))
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("sc" . "src scheme"))
(add-to-list 'org-structure-template-alist '("ts" . "src typescript"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
(add-to-list 'org-structure-template-alist '("go" . "src go"))
(add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))
(add-to-list 'org-structure-template-alist '("json" . "src json"))
(add-to-list 'org-structure-template-alist '("latex" . "src latex"))

(setq org-latex-create-formula-image-program 'dvisvgm)
(plist-put org-format-latex-options :justify 'center)
365
366
367
368

(use-package ox-pandoc
  :ensure t)

Benjamin James's avatar
Benjamin James committed
369
370
371
(provide 'org-rcp)
#+end_src

Benjamin James's avatar
Benjamin James committed
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
* Org roam
#+begin_src emacs-lisp :tangle recipes/org-roam-rcp.el
(use-package org-roam
  :ensure t
  :defer t
  :init
  (setq org-roam-v2-ack t)
  :custom
  (org-roam-directory "~/Documents/RoamNotes")
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert))
  :config
  (org-roam-setup))
(provide 'org-roam-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
388
389
390
* Ivy
#+begin_src emacs-lisp :tangle recipes/ivy-rcp.el
(use-package ivy
391
  :ensure t
392
  :defer t
Benjamin James's avatar
Benjamin James committed
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
  :bind (("C-s" . swiper)
         :map ivy-minibuffer-map
         ("TAB" . ivy-alt-done)
         ("C-f" . ivy-alt-done)
         ("C-l" . ivy-alt-done)
         ("C-j" . ivy-next-line)
         ("C-k" . ivy-previous-line)
         :map ivy-switch-buffer-map
         ("C-k" . ivy-previous-line)
         ("C-l" . ivy-done)
         ("C-d" . ivy-switch-buffer-kill)
         :map ivy-reverse-i-search-map
         ("C-k" . ivy-previous-line)
         ("C-d" . ivy-reverse-i-search-kill))
  :init
  (ivy-mode 1)
  :config
  (setq ivy-use-virtual-buffers t)
  (setq ivy-wrap t)
  (setq ivy-count-format "(%d/%d) ")
  (setq enable-recursive-minibuffers t)

  ;; Use different regex strategies per completion command
  (push '(completion-at-point . ivy--regex-fuzzy) ivy-re-builders-alist) ;; This doesn't seem to work...
  (push '(swiper . ivy--regex-ignore-order) ivy-re-builders-alist)
  (push '(counsel-M-x . ivy--regex-ignore-order) ivy-re-builders-alist)

  ;; Set minibuffer height for different commands
  (setf (alist-get 'counsel-projectile-ag ivy-height-alist) 15)
  (setf (alist-get 'counsel-projectile-rg ivy-height-alist) 15)
  (setf (alist-get 'swiper ivy-height-alist) 15)
  (setf (alist-get 'counsel-switch-buffer ivy-height-alist) 7))

(use-package ivy-rich
427
  :ensure t
428
  :defer t
Benjamin James's avatar
Benjamin James committed
429
430
431
432
433
434
435
436
  :init
  (ivy-rich-mode 1))

(provide 'ivy-rcp)
#+end_src
* Company
#+begin_src emacs-lisp :tangle recipes/company-rcp.el
(use-package company
437
  :ensure t
438
  :defer t
Benjamin James's avatar
Benjamin James committed
439
440
441
442
443
  :hook
  ((prog-mode text-mode lisp-interaction-mode) . company-mode)
  :bind
  (:map company-active-map ("<tab>" . company-complete-common-or-cycle))
  :config
444
445
446
447
448
449
450
451
452
453
  (setq company-minimum-prefix-length 1)
  ;;(setq company-backends '(company-capf
  ;;                         company-yasnippet
  ;;                         company-keywords
  ;;                         company-files
  ;;                         company-elisp
  ;;                         company-ispell
  ;;                         company-semantic
  ;;                         company-dabbrev
  ;;                         company-dabbrev-code))
Benjamin James's avatar
Benjamin James committed
454
455
456
457
458
459
460
461
462
  ;;(setq company-tooltip-maximum-width 60)
  (company-mode 1)
  :custom
  (company-format-margin-function    #'company-vscode-dark-icons-margin)
  (company-idle-delay 0.1)
  (company-echo-delay 0.1))
(provide 'company-rcp)
#+end_src

463
464
465
466
467
468
* Company localized
#+begin_src emacs-lisp :tangle recipes/company-local-rcp.el
(defun company-emacs-lisp-mode ()
  "Set up `company-mode' for `emacs-lisp-mode'."
  (set (make-local-variable 'company-backends)
       '((company-yasnippet
Benjamin James's avatar
Benjamin James committed
469
          company-capf
470
471
472
          company-elisp
          company-dabbrev-code
          company-files))))
Benjamin James's avatar
Benjamin James committed
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491

(defun company-rustic-mode ()
  "Set up `company-mode' for `rustic-mode'."
  (set (make-local-variable 'company-backends)
       '((company-yasnippet
          company-capf
          company-keywords
          company-dabbrev-code
          company-files))))

(defun company-cc-mode ()
  "Set up `company-mode' for `c-common-mode'."
  (set (make-local-variable 'company-backends)
       '((company-yasnippet
          company-capf
          company-keywords
          company-dabbrev-code
          company-files))))

492
(add-hook 'emacs-lisp-mode-hook 'company-emacs-lisp-mode)
Benjamin James's avatar
Benjamin James committed
493
494
495
(add-hook 'rustic-mode-hook 'company-rustic-mode)
(add-hook 'c-mode 'company-cc-mode)
(add-hook 'c++-mode 'company-cc-mode)
496
497
498

(provide 'company-local-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
499
500
501
* Rustic
#+begin_src emacs-lisp :tangle recipes/rustic-rcp.el
(use-package rustic
502
  :ensure t
503
  :defer t
Benjamin James's avatar
Benjamin James committed
504
505
506
507
508
509
510
511
512
  :config
  (setq rustic-format-on-save 1)
  (setq rustic-lsp-server 'rls))
(provide 'rustic-rcp)
#+end_src
* CCLS
#+begin_src emacs-lisp :tangle recipes/ccls-rcp.el
(use-package ccls
  :ensure t
513
  :defer t
Benjamin James's avatar
Benjamin James committed
514
515
516
517
  :hook
  ((c-mode c++-mode objc-mode) . (lambda () (require 'ccls) (lsp))))
(provide 'ccls-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
518
519
520
* Haskell
#+begin_src emacs-lisp :tangle recipes/haskell-rcp.el
(use-package lsp-haskell
521
  :ensure t
522
  :defer t
Benjamin James's avatar
Benjamin James committed
523
524
525
526
527
528
529
530
531
532
  :config
  (add-hook 'haskell-mode-hook #'lsp)
  (add-hook 'haskell-doc-mode #'lsp)
  (add-hook 'haskell-literate-mode #'lsp))
(provide 'haskell-rcp)
#+end_src
* Python
#+begin_src emacs-lisp :tangle recipes/python-rcp.el
(use-package lsp-pyright
  :ensure t
533
  :defer t
Benjamin James's avatar
Benjamin James committed
534
535
536
537
538
  :hook (python-mode . (lambda ()
                         (require 'lsp-pyright)
                         (lsp))))
(provide 'python-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
539
540
* Treesitter
#+begin_src emacs-lisp :tangle recipes/treesitter-rcp.el
541
(use-package tree-sitter-langs
542
543
  :ensure t
  :defer t)
Benjamin James's avatar
Benjamin James committed
544
(use-package tree-sitter
545
  :ensure t
546
  :defer t
Benjamin James's avatar
Benjamin James committed
547
548
549
550
551
552
553
554
555
  :config
  (require 'tree-sitter-langs)
  (global-tree-sitter-mode)
  (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
(provide 'treesitter-rcp)
#+end_src
* Lsp
#+begin_src emacs-lisp :tangle recipes/lsp-rcp.el
(use-package lsp-mode
556
  :ensure t
557
  :defer t
Benjamin James's avatar
Benjamin James committed
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
  :init (setq lsp-keymap-prefix "C-l"
              lsp-enable-file-watchers nil
              lsp-enable-on-type-formatting 1
              lsp-enable-snippet 1)
  :commands (lsp lsp-deferred)
  :hook (rustic-mode . lsp)
  :bind (:map lsp-mode-map ("TAB" . completion-at-point))
  :config
  (lsp-enable-which-key-integration t)
  :custom (lsp-headerline-breadcrumb-enable nil))

(use-package lsp-ui
  :ensure t
  :defer t
  :hook (lsp-mode . lsp-ui-mode)
  :commands lsp-ui-mode)
(provide 'lsp-rcp)
#+end_src

* Projectile
#+begin_src emacs-lisp :tangle recipes/projectile-rcp.el
(use-package projectile
  :ensure t
  :commands projectile-project-root
  :defer 2
  :defines projectile-globally-ignored-directories
  :config
  (projectile-mode)
  (add-to-list 'projectile-globally-ignored-directories "*bloop")
  (add-to-list 'projectile-globally-ignored-directories "*metals")
  :bind
  ("C-c p" . projectile-command-map))

(provide 'projectile-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
593
594
595

* Ligatures
#+begin_src emacs-lisp :tangle recipes/ligatures-rcp.el
596
(defvar ligatures-JetBrainsMono-text
597
  '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<=" ">=" "&&" "&&&" "&=" "++" "+++"
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
    "***" ";;" "!!" "??" "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" "<<" ">>" "||" "-|"
    "_|_" "|-" "||-" "|=" "||=" "##" "###" "####" "#{" ":[" "]#" "#(" "#?" "#_" "#_(" "#:"
    "#!" "#=" "^=" "<$>" "<$" "$>" "<+>" "<+ +>" "</" "</>" "/>" "<!--"
    "<#--" "-->" "->" "->>" "<<-" "<-" "<=<" "=<<" "<<=" "<==" "<=>" "<==>" "==>" "=>"
    "=>>" ">=>" ">>=" ">>-" ">-" ">--" "-<" "-<<" ">->" "<-<" "<-|" "<=|" "|=>" "|->" "<-"
    "<~~" "<~" "<~>" "~~" "~~>" "~>" "~-" "-~" "~@" "[||]" "|]" "[|" "|}" "{|" "[< >]"
    "|>" "<|" "||>" "<||" "|||>" "<|||" "<|>" "..." ".." ".=" ".-" "..<" ".?" "::" ":::"
    ":=" "::=" ":?" ":?>" "//" "///" "/*" "*/" "/=" "//=" "/==" "@_" "__"))

(defvar ligatures-JetBrainsMono-rust
  '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<=" ">=" "&&" "&&&" "&=" "++" "+++"
    "***" ";;" "!!" "??" "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" "<<" ">>" "||" "-|"
    "_|_" "|-" "||-" "|=" "||=" "##" "###" "####" "#{" ":[" "]#" "#(" "#?" "#_" "#_(" "#:"
    "#!" "#=" "^=" "<$>" "<$" "$>" "<+>" "<+ +>" "</" "</>" "/>" "<!--"
    "<#--" "-->" "->" "->>" "<<-" "<-" "<=<" "=<<" "<<=" "<==" "<=>" "<==>" "==>" "=>"
    "=>>" ">=>" ">>=" ">>-" ">-" ">--" "-<" "-<<" ">->" "<-<" "<-|" "<=|" "|=>" "|->" "<-"
    "<~~" "<~" "<~>" "~~" "~~>" "~>" "~-" "-~" "~@" "[||]" "|]" "[|" "|}" "{|" "[< >]"
    "|>" "<|" "||>" "<||" "|||>" "<|||" "<|>" "..." ".." ".=" ".-" "..<" ".?" "::" ":::"
    ":=" "::=" ":?" ":?>" "//" "///" "/*" "*/" "/=" "//=" "/==" "@_" "__"))

;; These are the ligatures for python-mode
(defvar ligatures-JetBrainsMono-python
  '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "<=" ">=" "&&" "&&&" "&=" "++" "+++"
    "***" ";;" "!!" "??" "?:" "?." "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" "<<" ">>" "||" "-|"
    "_|_" "|-" "||-" "|=" "||=" "^=" "<$>" "<$" "$>" "<+>" "<+ +>" "<*>" "<* *>" "</" "</>" "/>" "<!--"
    "-->" "->" "->>" "<<-" "<-" "<=<" "=<<" "<<=" "<==" "<=>" "<==>" "==>" "=>"
    "=>>" ">=>" ">>=" ">>-" ">-" ">--" "-<" "-<<" ">->" "<-<" "<-|" "<=|" "|=>" "|->" "<-"
    "<~~" "<~" "<~>" "~~" "~~>" "~>" "~-" "[||]" "|]" "[|" "|}" "{|" "[<" ">]"
    "|>" "<|" "||>" "<||" "|||>" "<|>" ".=" "..<" ".?" "::" ":::"
    ":=" "::=" ":?" ":?>" "/=" "//=" "/==" "__"))
628

Benjamin James's avatar
Benjamin James committed
629
630
631
632
633
634
635
636
637
638
639
640
(defvar ligatures-JetBrainsMono-cc
  '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<=" ">=" "&&" "&&&" "&=" "++" "+++"
    ;;"***" ";;" "!!" "??" "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" "<<" ">>" "||" "-|"
    ;;"_|_" "|-" "||-" "|=" "||=" "##" "###" "####" "#{" ":[" "]#" "#(" "#?" "#_" "#_(" "#:"
    ;;"#!" "#=" "^=" "<$>" "<$" "$>" "<+>" "<+ +>" "</" "</>" "/>" "<!--"
    ;;"<#--" "-->" "->" "->>" "<<-" "<-" "<=<" "=<<" "<<=" "<==" "<=>" "<==>" "==>" "=>"
    ;;"=>>" ">=>" ">>=" ">>-" ">-" ">--" "-<" "-<<" ">->" "<-<" "<-|" "<=|" "|=>" "|->" "<-"
    ;;"<~~" "<~" "<~>" "~~" "~~>" "~>" "~-" "-~" "~@" "[||]" "|]" "[|" "|}" "{|" "[< >]"
    ;;"|>" "<|" "||>" "<||" "|||>" "<|||" "<|>" "..." ".." ".=" ".-" "..<" ".?" "::" ":::"
    ;;":=" "::=" ":?" ":?>" "//" "///" "/*" "*/" "/=" "//=" "/==" "@_" "__"
    ))

Benjamin James's avatar
Benjamin James committed
641
(use-package ligature
642
  ;; git repo [https://github.com/mickeynp/ligature.el.git]
Benjamin James's avatar
Benjamin James committed
643
644
  :load-path "/home/simson/.config/emacs/ligature.el"
  :config
645
646
647
  (ligature-set-ligatures 'python-mode ligatures-JetBrainsMono-python)
  (ligature-set-ligatures 'rustic-mode ligatures-JetBrainsMono-rust)
  (ligature-set-ligatures 'text-mode ligatures-JetBrainsMono-rust)
648
  (ligature-set-ligatures 'emacs-lisp-mode ligatures-JetBrainsMono-rust)
Benjamin James's avatar
Benjamin James committed
649
650
651
  (ligature-set-ligatures 'c-mode ligatures-JetBrainsMono-cc)
  (ligature-set-ligatures 'c++-mode ligatures-JetBrainsMono-cc)
  (global-ligature-mode 1))
652

Benjamin James's avatar
Benjamin James committed
653
654
(provide 'ligatures-rcp)
#+end_src
655
656
657
658
659
660
661
662
663
664

* Spelling checking
#+begin_src emacs-lisp :tangle recipes/spellcheck-rcp.el
(use-package flyspell-correct
  :ensure t)

(dolist (hook '(text-mode-hook org-mode-hook))
  (add-hook hook (lambda () (flyspell-mode 1))))
(provide 'spellcheck-rcp)
#+end_src
665
666
667
668
669
670
671
672
673
674

* Asynchronous processing in Emacs
#+begin_src emacs-lisp :tangle recipes/async-rcp.el
(use-package async
  :ensure t
  :config
  (autoload 'dired-async-mode "dired-async.el" nil 1)
  (dired-async-mode 1))
(provide 'async-rcp)
#+end_src
Benjamin James's avatar
Benjamin James committed
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702

* Email
#+begin_src emacs-lisp :tangle recipes/email-rcp.el
(use-package mu4e
  :load-path "/usr/share/emacs/site-lisp/mu4e/"
  :config
  (setq mu4e-change-filenames-when-moving t)
  (setq mu4e-update-interval (* 10 60))
  (setq mu4e-get-mail-command "mbsync -a")
  (setq mu4e-maildir "~/Mail")

  (setq mu4e-drafts-folder "/[Gmail]/Drafts")
  (setq mu4e-sent-folder   "/[Gmail]/Sent Mail")
  (setq mu4e-refile-folder "/[Gmail]/All Mail")
  (setq mu4e-trash-folder  "/[Gmail]/Trash")

  (setq mu4e-maildir-shortcuts
        '(("/Inbox"             . ?i)
          ("/[Gmail]/Sent Mail" . ?s)
          ("/[Gmail]/Trash"     . ?t)
          ("/[Gmail]/Drafts"    . ?d)
          ("/[Gmail]/All Mail"  . ?a)
          ("/[Gmail]/Important" . ?m)
          ("/[Gmail]/Stared"    . ?p))))

(provide 'email-rcp)
#+end_src