summaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/init.el174
1 files changed, 162 insertions, 12 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index b9a465c..c33d57c 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -38,6 +38,8 @@
38 38
39(require 'use-package) 39(require 'use-package)
40 40
41(push ".config/emacs/jd/" load-path)
42
41(use-package general 43(use-package general
42 :config 44 :config
43 (general-create-definer jd/leader-key-def 45 (general-create-definer jd/leader-key-def
@@ -59,9 +61,12 @@
59 (setq evil-want-integration t) 61 (setq evil-want-integration t)
60 (setq evil-want-keybinding nil) 62 (setq evil-want-keybinding nil)
61 (setq evil-want-C-u-scroll t) 63 (setq evil-want-C-u-scroll t)
62 (setq evil-want-C-i-jump nil) 64 (setq evil-want-Y-yank-to-eol t)
65 (setq evil-want-C-i-jump nil)
63 (setq evil-undo-system 'undo-tree) 66 (setq evil-undo-system 'undo-tree)
67 (setq evil-kill-on-visual-paste nil)
64 :config 68 :config
69 (evil-set-initial-state 'exwm-mode 'emacs)
65 (evil-mode 1)) 70 (evil-mode 1))
66 71
67(use-package evil-collection 72(use-package evil-collection
@@ -69,8 +74,16 @@
69 :config 74 :config
70 (evil-collection-init)) 75 (evil-collection-init))
71 76
77(defhydra hydra-resize-window (:timeout 4)
78 ("h" evil-window-decrease-width "<")
79 ("l" evil-window-increase-width ">")
80 ("k" evil-window-decrease-height "^")
81 ("j" evil-window-increase-height "v")
82 ("q" nil "finished" :exit t))
83
72(jd/leader-key-def 84(jd/leader-key-def
73 "w" 'evil-window-map 85 "w" 'evil-window-map
86 "wr" '(hydra-resize-window/body :which-key "Rezize window")
74 "wd" '(evil-window-delete :which-key "Window delete")) 87 "wd" '(evil-window-delete :which-key "Window delete"))
75 88
76(jd/leader-key-def 89(jd/leader-key-def
@@ -96,7 +109,7 @@
96 109
97(use-package doom-themes 110(use-package doom-themes
98 :config 111 :config
99 (load-theme 'doom-molokai t)) 112 (load-theme 'doom-badger t))
100 113
101(use-package diminish) 114(use-package diminish)
102 115
@@ -115,7 +128,6 @@
115 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*"))) 128 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*")))
116 (call-interactively 'counsel-switch-buffer))) 129 (call-interactively 'counsel-switch-buffer)))
117 130
118(use-package counsel)
119(use-package ivy 131(use-package ivy
120 :diminish 132 :diminish
121 :bind 133 :bind
@@ -128,6 +140,10 @@
128 :config 140 :config
129 (ivy-mode 1)) 141 (ivy-mode 1))
130 142
143(use-package counsel
144 :config
145 (counsel-mode 1))
146
131(jd/leader-key-def 147(jd/leader-key-def
132 "t" '(:ignore t :which-key "Toogle") 148 "t" '(:ignore t :which-key "Toogle")
133 "tt" '(counsel-load-theme :which-key "Choose theme")) 149 "tt" '(counsel-load-theme :which-key "Choose theme"))
@@ -150,6 +166,35 @@
150 :init (doom-modeline-mode 1) 166 :init (doom-modeline-mode 1)
151 :custom ((doom-modeline-height 15))) 167 :custom ((doom-modeline-height 15)))
152 168
169(use-package hydra
170 :defer t)
171
172(defun jd/text-scale-increase ()
173 (interactive)
174 (let ((old-face-attribute (face-attribute 'default :height)))
175 (set-face-attribute 'default nil :height (+ old-face-attribute 10))))
176
177(defun jd/text-scale-decrease ()
178 (interactive)
179 (let ((old-face-attribute (face-attribute 'default :height)))
180 (set-face-attribute 'default nil :height (- old-face-attribute 10))))
181
182(defhydra hydra-text-scale-global (:timeout 4)
183 "scale text"
184 ("j" jd/text-scale-increase "in")
185 ("k" jd/text-scale-decrease "out")
186 ("q" nil "finished" :exit t))
187
188(defhydra hydra-text-scale (:timeout 4)
189 "scale text"
190 ("j" text-scale-increase "in")
191 ("k" text-scale-decrease "out")
192 ("q" nil "finished" :exit t))
193
194(jd/leader-key-def
195 "tS" '(hydra-text-scale-global/body :which-key "Scale text")
196 "ts" '(hydra-text-scale/body :which-key "Scale text"))
197
153(use-package beacon 198(use-package beacon
154 :config 199 :config
155 (beacon-mode 1)) 200 (beacon-mode 1))
@@ -173,7 +218,7 @@
173 (mapc 'kill-buffer (cdr (buffer-list (current-buffer))))) 218 (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))))
174 219
175(jd/leader-key-def 220(jd/leader-key-def
176 "bK" '(jd/kill-other-buffers :which-key "Kill other buffers")) 221 "bK" '(jd/kill-other-buffers :which-key "Kill other buffers")
177 "bk" '(kill-current-buffer :which-key "Kill buffer") 222 "bk" '(kill-current-buffer :which-key "Kill buffer")
178 "bB" '(ibuffer :which-key "Open ibuffer")) 223 "bB" '(ibuffer :which-key "Open ibuffer"))
179 224
@@ -186,20 +231,50 @@
186 :pin org 231 :pin org
187 :commands (org-capture org-agenda) 232 :commands (org-capture org-agenda)
188 :hook (org-mode . jd/org-mode-setup) 233 :hook (org-mode . jd/org-mode-setup)
189 :init 234 :config
235 (setq org-directory (file-truename "~/Documents/org/"))
236 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
237 (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
238 (setq org-agenda-files
239 '("Tasks.org"))
190 (setq org-ellipsis " ▾") 240 (setq org-ellipsis " ▾")
191 (setq org-agenda-start-with-log-mode t) 241 (setq org-agenda-start-with-log-mode t)
192 (setq org-log-done 'time) 242 (setq org-log-done 'time)
193 (setq org-log-into-drawer t) 243 (setq org-log-into-drawer t)
194 (setq org-return-follows-link t) 244 (setq org-return-follows-link t)
195 :config 245 (setq org-capture-templates
196 (menu-bar--display-line-numbers-mode-none) 246 `(("t" "Tasks / Projects")
247 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
248 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
249 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
250 "* TODO %?\n %t\n SCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+1d\"))\n %a\n %i" :empty-lines 1)
251
252 ("m" "Metrics Capture")
253 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
254 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)))
255
256 (setq org-latex-listings 'minted
257 org-latex-packages-alist '(("" "minted"))
258 org-latex-pdf-process
259 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
260 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
261
197 (require 'org-tempo)) 262 (require 'org-tempo))
198 263
199(jd/leader-key-def 264(jd/leader-key-def
200 "o" '(:ignore t :which-key "Open") 265 "o" '(:ignore t :which-key "Open/Org")
266 "oc" '(org-capture :which-key "Open org-capture")
267 "oop" '(org-mobile-pull :which-key "Org mobile pull")
268 "ooP" '(org-mobile-push :which-key "Org mobile push")
201 "oa" '(org-agenda :which-key "Open org-agenda")) 269 "oa" '(org-agenda :which-key "Open org-agenda"))
202 270
271(use-package evil-org
272 :after org
273 :hook (org-mode . (lambda () evil-org-mode))
274 :config
275 (require 'evil-org-agenda)
276 (evil-org-agenda-set-keys))
277
203(use-package toc-org 278(use-package toc-org
204 :config 279 :config
205 (add-hook 'org-mode-hook 'toc-org-mode)) 280 (add-hook 'org-mode-hook 'toc-org-mode))
@@ -237,6 +312,8 @@
237(with-eval-after-load 'org-faces (jd/org-font-setup)) 312(with-eval-after-load 'org-faces (jd/org-font-setup))
238 313
239(defun jd/org-tempo-setup () 314(defun jd/org-tempo-setup ()
315 (add-to-list 'org-structure-template-alist '("s" . "src"))
316 (add-to-list 'org-structure-template-alist '("sql" . "src sql"))
240 (add-to-list 'org-structure-template-alist '("sh" . "src sh")) 317 (add-to-list 'org-structure-template-alist '("sh" . "src sh"))
241 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) 318 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
242 (add-to-list 'org-structure-template-alist '("li" . "src lisp")) 319 (add-to-list 'org-structure-template-alist '("li" . "src lisp"))
@@ -248,6 +325,11 @@
248 325
249(with-eval-after-load 'org-tempo (jd/org-tempo-setup)) 326(with-eval-after-load 'org-tempo (jd/org-tempo-setup))
250 327
328(org-babel-do-load-languages
329 'org-babel-load-languages
330 '((emacs-lisp . t)
331 (python . t)))
332
251(defun jd/org-babel-tangle-config () 333(defun jd/org-babel-tangle-config ()
252 (when (string-equal (file-name-directory (buffer-file-name)) 334 (when (string-equal (file-name-directory (buffer-file-name))
253 (expand-file-name "~/dotfiles/")) 335 (expand-file-name "~/dotfiles/"))
@@ -272,6 +354,20 @@
272 (setq org-superstar-remove-leading-stars t) 354 (setq org-superstar-remove-leading-stars t)
273 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) 355 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
274 356
357(defun jd/org-roam-filter-by-tag (tag-name)
358 (lambda (node)
359 (member tag-name (org-roam-node-tags node))))
360
361(defun jd/org-roam-list-notes-by-tag (tag-name)
362 (mapcar #'org-roam-node-file
363 (seq-filter
364 (jd/org-roam-filter-by-tag tag-name)
365 (org-roam-node-list))))
366
367(defun jd/org-roam-refreshagenda-list ()
368 (interactive)
369 (setq org-agenda-files (org-roam-list-files)))
370
275(use-package org-roam 371(use-package org-roam
276 :custom 372 :custom
277 (org-roam-directory (file-truename "~/Documents/org/roam/")) 373 (org-roam-directory (file-truename "~/Documents/org/roam/"))
@@ -282,6 +378,8 @@
282 ("C-c n c" . org-roam-capture) 378 ("C-c n c" . org-roam-capture)
283 ;; Dailies 379 ;; Dailies
284 ("C-c n j" . org-roam-dailies-capture-today)) 380 ("C-c n j" . org-roam-dailies-capture-today))
381 :bind-keymap
382 ("C-c n d" . org-roam-dailies-map)
285 :config 383 :config
286 ;; If you're using a vertical completion framework, you might want a more informative completion interface 384 ;; If you're using a vertical completion framework, you might want a more informative completion interface
287 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) 385 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
@@ -308,11 +406,47 @@
308 406
309(use-package python-mode 407(use-package python-mode
310 :hook (python-mode . lsp-deferred) 408 :hook (python-mode . lsp-deferred)
311 :hook (python-mode . jd/python-mode-setup)) 409 :hook (python-mode . jd/python-mode-setup)
410 :config
411 (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)))
312 412
313(use-package pyvenv 413(use-package pyvenv
314 :after python-mode) 414 :after python-mode)
315 415
416(use-package django-mode
417 :config
418 ;; Remove all django-mode objects from auto-mode-alist
419 (while (rassq 'django-mode auto-mode-alist)
420 (let ((django-mode-object (rassq 'django-mode auto-mode-alist)))
421 (setq auto-mode-alist (delete django-mode-object auto-mode-alist)))))
422
423(use-package lsp-java
424 :config (add-hook 'java-mode-hook 'lsp))
425
426(use-package typescript-mode
427 :config
428 (setq typescript-indent-level 2)
429 (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)))
430
431(use-package tide
432 :ensure t
433 :after (typescript-mode company)
434 :hook ((typescript-mode . tide-setup)
435 (typescript-mode . tide-hl-identifier-mode)))
436
437(use-package flycheck
438 :ensure t
439 :hook ((after-init . global-flycheck-mode)))
440
441(use-package yaml-mode)
442
443(use-package docker)
444
445(jd/leader-key-def
446 "d" '(:ignore t :which-key "Docker")
447 "dc" '(docker-containers :which-key "Docker containers")
448 "dd" '(docker :which-key "Docker"))
449
316(use-package dap-mode 450(use-package dap-mode
317 ;; Uncomment the config below if you want all UI panes to be hidden by default! 451 ;; Uncomment the config below if you want all UI panes to be hidden by default!
318 ;; :custom 452 ;; :custom
@@ -340,7 +474,9 @@
340 ("<tab>" . company-indent-or-complete-common)) 474 ("<tab>" . company-indent-or-complete-common))
341 :custom 475 :custom
342 (company-minimum-prefix-length 1) 476 (company-minimum-prefix-length 1)
343 (company-idle-delay 0.0)) 477 (company-idle-delay 0.0)
478 :config
479 (global-company-mode))
344 480
345(use-package company-box 481(use-package company-box
346 :hook (company-mode . company-box-mode)) 482 :hook (company-mode . company-box-mode))
@@ -397,15 +533,19 @@
397 "g" '(:ignore t :which-key "Git") 533 "g" '(:ignore t :which-key "Git")
398 "gg" '(magit-status-here :which-key "Magit status")) 534 "gg" '(magit-status-here :which-key "Magit status"))
399 535
400(defun jd/open-new-vterm () 536(defun jd/open-new-vterm (&optional jd/vterm-buffer-name)
401 (interactive) 537 (interactive)
402 (let ((buffer-name (generate-new-buffer-name vterm-buffer-name))) 538 (let ((buffer-name (generate-new-buffer-name vterm-buffer-name)))
539 (when jd/vterm-buffer-name
540 (setq buffer-name jd/vterm-buffer-name))
403 (switch-to-buffer buffer-name) 541 (switch-to-buffer buffer-name)
404 (vterm-mode))) 542 (vterm-mode)))
405 543
544
406(use-package vterm 545(use-package vterm
407 :config 546 :config
408 (setq vterm-buffer-name "vterm")) 547 (setq vterm-buffer-name "vterm")
548 (evil-set-initial-state 'vterm-mode 'emacs))
409 549
410(jd/leader-key-def 550(jd/leader-key-def
411 "ot" '(jd/open-new-vterm :which-key "Open terminal in current window")) 551 "ot" '(jd/open-new-vterm :which-key "Open terminal in current window"))
@@ -436,4 +576,14 @@
436 (emms-standard) 576 (emms-standard)
437 (emms-default-players) 577 (emms-default-players)
438 (emms-mode-line-disable) 578 (emms-mode-line-disable)
579 ; (setq emms-info-functions '(emms-info-tinytag))
580 (setq emms-browser-covers 'emms-browser-cache-thumbnail-async)
581 (setq emms-lyrics-dir "~/Documents/music/lyrics")
439 (emms-add-directory-tree "~/Documents/music/")) 582 (emms-add-directory-tree "~/Documents/music/"))
583
584(use-package pdf-tools)
585
586;; Load my mu4e config
587(require 'jd-mu4e)
588
589(setq gc-cons-threshold (* 2 1000 1000))