-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.el
942 lines (835 loc) · 33.4 KB
/
init.el
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
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
593
594
595
596
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
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
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
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
;; Tangled from dotfiles/emacs/README.org
;; -*- lexical-binding: t -*-
(message "🚜 Loading init.el")
;; https://github.com/raxod502/straight.el/issues/757#issuecomment-839764260
(defvar comp-deferred-compilation-deny-list ())
;; https://github.com/radian-software/straight.el#getting-started
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; https://github.com/radian-software/straight.el#integration-with-use-package
(straight-use-package 'use-package)
(with-eval-after-load 'eldoc
(setq eldoc-echo-area-prefer-doc-buffer t))
;; https://orgmode.org/worg/org-contrib/org-protocol.html
;; https://github.com/org-roam/org-roam/issues/529
;; https://git.savannah.gnu.org/cgit/emacs/org-mode.git/
(use-package org
:straight (:type built-in)
:after magit
:init
(setq org-adapt-indentation nil ; https://orgmode.org/manual/Hard-indentation.html
org-hide-leading-stars nil
org-odd-levels-only nil)
:bind (:map org-babel-map ("t" . org-babel-tangle-async))
:config
;; https://orgmode.org/manual/Capture-templates.html#Capture-templates
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c d") 'org-hide-drawer-toggle)
;; https://www.reddit.com/r/emacs/comments/ldiryk/weird_tab_behavior_in_org_mode_source_blocks
(setq org-src-preserve-indentation t
org-hide-block-startup t)
(defun org-babel-tangle-async (&optional arg target-file lang-re)
"Call `org-babel-tangle' asynchronously"
(interactive "P")
(message "🧬 Async Org-Babel: start tangle [%s]" buffer-file-name)
(run-hooks 'org-babel-pre-tangle-hook)
(async-start `(lambda ()
(message "🧬 Async Org-Babel: lambda start")
(if (and (stringp ,buffer-file-name)
(file-exists-p ,buffer-file-name))
(progn
(setq exec-path ',exec-path
load-path ',load-path
enable-local-eval t
auto-save-default nil
org-babel-pre-tangle-hook '())
(print (format "🧬 Async Org-Babel: exec from [%s] load from [%s]" exec-path load-path))
(package-initialize)
(print (format "🧬 Async Org-Babel: package init completed"))
(find-file ,(buffer-file-name))
(print (format "🧬 Async Org-Babel: file [%s] found" ,buffer-file-name))
(read-only-mode t)
(goto-char ,(point))
(print (format "🧬 Async Org-Babel: point [%s] located" ,(point)))
(print (format "🧬 Async Org-Babel: auto confirm babel eval"))
(setq-local org-confirm-babel-evaluate nil)
(print (format "🧬 Async Org-Babel:\n\targ [%s]\n\ttarget [%s]\n\tlang [%s]" ,arg , target-file ,lang-re))
(org-babel-tangle ,arg ,target-file ,lang-re) ; tangle! (ref:org-babel-tangle-call)
(print (format "🧬 Async Org-Babel: tangled"))
buffer-file-name)
(error "🧬 Async Org-Babel: not visiting a file")))
`(lambda (result)
(message "🧬 Async Org-Babel: completed [%s]" result))))
;; https://orgmode.org/manual/Structure-Templates.html
(require 'org-tempo)
;; https://www.reddit.com/r/emacs/comments/c1b70i/best_way_to_include_source_code_blocks_in_a_latex/
(add-to-list 'org-latex-packages-alist '("" "listings" nil))
;;(setq org-latex-packages-alist nil)
;;(setq org-latex-listings t)
;;(setq org-latex-listings-options '(("breaklines" "true")))
(setq org-latex-listings t)
(setq org-latex-listings-options
'(("basicstyle" "\\ttfamily")
("breakatwhitespace" "false")
("breakautoindent" "true")
("breaklines" "true")
;;("columns" "[c]fullflexible")
("commentstyle" "")
("emptylines" "*")
("extendedchars" "false")
;;("fancyvrb" "true")
("firstnumber" "auto")
("flexiblecolumns" "false")
("frame" "single")
("frameround" "tttt")
("identifierstyle" "")
("keepspaces" "true")
("keywordstyle" "")
("mathescape" "false")
("numbers" "left")
("numbers" "none")
("numbersep" "5pt")
("numberstyle" "\\tiny")
("resetmargins" "false")
("showlines" "true")
("showspaces" "false")
("showstringspaces" "false")
("showtabs" "true")
("stepnumber" "2")
("stringstyle" "")
("tab" "↹")
("tabsize" "4")
("texcl" "false")
("upquote" "false")))
:custom
(org-tags-column 0 "Avoid wrapping issues by minimizing tag indentation")
(org-catch-invisible-edits 'error "Disable invisible edits")
(org-src-window-setup 'current-window "Show edit buffer in calling window")
(org-refile-targets '((nil . (:maxlevel . 3))) "Allow refiling to 3rd level headings")
(org-format-latex-options '(
:foreground default
:background default
:scale 4.0
:html-foreground "Black"
:html-background "Transparent"
:html-scale 1.0
:matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
(org-todo-keywords '((sequence "TODO(t)" "WIP(w)" "|" "DONE(d)" "CANCELED(@c)")) "Allow fast-selection for my standard TODO states")
(org-html-head (format "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />" (expand-file-name "ox-html.css" user-emacs-directory)) "Point to our custom stylesheet"))
;; https://github.com/jkitchin/ox-clip
;; https://zzamboni.org/post/my-emacs-configuration-with-commentary/
(use-package ox-clip
:straight (ox-clip :type git
:host github
:repo "jkitchin/ox-clip")
:after (org)
:bind
("C-c y" . ox-clip-formatted-copy))
;; https://github.com/misohena/phscroll
(use-package phscroll
:straight (phscroll :type git
:host github
:repo "misohena/phscroll")
:init
(setq org-startup-truncated nil)
:config
(with-eval-after-load "org"
(require 'org-phscroll)))
(use-package ol-bibtex
:straight (:type built-in)
:after org
:custom
(org-bibtex-prefix "BIB_" "Define prefix for arbitrary fields")
(org-bibtex-export-arbitrary-fields t "Export prefixed fields"))
;; https://git.sr.ht/~bzg/org-contrib
(use-package org-contrib
:straight (org-contrib :type git
:host nil
:repo "https://git.sr.ht/~bzg/org-contrib")
:after org)
;; https://github.com/org-roam/org-roam
(use-package org-roam
:straight (org-roam :type git
:host github
:repo "org-roam/org-roam")
:after org
:init
(setq org-roam-v2-ack t)
(let ((directory (file-truename "~/org/")))
(make-directory directory t)
(setq org-roam-directory directory
;; Define a directory that does not change along with the Org-Roam folder
vidbina-org-roam-root-directory directory))
(setq org-roam-file-extensions '("org" "md"))
(setq org-roam-db-location (file-truename "~/org/roam/org-roam.db"))
:config
(message "📔 org-roam is loaded")
(org-roam-db-autosync-disable)
: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)
("C-c n u" . vidbina/org-roam-db-async-forced-sync)))
;; https://github.com/org-roam/org-roam-ui
(use-package org-roam-ui
:straight (org-roam-ui :host github
:repo "org-roam/org-roam-ui"
:branch "main"
:files ("*.el" "out"))
:delight
(org-roam-ui-mode "🕸️")
(org-roam-ui-follow-mode "👀")
:after org-roam
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;; a hookable mode anymore, you're advised to pick something yourself
;; if you don't care about startup time, use
:bind (("C-c n ." . org-roam-ui-node-zoom)
("C-c n ," . org-roam-ui-node-local))
:hook (after-init . org-roam-ui-mode)
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow nil
org-roam-ui-update-on-save t
org-roam-ui-open-on-start nil))
;; https://github.com/nobiot/md-roam
(use-package md-roam
:straight (md-roam :type git
:host github
:repo "nobiot/md-roam")
:after org-roam
:init
(setq md-roam-use-markdown-file-links t
md-roam-file_extension-single "md"
org-roam-tag-sources '(prop md-frontmatter)
org-roam-title-sources '((mdtitle title mdheadline headline) (mdalias alias))))
;; https://github.com/org-roam/org-roam-bibtex
(use-package org-roam-bibtex
:straight (org-roam-bibtex :type git
:host github
:repo "org-roam/org-roam-bibtex")
:after org-roam
;; NOTE: Using org-ref requires additional configuration
)
;; https://github.com/alphapapa/org-ql
(use-package org-ql
:straight (org-ql :type git
:host github
:repo "alphapapa/org-ql"))
;; https://github.com/vidbina/ob-async
(use-package ob-async
:straight (ob-async :type git
:host github
:branch "main"
:repo "vidbina/ob-async"))
;; https://www.emacswiki.org/emacs/ScrollBar
(scroll-bar-mode -1)
;; https://www.emacswiki.org/emacs/ToolBar
(tool-bar-mode -1)
;; https://www.emacswiki.org/emacs/MenuBar
(menu-bar-mode -1)
;; https://www.emacswiki.org/emacs/ShowParenMode
(show-paren-mode 1)
(use-package ansi-color
:hook (compilation-filter . ansi-color-compilation-filter))
(customize-set-variable 'compilation-scroll-output t "auto-scroll to bottom")
;; https://www.emacswiki.org/emacs/LineNumbers
(use-package display-line-numbers
:straight (:type built-in)
:config
(display-line-numbers-mode 0)
:hook
(prog-mode . (lambda () (display-line-numbers-mode 1)))
(notmuch-hello-mode . (lambda () (display-line-numbers-mode 0)))
:bind
(("C-c n n" . display-line-numbers-mode)))
;; https://www.emacswiki.org/emacs/WhiteSpace
;; https://www.emacswiki.org/emacs?action=browse;oldid=WhitespaceMode;id=WhiteSpace
(setq whitespace-style '(empty face lines-tail tabs trailing))
;; https://git.savannah.nongnu.org/git/delight.git
(use-package delight
:straight (delight :type git
:host nil
:repo "https://git.savannah.nongnu.org/git/delight.git")
:delight
(fundamental-mode "🗒️")
(auto-revert-mode "♻️")
(eldoc-mode "el📖")
(edebug-mode "🐞")
(whitespace-mode "🏳️")
(visual-line-mode "🌯")
(mu4e-main-mode "📫")
(mu4e-headers-mode "📬")
(mu4e-view-mode "📧")
(vterm-mode "👨🏿💻"))
;; https://github.com/myrjola/diminish.el
(use-package diminish
:straight (diminish :type git
:host github
:repo "myrjola/diminish.el"))
(customize-set-variable 'auto-revert-mode-text "♻️")
;; https://github.com/joostkremers/visual-fill-column
(use-package visual-fill-column
:straight (visual-fill-column :type git
:host github
:repo "joostkremers/visual-fill-column"))
;; https://elpa.gnu.org/packages/adaptive-wrap.html
(use-package adaptive-wrap
:straight (adaptive-wrap :type git
:host github
:repo "emacs-straight/adaptive-wrap")
:config
(adaptive-wrap-prefix-mode))
;; https://github.com/purcell/default-text-scale
;; Doesn't work well in emacsclient
(use-package default-text-scale
:straight (default-text-scale :type git
:host github
:repo "purcell/default-text-scale")
:hook ((after-init . default-text-scale-mode)))
;; https://github.com/rnkn/olivetti.git
(use-package olivetti
:straight (olivetti :type git
:host github
:repo "rnkn/olivetti"))
;; https://gitlab.com/protesilaos/modus-themes
(use-package modus-themes
:straight (modus-themes :type git
:host gitlab
:repo "protesilaos/modus-themes")
:custom
(modus-themes-bold-constructs t)
(modus-themes-org-blocks 'gray-background)
(modus-themes-prompts '(intense))
(modus-themes-headings '((0 . (light 1.5))
(1 . (regular 1.3))
(2 . (regular 1.1))
(t . (regular 1.1))))
(modus-themes-common-palette-overrides
'((bg-heading-1 bg-yellow-nuanced)
(bg-heading-2 bg-blue-nuanced)
(bg-heading-3 bg-green-nuanced)
(bg-heading-4 bg-cyan-nuanced)
(bg-heading-5 bg-red-nuanced)
(fg-heading-0 fg-main)
(fg-heading-1 fg-main)
(fg-heading-2 fg-main)
(fg-heading-3 fg-main)
(fg-heading-4 fg-main)
(fg-heading-5 fg-main)
(fg-heading-6 fg-main)
(fg-heading-7 fg-main)
(fg-heading-8 fg-main)
(prose-done green-intense)
(prose-todo red-intense)))
)
(use-package theme-magic
:straight (theme-magic :type git
:host github
:repo "jcaw/theme-magic")
:config
(theme-magic-export-theme-mode)
(setq theme-magic--preferred-extracted-colors
'(
;; background
(0 . ((modus-themes-get-color-value 'bg-main)
(modus-themes-get-color-value 'bg-dim)))
;; error (red)
(1 . ((modus-themes-get-color-value 'red-intense)
(modus-themes-get-color-value 'err)
(modus-themes-get-color-value 'red)))
;; warning (yellow)
(3 . ((modus-themes-get-color-value 'yellow-warmer)
(modus-themes-get-color-value 'warning)
(modus-themes-get-color-value 'yellow-intense)
(modus-themes-get-color-value 'bg-yellow-intense)))
;; cyan
(6 . ((modus-themes-get-color-value 'cyan-intense)
(modus-themes-get-color-value 'cyan)))
;; foreground
(7 . ((modus-themes-get-color-value 'fg-main)))
;; alt/faded
(8 . ((modus-themes-get-color-value 'fg-dim)
(modus-themes-get-color-value 'fg-alt)))
;; additionals, non primaries
;; (green)
(2 . ((modus-themes-get-color-value 'green-intense)
(modus-themes-get-color-value 'green)
(modus-themes-get-color-value 'green-faint)))
;; (blue)
(4 . ((modus-themes-get-color-value 'blue-warmer)
(modus-themes-get-color-value 'blue-intense)
(modus-themes-get-color-value 'blue)))
;; (purple)
(5 . ((modus-themes-get-color-value 'magenta-intense)
(modus-themes-get-color-value 'magenta-warmer)
(modus-themes-get-color-value 'magenta)))))
)
;; https://github.com/domtronn/all-the-icons.el
(use-package all-the-icons
:straight (all-the-icons :type git
:host github
:repo "domtronn/all-the-icons.el")
:if (display-graphic-p))
;; https://github.com/joaotavora/yasnippet
(use-package yasnippet
:straight (yasnippet :type git
:host github
:repo "joaotavora/yasnippet")
:config
(yas-global-mode 1))
(setq display-buffer-alist
(let* ((sidebar-width '(window-width . 85))
(sidebar-parameters '(window-parameters . ((no-other-window . t))))
(sidebar (list '(side . left) sidebar-width sidebar-parameters)))
(list (cons (regexp-opt-group '("*org-roam*"))
(cons #'display-buffer-in-side-window
`((slot . 0) ,@sidebar)))
(cons (regexp-opt-group '("*ChatGPT*"))
(cons #'display-buffer-same-window
`((slot . 0) ,@sidebar)))
(cons (regexp-opt-group '("*Dictionary*"))
(cons #'display-buffer-in-side-window
`((slot . -1) ,@sidebar)))
(cons (regexp-opt-group '("*Help*" "*Info*" "*info*"))
(cons #'display-buffer-in-side-window
`((slot . 5) ,@sidebar)))
(cons (regexp-opt-group '("*Shortdoc"))
(cons #'display-buffer-in-side-window
`((slot . 6) ,@sidebar)))
(cons (regexp-opt-group '("*Warnings*"))
(cons #'display-buffer-in-side-window
`((slot . 10) ,@sidebar)))
(cons (regexp-opt-group '("*dotfile-helpers*"))
(cons #'display-buffer-no-window
`())))))
(customize-set-variable 'display-warning-minimum-level :error
"Pop up buffer for error-level or more severe warnings")
;; https://github.com/emacsorphanage/zoom-window
(use-package zoom-window
:straight (zoom-window :type git
:host github
:repo "emacsorphanage/zoom-window")
:init
(message "Configuring ‘zoom-window’")
)
;; https://github.com/abo-abo/ace-window
;; https://jao.io/blog/2020-05-12-ace-window.html
(use-package ace-window
:straight (ace-window :type git
:host github
:repo "abo-abo/ace-window")
:bind (("M-o" . ace-window)))
;; https://github.com/abo-abo/avy
(use-package avy
:straight (avy :type git
:host github
:repo "abo-abo/avy")
:bind (("C-:" . avy-goto-char)))
;; https://github.com/daichirata/emacs-rotate
(use-package rotate
:straight (rotate :type git
:host github
:repo "daichirata/emacs-rotate"))
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/FFAP.html#index-ffap
(ffap-bindings)
;; https://www.gnu.org/software/emacs/manual/html_node/eintr/Indent-Tabs-Mode.html
(setq-default indent-tabs-mode nil)
;; https://www.emacswiki.org/emacs/SmoothScrolling
(setq-default scroll-conservatively 100)
;; https://github.com/emacsmirror/undo-fu
(use-package undo-fu
:straight (undo-fu :type git
:host github
:repo "emacsmirror/undo-fu"))
;; https://github.com/jwiegley/emacs-async
(use-package async
:straight (async :type git
:host github
:repo "jwiegley/emacs-async")
:config
(async-bytecomp-package-mode 1)
:custom
(async-variables-noprops-function #'async--purecopy))
;; https://github.com/victorhge/iedit
(use-package iedit
:straight (iedit :type git
:host github
:repo "victorhge/iedit"))
;; https://github.com/emacs-evil/evil
;; https://github.com/noctuid/evil-guide
(use-package evil
:straight (evil :type git
:host github
:repo "emacs-evil/evil")
:after
undo-fu
:init
;; pre-set some evil vars prior to package load
(setq evil-respect-visual-line-mode t)
(setq evil-undo-system 'undo-fu)
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-mode-line-format nil)
:config
(message "😈 Configured evil-mode"))
;; https://github.com/emacs-evil/evil-collection
(use-package evil-collection
:straight (evil-collection :type git
:host github
:repo "emacs-evil/evil-collection")
:after evil
:custom
(evil-collection-setup-minibuffer t)
:config
(evil-mode 1)
(message "😈 Enable evil-mode")
(evil-collection-init)
(advice-add 'evil-collection-mu4e-setup
:before (lambda ()
(message "😈 Setup up evil-collection for mu4e 📧")))
(advice-add 'evil-collection-vterm-setup
:before (lambda ()
(message "😈 Setup up evil-collection for vterm 📠")))
:delight
(evil-collection-unimpaired-mode "🚀"))
;; https://github.com/alexmurray/evil-vimish-fold
(use-package evil-vimish-fold
:straight (evil-vimish-fold :type git
:host github
:repo "alexmurray/evil-vimish-fold")
:diminish evil-vimish-fold-mode
:after
(:all vimish-fold)
:hook ((prog-mode conf-mode text-mode) . evil-vimish-fold-mode))
;; https://github.com/matsievskiysv/vimish-fold
(use-package vimish-fold
:straight (vimish-fold :type git
:host github
:repo "matsievskiysv/vimish-fold")
:after evil)
;; https://github.com/bastibe/annotate.el
(use-package annotate
:straight (annotate :type git
:host github
:repo "bastibe/annotate.el")
:custom
(annotate-file-buffer-local nil "Use central annotations file"))
;; https://github.com/magit/magit.git
(use-package magit
:straight (magit :type git
:host github
:repo "magit/magit")
:ensure t
:bind (("C-x g" . magit-status)
("C-x C-g" . magit-status))
:custom
(with-editor-emacsclient-executable nil)
(magit-display-buffer-function
(lambda (buffer)
;; based on magit-display-buffer-same-window-except-diff-v1
(display-buffer
buffer (if (with-current-buffer buffer
(derived-mode-p 'magit-diff-mode 'magit-process-mode))
'(display-buffer-below-selected)
'(display-buffer-same-window))))
"Open in same window or (when secondary) split at bottom")
(magit-diff-refine-hunk t "Show fine differences (word-granularity) for current hunk only"))
;; https://github.com/magit/forge
(use-package forge
:straight (forge :type git
:host github
:repo "magit/forge")
:after magit)
;; https://github.com/dgutov/diff-hl
(use-package diff-hl
:straight (diff-hl :type git
:host github
:repo "dgutov/diff-hl")
:hook
(after-init . global-diff-hl-mode)
(magit-pre-refresh . diff-hl-magit-pre-refresh)
(magit-post-refresh . diff-hl-magit-post-refresh)
:custom
(diff-hl-margin-mode nil "Use the fringe"))
;; https://github.com/jrblevin/deft
(use-package deft
:straight (deft :type git
:host github
:repo "jrblevin/deft")
:after org
:bind
("C-c n d" . deft)
:custom
(deft-directory "~/org")
(deft-extensions '("md" "org"))
(deft-recursive t)
(deft-strip-summary-regexp
(concat "\\("
"[\n\t]" ;; blank
"\\|^#\\+[[:alpha:]_]+:.*$" ;; org-mode metadata
"\\)"))
(deft-use-filename-as-title t)
(deft-use-filter-string-for-filename t))
;; https://github.com/jaypei/emacs-neotree
(use-package neotree
:straight (neotree :type git
:host github
:repo "jaypei/emacs-neotree")
:custom
(neo-theme (if (display-graphic-p) 'icons 'arrow)))
;; https://github.com/alexluigit/dirvish
(use-package dirvish
:straight (dirvish :type git
:host github
:repo "alexluigit/dirvish")
:init
(dirvish-override-dired-mode)
:custom
(dirvish-quick-access-entries ; It's a custom option, `setq' won't work
'(("h" "~/" "Home")
("d" "~/Downloads/" "Downloads")
("m" "/mnt/" "Drives")
("t" "~/.local/share/Trash/files/" "TrashCan")))
:config
;; (dirvish-peek-mode) ; Preview files in minibuffer
;; (dirvish-side-follow-mode) ; similar to `treemacs-follow-mode'
(setq dirvish-mode-line-format
'(:left (sort symlink) :right (omit yank index)))
(setq dirvish-attributes
'(all-the-icons file-time file-size collapse subtree-state vc-state git-msg))
;;(setq delete-by-moving-to-trash t)
(setq dired-listing-switches
"-l --almost-all --human-readable --group-directories-first --no-group")
:bind ; Bind `dirvish|dirvish-side|dirvish-dwim' as you see fit
(("C-c f" . dirvish-fd)
:map dirvish-mode-map ; Dirvish inherits `dired-mode-map'
("a" . dirvish-quick-access)
("f" . dirvish-file-info-menu)
("y" . dirvish-yank-menu)
("N" . dirvish-narrow)
("^" . dirvish-history-last)
("h" . dirvish-history-jump) ; remapped `describe-mode'
("s" . dirvish-quicksort) ; remapped `dired-sort-toggle-or-edit'
("v" . dirvish-vc-menu) ; remapped `dired-view-file'
("TAB" . dirvish-subtree-toggle)
("M-f" . dirvish-history-go-forward)
("M-b" . dirvish-history-go-backward)
("M-l" . dirvish-ls-switches-menu)
("M-m" . dirvish-mark-menu)
("M-t" . dirvish-layout-toggle)
("M-s" . dirvish-setup-menu)
("M-e" . dirvish-emerge-menu)
("M-j" . dirvish-fd-jump)))
(use-package orderless
:straight (orderless :type git
:host github
:repo "oantolin/orderless")
;; NOTE: Load Orderless after Swiper when using the Ivy integration
:custom
(completion-styles '(orderless)))
;; Enable richer annotations using the Marginalia package
(use-package marginalia
:straight (marginalia :type git
:host github
:repo "minad/marginalia")
;; Either bind `marginalia-cycle` globally or only in the minibuffer
:bind (("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
;; The :init configuration is always executed (Not lazy!)
:init
;; Must be in the :init section of use-package such that the mode gets
;; enabled right away. Note that this forces loading the package.
(marginalia-mode))
;; https://github.com/minad/consult
(use-package consult
:straight (consult :type git
:host github
:repo "minad/consult")
:bind
(;; bindings from https://github.com/minad/consult#use-package-example
;; C-c bindings (mode-specific-map)
("C-c h" . consult-history)
("C-c m" . consult-mode-command)
("C-c k" . consult-kmacro)
;; C-x bindings (ctl-x-map)
("C-x M-:" . consult-complex-command) ; orig. repeat-complex-command
("C-x b" . consult-buffer) ; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ; orig. switch-to-buffer-other-frame
("C-x r b" . consult-bookmark) ; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ; orig. yank-pop
("<help> a" . consult-apropos) ; orig. apropos-command
;; M-g bindings (goto-map)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ; orig. goto-line
("M-g M-g" . consult-goto-line) ; orig. goto-line
("M-g o" . consult-outline) ; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings (search-map)
("M-s d" . consult-find)
("M-s D" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s m" . consult-multi-occur)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ; orig. isearch-edit-string
("M-s l" . consult-line) ; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ; orig. next-matching-history-element
("M-r" . consult-history) ; orig. previous-matching-history-element
)
:config
;; Use `consult-completion-in-region' if Vertico is enabled.
;; Otherwise use the default `completion--in-region' function.
(setq completion-in-region-function
(lambda (&rest args)
(apply (if vertico-mode
#'consult-completion-in-region
#'completion--in-region)
args))))
;; https://github.com/minad/vertico
(use-package vertico
:straight (vertico :type git
:host github
:repo "minad/vertico")
:init
(vertico-mode)
:config
)
;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist
:straight (:type built-in)
:init
(savehist-mode))
;; A few more useful configurations...
(use-package emacs
:straight (:type built-in)
:init
;; Add prompt indicator to `completing-read-multiple'.
;; Alternatively try `consult-completing-read-multiple'.
(defun crm-indicator (args)
(cons (concat "[CRM] " (car args)) (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
;; Vertico commands are hidden in normal buffers.
(setq read-extended-command-predicate
#'command-completion-default-include-p)
;; Enable recursive minibuffers
(setq enable-recursive-minibuffers t)
:hook (minibuffer-setup . cursor-intangible-mode))
;; https://github.com/justbur/emacs-which-key
(use-package which-key
:straight (which-key :type git
:host github
:repo "justbur/emacs-which-key")
:delight
:config
(which-key-mode))
(use-package vterm
:straight (:type built-in)
:after evil
:init (evil-collection-vterm-setup)
:hook
(vterm-mode . (lambda ()
(message "HOOK FIRED 2")
`(let ((target ,(list (cons (vidbina/get-likely-current-directory) 2))))
(message "⚠️ Setting %s" target)
(customize-set-value 'magit-repository-directories target "Set through vidbina/get-likely-current-directory"))))
:config
(define-key vterm-mode-map (kbd "C-x C-f") 'vidbina/ffap-vterm-in-persp-mode))
(use-package pdf-tools
:straight (:type built-in)
:config
(require 'pdf-occur)
(pdf-tools-install nil t nil nil)
(setq-default pdf-view-display-size 'fit-width))
;; https://github.com/bbatsov/projectile/
(use-package projectile
:straight (projectile :type git
:host github
:repo "bbatsov/projectile")
:custom
(projectile-mode-line-prefix "🗄️")
:hook (after-init . projectile-mode)
:bind (:map projectile-mode-map
("C-x p" . projectile-command-map)))
;; https://github.com/nex3/perspective-el
(use-package perspective
:straight (perspective :type git
:host github
:repo "nex3/perspective-el")
:bind (("C-x k" . persp-kill-buffer*)
("C-x b" . persp-switch-to-buffer))
:custom
(persp-mode-prefix-key (kbd "C-c p") "same as persp-mode")
(persp-modestring-short t)
(persp-state-default-file "~/.emacs.d/perspective")
(persp-show-modestring 'header)
:config
(message "Configuring ‘perspective’")
:init
(persp-mode))
;; https://github.com/alpha22jp/atomic-chrome
(use-package atomic-chrome
:straight (atomic-chrome :type git
:host github
:repo "alpha22jp/atomic-chrome"))
(use-package sendmail
:straight (:type built-in)
:custom
(send-mail-function 'smtpmail-send-it "Default to block")
(smtpmail-debug-info t "Enable debugging")
(mail-specify-envelope-from nil "Don't try to be smart, use user-mail-address")
(mail-envelope-from nil "Don't try to be smart, use user-mail-address"))
(use-package message
:straight (:type built-in)
:custom
(message-directory "~/mail/")
(message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail as our MTA")
(message-sendmail-f-is-evil t "Avoid setting -f (--from) when calling sendmail")
(message-sendmail-envelope-from 'header "Use From: header")
(message-kill-buffer-on-exit t "Kill a buffer once a message is sent"))
(message "💥 Debug on error is %s" debug-on-error)
(load "~/.emacs.d/lang.el" t)
(load "~/.emacs.d/personal.el" t)
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Customizations.html
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file t)
;; https://stackoverflow.com/a/42038174
(when (string= system-type "darwin")
(setq insert-directory-program "/opt/homebrew/bin/gls")
(setq dired-use-ls-dired t))
(message "🏁 End of the config")