summaryrefslogtreecommitdiffstats
path: root/Emacs.org
diff options
context:
space:
mode:
Diffstat (limited to 'Emacs.org')
-rw-r--r--Emacs.org319
1 files changed, 270 insertions, 49 deletions
diff --git a/Emacs.org b/Emacs.org
index e531e89..3b24b1b 100644
--- a/Emacs.org
+++ b/Emacs.org
@@ -5,8 +5,9 @@
5* Table of contents :toc: 5* Table of contents :toc:
6- [[#startup-performance][Startup Performance]] 6- [[#startup-performance][Startup Performance]]
7- [[#user-information-setup][User information setup]] 7- [[#user-information-setup][User information setup]]
8- [[#keep-clean][Keep clean]] 8- [[#stay-clean][Stay clean]]
9- [[#package-setup][Package setup]] 9- [[#package-setup][Package setup]]
10- [[#update-path][Update Path]]
10- [[#keboard-setup][Keboard Setup]] 11- [[#keboard-setup][Keboard Setup]]
11 - [[#general-setup][General Setup]] 12 - [[#general-setup][General Setup]]
12 - [[#evil-mode-setup][Evil mode setup]] 13 - [[#evil-mode-setup][Evil mode setup]]
@@ -15,10 +16,12 @@
15 - [[#ivy-and-counsel][Ivy and Counsel]] 16 - [[#ivy-and-counsel][Ivy and Counsel]]
16 - [[#which-key][Which key]] 17 - [[#which-key][Which key]]
17 - [[#modline][Modline]] 18 - [[#modline][Modline]]
19 - [[#hydra][Hydra]]
18 - [[#beacon][Beacon]] 20 - [[#beacon][Beacon]]
19 - [[#other-keybindings][Other Keybindings]] 21 - [[#other-keybindings][Other Keybindings]]
20- [[#org][Org]] 22- [[#org][Org]]
21 - [[#org-mode-setup][Org-mode setup]] 23 - [[#org-mode-setup][Org-mode setup]]
24 - [[#org-evil][Org evil]]
22 - [[#org-make-toc][Org make toc]] 25 - [[#org-make-toc][Org make toc]]
23 - [[#org-fonts][Org fonts]] 26 - [[#org-fonts][Org fonts]]
24 - [[#org-tempo-setup][Org tempo setup]] 27 - [[#org-tempo-setup][Org tempo setup]]
@@ -37,6 +40,9 @@
37 - [[#vterm][Vterm]] 40 - [[#vterm][Vterm]]
38 - [[#dired][Dired]] 41 - [[#dired][Dired]]
39 - [[#emms][EMMS]] 42 - [[#emms][EMMS]]
43 - [[#pdf-tools][PDF Tools]]
44 - [[#mu4e][Mu4e]]
45- [[#runtime-performance][Runtime Performance]]
40 46
41* Startup Performance 47* Startup Performance
42 48
@@ -102,6 +108,12 @@
102 108
103#+end_src 109#+end_src
104 110
111* Update Path
112
113#+begin_src emacs-lisp
114 (push ".config/emacs/jd/" load-path)
115#+end_src
116
105* Keboard Setup 117* Keboard Setup
106** General Setup 118** General Setup
107 119
@@ -134,9 +146,12 @@
134 (setq evil-want-integration t) 146 (setq evil-want-integration t)
135 (setq evil-want-keybinding nil) 147 (setq evil-want-keybinding nil)
136 (setq evil-want-C-u-scroll t) 148 (setq evil-want-C-u-scroll t)
137 (setq evil-want-C-i-jump nil) 149 (setq evil-want-Y-yank-to-eol t)
150 (setq evil-want-C-i-jump nil)
138 (setq evil-undo-system 'undo-tree) 151 (setq evil-undo-system 'undo-tree)
152 (setq evil-kill-on-visual-paste nil)
139 :config 153 :config
154 (evil-set-initial-state 'exwm-mode 'emacs)
140 (evil-mode 1)) 155 (evil-mode 1))
141 156
142 (use-package evil-collection 157 (use-package evil-collection
@@ -150,13 +165,21 @@
150 165
151#+begin_src emacs-lisp 166#+begin_src emacs-lisp
152 167
168 (defhydra hydra-resize-window (:timeout 4)
169 ("h" evil-window-decrease-width "<")
170 ("l" evil-window-increase-width ">")
171 ("k" evil-window-decrease-height "^")
172 ("j" evil-window-increase-height "v")
173 ("q" nil "finished" :exit t))
174
153 (jd/leader-key-def 175 (jd/leader-key-def
154 "w" 'evil-window-map 176 "w" 'evil-window-map
177 "wr" '(hydra-resize-window/body :which-key "Rezize window")
155 "wd" '(evil-window-delete :which-key "Window delete")) 178 "wd" '(evil-window-delete :which-key "Window delete"))
156 179
157 (jd/leader-key-def 180 (jd/leader-key-def
158 "ou" '(undo-tree-visualize :which-key "Open")) 181 "ou" '(undo-tree-visualize :which-key "Open"))
159 182
160 ;; remove . key 183 ;; remove . key
161 (define-key evil-normal-state-map (kbd ".") '()) 184 (define-key evil-normal-state-map (kbd ".") '())
162#+end_src 185#+end_src
@@ -182,7 +205,7 @@
182 205
183 (use-package doom-themes 206 (use-package doom-themes
184 :config 207 :config
185 (load-theme 'doom-molokai t)) 208 (load-theme 'doom-badger t))
186 209
187 (use-package diminish) 210 (use-package diminish)
188 211
@@ -205,24 +228,27 @@
205 228
206#+begin_src emacs-lisp 229#+begin_src emacs-lisp
207 230
208 (defun jd/switch-buffer () 231 (defun jd/switch-buffer ()
209 (interactive) 232 (interactive)
210 (let ((completion-regexp-list '("\\`[^*]" 233 (let ((completion-regexp-list '("\\`[^*]"
211 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*"))) 234 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*")))
212 (call-interactively 'counsel-switch-buffer))) 235 (call-interactively 'counsel-switch-buffer)))
213 236
214 (use-package counsel) 237 (use-package ivy
215 (use-package ivy 238 :diminish
216 :diminish 239 :bind
217 :bind 240 (("C-s" . swiper)
218 (("C-s" . swiper) 241 :map ivy-minibuffer-map
219 :map ivy-minibuffer-map 242 ("C-k" . ivy-previous-line)
220 ("C-k" . ivy-previous-line) 243 ("C-j" . ivy-next-line)
221 ("C-j" . ivy-next-line) 244 :map ivy-switch-buffer-map
222 :map ivy-switch-buffer-map 245 ("C-k" . ivy-previous-line))
223 ("C-k" . ivy-previous-line)) 246 :config
224 :config 247 (ivy-mode 1))
225 (ivy-mode 1)) 248
249 (use-package counsel
250 :config
251 (counsel-mode 1))
226 252
227#+end_src 253#+end_src
228 254
@@ -266,6 +292,41 @@
266 292
267#+end_src 293#+end_src
268 294
295** Hydra
296
297#+begin_src emacs-lisp
298
299 (use-package hydra
300 :defer t)
301
302 (defun jd/text-scale-increase ()
303 (interactive)
304 (let ((old-face-attribute (face-attribute 'default :height)))
305 (set-face-attribute 'default nil :height (+ old-face-attribute 10))))
306
307 (defun jd/text-scale-decrease ()
308 (interactive)
309 (let ((old-face-attribute (face-attribute 'default :height)))
310 (set-face-attribute 'default nil :height (- old-face-attribute 10))))
311
312 (defhydra hydra-text-scale-global (:timeout 4)
313 "scale text"
314 ("j" jd/text-scale-increase "in")
315 ("k" jd/text-scale-decrease "out")
316 ("q" nil "finished" :exit t))
317
318 (defhydra hydra-text-scale (:timeout 4)
319 "scale text"
320 ("j" text-scale-increase "in")
321 ("k" text-scale-decrease "out")
322 ("q" nil "finished" :exit t))
323
324 (jd/leader-key-def
325 "tS" '(hydra-text-scale-global/body :which-key "Scale text")
326 "ts" '(hydra-text-scale/body :which-key "Scale text"))
327
328#+end_src
329
269** Beacon 330** Beacon
270 331
271#+begin_src emacs-lisp 332#+begin_src emacs-lisp
@@ -333,14 +394,34 @@
333 :pin org 394 :pin org
334 :commands (org-capture org-agenda) 395 :commands (org-capture org-agenda)
335 :hook (org-mode . jd/org-mode-setup) 396 :hook (org-mode . jd/org-mode-setup)
336 :init 397 :config
398 (setq org-directory (file-truename "~/Documents/org/"))
399 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
400 (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
401 (setq org-agenda-files
402 '("Tasks.org"))
337 (setq org-ellipsis " ▾") 403 (setq org-ellipsis " ▾")
338 (setq org-agenda-start-with-log-mode t) 404 (setq org-agenda-start-with-log-mode t)
339 (setq org-log-done 'time) 405 (setq org-log-done 'time)
340 (setq org-log-into-drawer t) 406 (setq org-log-into-drawer t)
341 (setq org-return-follows-link t) 407 (setq org-return-follows-link t)
342 :config 408 (setq org-capture-templates
343 (menu-bar--display-line-numbers-mode-none) 409 `(("t" "Tasks / Projects")
410 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
411 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
412 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
413 "* TODO %?\n %t\n SCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+1d\"))\n %a\n %i" :empty-lines 1)
414
415 ("m" "Metrics Capture")
416 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
417 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)))
418
419 (setq org-latex-listings 'minted
420 org-latex-packages-alist '(("" "minted"))
421 org-latex-pdf-process
422 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
423 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
424
344 (require 'org-tempo)) 425 (require 'org-tempo))
345 426
346#+end_src 427#+end_src
@@ -350,11 +431,27 @@
350#+begin_src emacs-lisp 431#+begin_src emacs-lisp
351 432
352 (jd/leader-key-def 433 (jd/leader-key-def
353 "o" '(:ignore t :which-key "Open") 434 "o" '(:ignore t :which-key "Open/Org")
435 "oc" '(org-capture :which-key "Open org-capture")
436 "oop" '(org-mobile-pull :which-key "Org mobile pull")
437 "ooP" '(org-mobile-push :which-key "Org mobile push")
354 "oa" '(org-agenda :which-key "Open org-agenda")) 438 "oa" '(org-agenda :which-key "Open org-agenda"))
355 439
356#+end_src 440#+end_src
357 441
442** Org evil
443
444#+begin_src emacs-lisp
445
446 (use-package evil-org
447 :after org
448 :hook (org-mode . (lambda () evil-org-mode))
449 :config
450 (require 'evil-org-agenda)
451 (evil-org-agenda-set-keys))
452
453#+end_src
454
358** Org make toc 455** Org make toc
359 456
360#+begin_src emacs-lisp 457#+begin_src emacs-lisp
@@ -408,6 +505,8 @@
408#+begin_src emacs-lisp 505#+begin_src emacs-lisp
409 506
410 (defun jd/org-tempo-setup () 507 (defun jd/org-tempo-setup ()
508 (add-to-list 'org-structure-template-alist '("s" . "src"))
509 (add-to-list 'org-structure-template-alist '("sql" . "src sql"))
411 (add-to-list 'org-structure-template-alist '("sh" . "src sh")) 510 (add-to-list 'org-structure-template-alist '("sh" . "src sh"))
412 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) 511 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
413 (add-to-list 'org-structure-template-alist '("li" . "src lisp")) 512 (add-to-list 'org-structure-template-alist '("li" . "src lisp"))
@@ -423,6 +522,17 @@
423 522
424** Org babel setup 523** Org babel setup
425 524
525*** Load languages
526
527#+begin_src emacs-lisp
528
529 (org-babel-do-load-languages
530 'org-babel-load-languages
531 '((emacs-lisp . t)
532 (python . t)))
533
534#+end_src
535
426*** Auto tangle 536*** Auto tangle
427 537
428#+begin_src emacs-lisp 538#+begin_src emacs-lisp
@@ -469,6 +579,20 @@
469 579
470#+begin_src emacs-lisp 580#+begin_src emacs-lisp
471 581
582 (defun jd/org-roam-filter-by-tag (tag-name)
583 (lambda (node)
584 (member tag-name (org-roam-node-tags node))))
585
586 (defun jd/org-roam-list-notes-by-tag (tag-name)
587 (mapcar #'org-roam-node-file
588 (seq-filter
589 (jd/org-roam-filter-by-tag tag-name)
590 (org-roam-node-list))))
591
592 (defun jd/org-roam-refreshagenda-list ()
593 (interactive)
594 (setq org-agenda-files (org-roam-list-files)))
595
472 (use-package org-roam 596 (use-package org-roam
473 :custom 597 :custom
474 (org-roam-directory (file-truename "~/Documents/org/roam/")) 598 (org-roam-directory (file-truename "~/Documents/org/roam/"))
@@ -479,6 +603,8 @@
479 ("C-c n c" . org-roam-capture) 603 ("C-c n c" . org-roam-capture)
480 ;; Dailies 604 ;; Dailies
481 ("C-c n j" . org-roam-dailies-capture-today)) 605 ("C-c n j" . org-roam-dailies-capture-today))
606 :bind-keymap
607 ("C-c n d" . org-roam-dailies-map)
482 :config 608 :config
483 ;; If you're using a vertical completion framework, you might want a more informative completion interface 609 ;; If you're using a vertical completion framework, you might want a more informative completion interface
484 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) 610 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
@@ -519,11 +645,77 @@
519 645
520 (use-package python-mode 646 (use-package python-mode
521 :hook (python-mode . lsp-deferred) 647 :hook (python-mode . lsp-deferred)
522 :hook (python-mode . jd/python-mode-setup)) 648 :hook (python-mode . jd/python-mode-setup)
649 :config
650 (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)))
523 651
524 (use-package pyvenv 652 (use-package pyvenv
525 :after python-mode) 653 :after python-mode)
526 654
655 (use-package django-mode
656 :config
657 ;; Remove all django-mode objects from auto-mode-alist
658 (while (rassq 'django-mode auto-mode-alist)
659 (let ((django-mode-object (rassq 'django-mode auto-mode-alist)))
660 (setq auto-mode-alist (delete django-mode-object auto-mode-alist)))))
661
662#+end_src
663
664*** Java
665
666#+begin_src emacs-lisp
667
668 (use-package lsp-java
669 :config (add-hook 'java-mode-hook 'lsp))
670
671#+end_src
672
673*** Type Script
674
675#+begin_src emacs-lisp
676
677 (use-package typescript-mode
678 :config
679 (setq typescript-indent-level 2)
680 (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)))
681
682 (use-package tide
683 :ensure t
684 :after (typescript-mode company)
685 :hook ((typescript-mode . tide-setup)
686 (typescript-mode . tide-hl-identifier-mode)))
687
688 (use-package flycheck
689 :ensure t
690 :hook ((after-init . global-flycheck-mode)))
691
692#+end_src
693
694*** Yaml
695
696#+begin_src emacs-lisp
697
698 (use-package yaml-mode)
699
700#+end_src
701
702*** Docker
703
704#+begin_src emacs-lisp
705
706 (use-package docker)
707
708#+end_src
709
710**** Keybinds
711
712#+begin_src emacs-lisp
713
714 (jd/leader-key-def
715 "d" '(:ignore t :which-key "Docker")
716 "dc" '(docker-containers :which-key "Docker containers")
717 "dd" '(docker :which-key "Docker"))
718
527#+end_src 719#+end_src
528 720
529** Dap mode 721** Dap mode
@@ -554,19 +746,21 @@
554 746
555#+begin_src emacs-lisp 747#+begin_src emacs-lisp
556 748
557 (use-package company 749 (use-package company
558 :after lsp-mode 750 :after lsp-mode
559 :hook (lsp-mode . company-mode) 751 :hook (lsp-mode . company-mode)
560 :bind (:map company-active-map 752 :bind (:map company-active-map
561 ("<tab>" . company-complete-selection)) 753 ("<tab>" . company-complete-selection))
562 (:map lsp-mode-map 754 (:map lsp-mode-map
563 ("<tab>" . company-indent-or-complete-common)) 755 ("<tab>" . company-indent-or-complete-common))
564 :custom 756 :custom
565 (company-minimum-prefix-length 1) 757 (company-minimum-prefix-length 1)
566 (company-idle-delay 0.0)) 758 (company-idle-delay 0.0)
759 :config
760 (global-company-mode))
567 761
568 (use-package company-box 762 (use-package company-box
569 :hook (company-mode . company-box-mode)) 763 :hook (company-mode . company-box-mode))
570 764
571#+end_src 765#+end_src
572 766
@@ -659,20 +853,23 @@
659#+end_src 853#+end_src
660 854
661* Apps 855* Apps
662
663** Vterm 856** Vterm
664 857
665#+begin_src emacs-lisp 858#+begin_src emacs-lisp
666 859
667 (defun jd/open-new-vterm () 860 (defun jd/open-new-vterm (&optional jd/vterm-buffer-name)
668 (interactive) 861 (interactive)
669 (let ((buffer-name (generate-new-buffer-name vterm-buffer-name))) 862 (let ((buffer-name (generate-new-buffer-name vterm-buffer-name)))
863 (when jd/vterm-buffer-name
864 (setq buffer-name jd/vterm-buffer-name))
670 (switch-to-buffer buffer-name) 865 (switch-to-buffer buffer-name)
671 (vterm-mode))) 866 (vterm-mode)))
672 867
868
673 (use-package vterm 869 (use-package vterm
674 :config 870 :config
675 (setq vterm-buffer-name "vterm")) 871 (setq vterm-buffer-name "vterm")
872 (evil-set-initial-state 'vterm-mode 'emacs))
676 873
677#+end_src 874#+end_src
678 875
@@ -714,13 +911,37 @@
714 911
715#+begin_src emacs-lisp 912#+begin_src emacs-lisp
716 913
717 (use-package emms 914 (use-package emms
718 :config 915 :config
719 (require 'emms-setup) 916 (require 'emms-setup)
720 (emms-all) 917 (emms-all)
721 (emms-standard) 918 (emms-standard)
722 (emms-default-players) 919 (emms-default-players)
723 (emms-mode-line-disable) 920 (emms-mode-line-disable)
724 (emms-add-directory-tree "~/Documents/music/")) 921 ; (setq emms-info-functions '(emms-info-tinytag))
922 (setq emms-browser-covers 'emms-browser-cache-thumbnail-async)
923 (setq emms-lyrics-dir "~/Documents/music/lyrics")
924 (emms-add-directory-tree "~/Documents/music/"))
925
926#+end_src
725 927
928** PDF Tools
929
930#+begin_src emacs-lisp
931
932 (use-package pdf-tools)
933
934#+end_src
935
936** Mu4e
937
938#+begin_src emacs-lisp
939 ;; Load my mu4e config
940 (require 'jd-mu4e)
941#+end_src
942
943* Runtime Performance
944
945#+begin_src emacs-lisp
946 (setq gc-cons-threshold (* 2 1000 1000))
726#+end_src 947#+end_src