forked from mhatta/emacs-barebone-init-el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
1123 lines (1026 loc) · 29.3 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
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; init.el --- init file for Emacs -*- coding: utf-8 ; lexical-binding: t -*-
;; Author: Masayuki Hatta <[email protected]>
;;; Commentary:
;; A boilerplate configuration file for modern Emacs experience.
;;; Code:
;;;
;;; straight.el
;;;
(setq straight-repository-branch "develop") ;; use the develop branch of straight.el
(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))
(setq straight-vc-git-default-clone-depth 1) ;; shallow clone
;; See https://github.com/raxod502/straight.el#summary-of-options-for-package-modification-detection
(when (eq system-type 'windows-nt)
(if (and (executable-find "watchexec")
(executable-find "python3")
(executable-find "diff"))
(setq straight-check-for-modifications '(watch-files find-when-checking))
(setq straight-check-for-modifications '(check-on-save find-when-checking))))
;;;
;;; leaf.el
;;;
(eval-and-compile
(straight-use-package 'leaf)
(straight-use-package 'leaf-keywords)
(leaf-keywords-init)
)
(leaf leaf
:require t
:init
(leaf leaf-convert
:straight t
)
(leaf leaf-tree
:straight t
:blackout t
:custom
(imenu-list-position . 'left)
)
)
;;;
;;; Blackout
;;;
(leaf blackout
:leaf-defer nil
:straight t
:config
;; shut up eldoc in modeline
(leaf eldoc :blackout t)
)
;;;
;;; Defer loading several libraries (for speeding up)
;;;
(leaf Libraries
:config
(leaf cl-lib
:leaf-defer t
)
(leaf dash
:straight t
:leaf-defer t
)
)
;;;
;;; Garbage Collector Magic Hack
;;;
(leaf gcmh
:leaf-defer nil
:straight t
:blackout t
:global-minor-mode gcmh-mode
)
;;;
;;; Language settings
;;;
(leaf Settings
:config
(leaf Language
:config
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8)
(set-default 'buffer-file-coding-system 'utf-8)
)
(leaf Fonts
:config
;; unicode-fonts
(leaf unicode-fonts
:straight t
:config
(unicode-fonts-setup)
)
(when (eq system-type 'windows-nt)
(set-face-attribute 'default nil :family "Consolas" :height 120) ;; CHANGEME
(set-fontset-font 'nil 'japanese-jisx0208
(font-spec :family "Yu Gothic UI"))) ;; CHANGEME
(when (eq system-type 'gnu/linux)
;; Install e.g. fonts-inconsolata & fonts-ipaexfont packages on Debian/Ubuntu
(set-frame-font "Inconsolata-14") ;; CHANGEME
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "IPAExGothic"))) ;; CHANGEME
)
(leaf Misc
:config
(define-key key-translation-map [?\C-h] [?\C-?])
(column-number-mode t)
:custom
'((user-full-name . "Your Name") ;; CHANGEME
(user-login-name . "yourlogin") ;; CHANGEME
(user-mail-address . "[email protected]") ;; CHANGEME
(inhibit-startup-message . t)
(delete-by-moving-to-trash . t)
(kinsoku-limit . 10)
;; For text-only web browsing
;; (browse-url-browser-function . 'eww-browse-url)
)
)
)
;;;
;;; Japanese IME
;;;
(leaf Japanese-IME
:config
;; tr-ime (for Windows)
(leaf tr-ime
;; should work on terminal too
:if (and (eq system-type 'windows-nt) (display-graphic-p))
:straight t
:config
(tr-ime-advanced-install 'no-confirm)
(setq default-input-method "W32-IME")
(w32-ime-initialize)
(setq-default w32-ime-mode-line-state-indicator "[--]")
(setq w32-ime-mode-line-state-indicator-list '("[--]" "[あ]" "[--]"))
;; Fonts used during henkan
(modify-all-frames-parameters '((ime-font . "Yu Gothic UI-12"))) ;; CHANGEME
;; IME control
(wrap-function-to-control-ime 'universal-argument t nil)
(wrap-function-to-control-ime 'read-string nil nil)
(wrap-function-to-control-ime 'read-char nil nil)
(wrap-function-to-control-ime 'read-from-minibuffer nil nil)
(wrap-function-to-control-ime 'y-or-n-p nil nil)
(wrap-function-to-control-ime 'yes-or-no-p nil nil)
(wrap-function-to-control-ime 'map-y-or-n-p nil nil)
(wrap-function-to-control-ime 'register-read-with-preview nil nil)
)
;; Mozc (for GNU/Linux)
(leaf mozc
:if (eq system-type 'gnu/linux)
:straight t
:config
(setq default-input-method "japanese-mozc")
;; mozc-posframe
(leaf mozc-cand-posframe
:if (eq system-type 'gnu/linux)
:after mozc
:straight t
:config
(setq mozc-candidate-style 'posframe)
)
)
;; ddskk
(leaf ddskk
:straight t
:bind
(("C-x C-j" . skk-mode)
("C-x j" . skk-mode))
)
)
;;;
;;; Looks
;;;
(leaf Looks
:config
;; Theme (Modus)
(leaf modus-themes
:straight t
:leaf-defer nil
:init
;; Add all your customizations prior to loading the themes
(setq modus-themes-italic-constructs t
modus-themes-bold-constructs nil
modus-themes-region '(bg-only no-extend))
:config
;; Load the theme of your widget-choice-match
(load-theme 'modus-vivendi :no-confirm) ;; OR modus-operandi
:bind ("<f5>" . modus-themes-toggle)
)
;; ;; Theme (zenburn)
;; (leaf zenburn-theme
;; :straight t
;; :config
;; (load-theme 'zenburn t)
;; )
;; dashboard
(leaf dashboard
:straight t
:config
(dashboard-setup-startup-hook)
)
;; all-the-icons
(leaf all-the-icons
:if (display-graphic-p)
:straight t
:config
;; (all-the-icons-install-fonts)
)
:custom
;; No tool bar
;; '((tool-bar-mode . nil)
;; No scroll bar
;; (set-scroll-bar-mode nil)
)
;;;
;;; minibuffer completion
;;;
(leaf Minibuf-completion
:config
;; corfu
(leaf corfu
:straight (corfu :files (:defaults "extensions/*")
:includes (corfu-info
corfu-history
corfu-popupinfo)
)
:init
(setq corfu-auto t
corfu-quit-no-match t
corfu-popupinfo-delay 0.3
completion-cycle-threshold 3
)
:global-minor-mode (global-corfu-mode corfu-popupinfo-mode)
:config
(define-key corfu-map
(kbd "SPC") #'corfu-insert-separator)
(defun corfu-enable-always-in-minibuffer ()
"Enable Corfu in the minibuffer if Vertico/Mct are not active."
(unless (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input)
(eq (current-local-map) read-passwd-map))
;; (setq-local corfu-auto nil) Enable/disable auto completion
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
corfu-popupinfo-delay nil)
(corfu-mode 1)))
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
(defun corfu-beginning-of-prompt ()
"Move to beginning of completion input."
(interactive)
(corfu--goto -1)
(goto-char (car completion-in-region--data)))
(defun corfu-end-of-prompt ()
"Move to end of completion input."
(interactive)
(corfu--goto -1)
(goto-char (cadr completion-in-region--data)))
(define-key corfu-map [remap move-beginning-of-line] #'corfu-beginning-of-prompt)
(define-key corfu-map [remap move-end-of-line] #'corfu-end-of-prompt)
(add-hook 'eshell-mode-hook
(lambda ()
(setq-local corfu-auto nil)
(corfu-mode)))
(defun corfu-send-shell (&rest _)
"Send completion candidate when inside comint/eshell."
(cond
((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
(eshell-send-input))
((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
(comint-send-input))))
(advice-add #'corfu-insert :after #'corfu-send-shell)
;; corfu-terminal
(leaf corfu-terminal
:straight '(corfu-terminal :type git :repo "https://codeberg.org/akib/emacs-corfu-terminal.git")
:after corfu
:config
(unless (display-graphic-p)
(corfu-terminal-mode +1))
)
;; corfu-history
(leaf corfu-history
:after corfu
:config
(with-eval-after-load 'safehist
(cl-pushnew 'corfu-history savehist-additional-variables))
(corfu-history-mode)
)
)
;; pcmpl-args
(leaf pcmpl-args
:straight t
)
;; Dabbrev
(leaf dabbrev
:straight t
:blackout t
;; Swap M-/ and C-M-/
:bind (("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand))
;; Other useful Dabbrev configurations.
:custom
(dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))
)
;; vertico
(leaf vertico
:straight (vertico :files (:defaults "extensions/*")
:includes (vertico-directory)
)
:init
(vertico-mode)
(setq vertico-count 20)
:config
;; vertico-directory
(leaf vertico-directory
:straight t
:config
(define-key vertico-map (kbd "C-l") #'vertico-directory-up)
(define-key vertico-map "\r" #'vertico-directory-enter) ;; enter dired
(define-key vertico-map "\d" #'vertico-directory-delete-char)
)
)
;; consult
(leaf consult
:straight t
:bind
(("C-s" . consult-line))
)
;; orderless
(leaf orderless
:straight t
:require t
:after migemo
:config
;; Using migemo with orderless
(defun orderless-migemo (component)
(let ((pattern (migemo-get-pattern component)))
(condition-case nil
(progn (string-match-p pattern "") pattern)
(invalid-regexp nil))))
(orderless-define-completion-style orderless-default-style
(orderless-matching-styles '(orderless-initialism
orderless-literal
orderless-regexp)))
(orderless-define-completion-style orderless-migemo-style
(orderless-matching-styles '(orderless-initialism
orderless-literal
orderless-regexp
orderless-migemo)))
(setq completion-category-overrides
'((command (styles orderless-default-style))
(file (styles orderless-migemo-style))
(buffer (styles orderless-migemo-style))
(symbol (styles orderless-default-style))
(consult-location (styles orderless-migemo-style))
(consult-multi (styles orderless-migemo-style))
(org-roam-node (styles orderless-migemo-style))
(unicode-name (styles orderless-migemo-style))
(variable (styles orderless-default-style))))
(setq orderless-matching-styles '(orderless-literal orderless-regexp orderless-migemo))
:custom
(completion-styles . '(orderless basic))
)
;; marginalia
(leaf marginalia
:straight t
:global-minor-mode marginalia-mode
:init
(define-key minibuffer-local-map (kbd "C-M-a") #'marginalia-cycle)
)
;: all-the-icons-completion
(leaf all-the-icons-completion
:after (marginalia all-the-icons)
:straight t
:hook (marginalia-mode . all-the-icons-completion-marginalia-setup)
:global-minor-mode all-the-icons-completion-mode
)
;; cape
(leaf cape
:straight t
:config
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-tex)
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-keyword)
(add-to-list 'completion-at-point-functions #'cape-abbrev)
(add-to-list 'completion-at-point-functions #'cape-ispell)
(add-to-list 'completion-at-point-functions #'cape-symbol)
;; Silence the pcomplete capf, no errors or messages!
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
;; Ensure that pcomplete does not write to the buffer
;; and behaves as a pure `completion-at-point-function'.
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
)
;; kind-icon
(leaf kind-icon
:straight t
:config
(setq kind-icon-default-face 'corfu-default)
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)
)
;; embark
(leaf embark
:straight t
:bind
(("C-." . embark-act)
("C-;" . embark-dwim)
("C-h B" . embark-bindings))
:init
;; Optionally replace the key help with a completing-read interface
(setq prefix-help-command #'embark-prefix-help-command)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none))))
(leaf embark-consult
:straight t
:hook
(embark-collect-mode . consult-preview-at-point-mode))
)
;; affe
(leaf affe
:straight t
:after consult
:config
(consult-customize affe-grep :preview-key (kbd "M-."))
(defvar affe-orderless-regexp "")
(defun affe-orderless-regexp-compiler (input _type)
(setq affe-orderless-regexp (orderless-pattern-compiler input))
(cons affe-orderless-regexp
(lambda (str) (orderless--highlight affe-orderless-regexp str))))
(setq affe-regexp-compiler #'affe-orderless-regexp-compiler)
)
;; migemo
(leaf migemo
:if (executable-find "cmigemo")
:straight t
:require t
:config
(setq migemo-command "cmigemo"
migemo-options '("-q" "-e")
migemo-user-dictionary nil
migemo-regex-dictionary nil
migemo-coding-system 'utf-8-unix)
(when (eq system-type 'gnu/linux)
(setq migemo-dictionary "/usr/share/cmigemo/utf-8/migemo-dict"))
(when (eq system-type 'windows-nt)
;; needs absolute path
(setq migemo-dictionary (expand-file-name "~/scoop/apps/cmigemo/current/cmigemo-mingw64/share/migemo/utf-8/migemo-dict")))
(migemo-init)
)
)
;;;
;;; org-mode
;;;
(leaf Org-mode
:config
;; org
(leaf org
:straight t
:leaf-defer t
:init
(setq org-directory "~/Org") ;; CHANGEME
(unless (file-exists-p org-directory)
(make-directory org-directory))
(defun org-buffer-files ()
"Return list of opened Org mode buffer files."
(mapcar (function buffer-file-name)
(org-buffer-list 'files)))
(defun show-org-buffer (file)
"Show an org-file FILE on the current buffer."
(interactive)
(if (get-buffer file)
(let ((buffer (get-buffer file)))
(switch-to-buffer buffer)
(message "%s" file))
(find-file (concat org-directory "/" file))))
:bind
(("\C-ca" . org-agenda)
("\C-cc" . org-capture)
("\C-ch" . org-store-link)
("C-M--" . #'(lambda () (interactive)
(show-org-buffer "gtd.org")))
("C-M-^" . #'(lambda () (interactive)
(show-org-buffer "notes.org")))
("C-M-~" . #'(lambda () (interactive)
(show-org-buffer "kb.org")))
)
:config
(setq org-agenda-files (list org-directory)
org-default-notes-file "notes.org"
org-log-done 'time
org-startup-truncated nil
org-startup-folded 'content
org-use-speed-commands t
org-enforce-todo-dependencies t)
(remove (concat org-directory "/archives") org-agenda-files)
(setq org-todo-keywords
'((sequence "TODO(t)" "SOMEDAY(s)" "WAITING(w)" "|" "DONE(d)" "CANCELED(c@)")))
(setq org-refile-targets
(quote ((nil :maxlevel . 3)
(org-buffer-files :maxlevel . 1)
(org-agenda-files :maxlevel . 3))))
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "gtd.org" "Inbox")
"* TODO %?\n %i\n %a")
("n" "Note" entry (file+headline "notes.org" "Notes")
"* %?\nEntered on %U\n %i\n %a")
("j" "Journal" entry (function org-journal-find-location)
"* %(format-time-string org-journal-time-format)%^{Title}\n%i%?")
("h" "Hugo post" entry (file+olp "jamhattaorg.org" "Blog Ideas")
(function org-hugo-new-subtree-post-capture-template))
))
;; Populates only the EXPORT_FILE_NAME property in the inserted headline.
(with-eval-after-load 'org-capture
(defun org-hugo-new-subtree-post-capture-template ()
"Returns `org-capture' template string for new Hugo post.
See `org-capture-templates' for more information."
(let* ((title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title
(fname (org-hugo-slug title)))
(mapconcat #'identity
`(
,(concat "*** TODO " title)
":PROPERTIES:"
,(concat ":EXPORT_FILE_NAME: " fname)
":EXPORT_HUGO_CUSTOM_FRONT_MATTER: :share true :featured false :slug :image "
":EXPORT_DESCRIPTION: "
":END:"
"%?\n") ;Place the cursor here finally
"\n"))))
)
;; org-babel
(leaf ob
:after org
:defun org-babel-do-load-languages
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)
(python . t)
(R . t)
(ditaa . t)
(plantuml . t)
))
;; Ditaa jar path
;; cf. https://tamura70.hatenadiary.org/entry/20100317/org
(when (eq system-type 'windows-nt)
(setq org-ditaa-jar-path (expand-file-name "~/jditaa.jar")) ;; CHANGEME
)
(when (eq system-type 'gnu/linux)
(setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar")
)
(add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
;; PlantUML jar path
(when (eq system-type 'windows-nt)
(setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) ;; CHANGEME
)
(when (eq system-type 'gnu/linux)
(setq org-plantuml-jar-path "/usr/share/plantuml/plantuml.jar")
)
)
;; org-superstar
(leaf org-superstar
:after org
:straight t
:custom
(org-superstar-headline-bullets-list . '("◉" "★" "○" "▷" "" ""))
:hook
(org-mode-hook (lambda () (org-superstar-mode 1)))
)
;; org-journal
(leaf org-journal
:after org
:straight t
:config
(setq org-journal-dir (concat org-directory "/journal")
org-journal-enable-agenda-integration t)
(defun org-journal-find-location ()
;; Open today's journal, but specify a non-nil prefix argument in order to
;; inhibit inserting the heading; org-capture will insert the heading.
(org-journal-new-entry t)
;; Position point on the journal's top-level heading so that org-capture
;; will add the new entry as a child entry.
(goto-char (point-min))
)
)
;; org-cliplink
(leaf org-cliplink
:after org
:straight t
:bind
("C-x p i" . org-cliplink)
)
;; org-download
(leaf org-download
:after org
:straight t
:config
(setq-default org-download-image-dir (concat org-directory "/pictures"))
)
;; org-web-tools
(leaf org-web-tools
:after org
:straight t
)
;; toc-org
(leaf toc-org
:after org markdown-mode
:straight t
;;:commands toc-org-enable
:config
(add-hook 'org-mode-hook 'toc-org-enable)
;; enable in markdown, too
(add-hook 'markdown-mode-hook 'toc-org-mode)
(define-key markdown-mode-map (kbd "\C-c\C-o") 'toc-org-markdown-follow-thing-at-point)
)
;; ox-hugo
(leaf ox-hugo
:after ox
:straight t
:require t
)
;; ox-qmd
(leaf ox-qmd
:after ox
:straight t
:require t
)
;; org2blog
(leaf org2blog
:after org
;; the latest version doesn't work
:straight (org2blog :type git :host github :repo "sachac/org2blog")
:leaf-autoload org2blog-autoloads
:commands org2blog-user-login
:config
(setq org2blog/wp-use-sourcecode-shortcode t)
(setq org2blog/wp-blog-alist
`(("wordpress1"
:url "https://www.example.com/xmlrpc.php" ;; CHANGEME
:username ,(car (auth-source-user-and-password "wordpress1")) ;; CHANGEME
:password ,(cadr (auth-source-user-and-password "wordpress1")) ;; CHANGEME
)
))
(setq org2blog/wp-buffer-template
"#+TITLE:
#+CATEGORY:
#+TAGS:
#+OPTIONS:
#+PERMALINK: \n")
)
;; org-roam
(leaf org-roam
:straight t
:after org
:bind
("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today)
:config
(setq org-roam-directory (concat org-directory "/org-roam"))
(unless (file-exists-p org-directory)
(make-directory org-roam-directory))
;; If you're using a vertical completion framework, you might want a more informative completion interface
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
(org-roam-db-autosync-mode)
;; If using org-roam-protocol
(require 'org-roam-protocol)
)
;; org-roam-ui
(leaf org-roam-ui
:straight (org-roam-ui :host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
:after org-roam
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t)
)
)
;;;
;;; Modes
;;;
(leaf Modes
:config
;; C/C++
(leaf cc-mode
:straight t
:leaf-defer t
)
;; Python
(leaf python-mode
:straight t
:leaf-defer t
)
;; Markdown
(leaf Markdown
:config
;; markdown-mode
(leaf markdown-mode
:straight t
:leaf-defer t
:mode ("\\.md\\'" . gfm-mode)
)
;; markdown-preview-mode
(leaf markdown-preview-mode
:straight t
)
)
;; web-mode
(leaf web-mode
:straight t
:leaf-defer t
:after flycheck
:defun flycheck-add-mode
:mode (("\\.html?\\'" . web-mode)
("\\js\\'" . web-mode)
("\\.jscss\\'" . web-mode)
("\\.css\\'" . web-mode)
("\\.scss\\'" . web-mode)
("\\.xml\\'" . web-mode))
:config
(flycheck-add-mode 'javascript-eslint 'web-mode)
)
;; plantuml-mode
(leaf plantuml-mode
:straight t
:leaf-defer t
:mode ("\\.plantuml\\'" . plantuml-mode)
:config
(setq plantuml-default-exec-mode 'jar)
;; PlantUML jar path
(when (eq system-type 'windows-nt)
(setq plantuml-jar-path (expand-file-name "~/plantuml.jar")) ;; CHANGEME
)
(when (eq system-type 'gnu/linux)
(setq plantuml-jar-path "/usr/share/plantuml/plantuml.jar")
)
)
;; rainbow-mode
(leaf rainbow-mode
:straight t
:leaf-defer t
:blackout t
:hook
(web-mode-hook . rainbow-mode)
)
)
;;;
;;; Flycheck
;;;
(leaf Flycheck
:config
;; flycheck
(leaf flycheck
:straight t
:blackout t
:hook
(prog-mode-hook . flycheck-mode)
:custom ((flycheck-display-errors-delay . 0.3)
(flycheck-indication-mode . 'left-margin))
;; :global-minor-mode global-flycheck-mode ;; CHANGEME
:config
(add-hook 'flycheck-mode-hook #'flycheck-set-indication-mode)
(leaf flycheck-posframe
:straight t
:after flycheck
:hook (flycheck-mode-hook . flycheck-posframe-mode)
:config
(flycheck-posframe-configure-pretty-defaults)
)
)
;; checker for textlint
(flycheck-define-checker textlint
"A linter for prose."
:command ("textlint" "--format" "unix" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(id (one-or-more (not (any " "))))
(message (one-or-more not-newline)
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
line-end))
:modes (text-mode markdown-mode gfm-mode org-mode web-mode))
)
;;;
;;; Tree-sitter
;;;
(leaf Tree-sitter
;; tree-sitter
(leaf tree-sitter
:straight t
)
(leaf tree-sitter-langs
:straight t
)
)
;;;
;;; Misc Tools
;;;
(leaf Tools
:config
;; smartparens
(leaf smartparens
:straight t
:blackout t
:require smartparens-config
:hook
(prog-mode-hook . turn-on-smartparens-mode)
:global-minor-mode show-smartparens-global-mode
)
;; rainbow-delimiters
(leaf rainbow-delimiters
:straight t
:hook
(prog-mode-hook . rainbow-delimiters-mode)
)
;; beacon
(leaf beacon
:straight t
:blackout t
:global-minor-mode beacon-mode
)
;; google-this
(leaf google-this
:straight t
:bind
("M-s g" . google-this-noconfirm)
)
;; which-key
(leaf which-key
:straight t
:blackout which-key-mode
:config
(which-key-mode)
)
;; free-keys
(leaf free-keys
:straight t
)
;; popwin
(leaf popwin
:straight t
:global-minor-mode popwin-mode
)
;; ripgrep
(leaf ripgrep
:straight t
:bind
("M-s r" . ripgrep-regexp)
)
;; projectile
(leaf projectile
:straight t
:blackout t
:config
(projectile-mode t)
)
;; yasnippet
(leaf yasnippet
:straight t
:blackout yas-minor-mode
:commands yas-global-mode
:hook (after-init-hook . yas-global-mode)
:custom
(yas-snippet-dirs . '("~/.emacs.d/yasnippets")) ;; CHANGEME
)
;; atomic-chrome
(leaf atomic-chrome
:straight t
:config
(atomic-chrome-start-server)
)
;; twittering-mode
(leaf twittering-mode
:straight t
:init
(setq twittering-use-master-password t)
(setq twittering-allow-insecure-server-cert t)
(when (eq system-type 'windows-nt)
(setq twittering-curl-program "~/scoop/apps/curl/current/bin/curl.exe")
)
)
;; restart-emacs
(leaf restart-emacs
:straight t
)
;; magit
(leaf magit
:straight t
:bind
("C-x g" . magit-status)
)
;; easy-hugo
(leaf easy-hugo
:straight t
:config
(setq easy-hugo-basedir "~/Hugo/myhugoblog") ;; CHANGEME
(setq easy-hugo-url "https://www.myhugoblog.org") ;; CHANGEME
(setq easy-hugo-bloglist
'(((easy-hugo-basedir . "~/Hugo/anotherhugoblog") ;; CHANGEME
(easy-hugo-url . "https://www.anotherhugoblog.org")))) ;; CHANGEME
)
;; go-translate
(leaf go-translate
:straight t