summaryrefslogtreecommitdiffstats
path: root/.config/emacs/jd-emacs
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2023-07-02 15:07:07 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2023-07-02 15:07:07 +0200
commit6156f86dd5797de5ea4f912b70d38963c6cf4ad4 (patch)
treed578204262209695d995e3f639076e91dcb85354 /.config/emacs/jd-emacs
parentef565a486511cbbb86e0d1f80264b3b57d2ac88a (diff)
downloaddotfiles-6156f86dd5797de5ea4f912b70d38963c6cf4ad4.tar.gz
dotfiles-6156f86dd5797de5ea4f912b70d38963c6cf4ad4.zip
New Emacs config and change location of Emacs home dir.
Diffstat (limited to '.config/emacs/jd-emacs')
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-apps.el88
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-custom.el36
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-dev.el175
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-init.el81
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-keys.el51
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-org-mode.el200
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-ui.el154
7 files changed, 0 insertions, 785 deletions
diff --git a/.config/emacs/jd-emacs/jd-emacs-apps.el b/.config/emacs/jd-emacs/jd-emacs-apps.el
deleted file mode 100644
index 628039d..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-apps.el
+++ /dev/null
@@ -1,88 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defun jd/open-new-vterm (&optional jd/vterm-buffer-name)
7 (interactive)
8 (let ((buffer-name (generate-new-buffer-name vterm-buffer-name)))
9 (when jd/vterm-buffer-name
10 (setq buffer-name jd/vterm-buffer-name))
11 (switch-to-buffer buffer-name)
12 (vterm-mode)))
13
14
15(use-package vterm
16 :init
17 (add-to-list 'project-switch-commands '(project-vterm "Vterm") t)
18 (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode))
19 (setq vterm-copy-exclude-prompt t)
20 :config
21 (setq vterm-buffer-name "vterm")
22 (evil-set-initial-state 'vterm-mode 'emacs)
23 (setq vterm-tramp-shells (append '(("ssh" "/bin/bash")) vterm-tramp-shells)))
24
25(jd/leader-key-def
26 "ot" '(jd/open-new-vterm :which-key "Open terminal in current window"))
27
28(use-package all-the-icons-dired
29 :hook (dired-mode . all-the-icons-dired-mode))
30
31(use-package dired-ranger)
32
33(use-package dired
34 :ensure nil
35 :commands (dired dired-jump)
36 :custom ((dired-listing-switches "-agho --group-directories-first"))
37 :config
38 (evil-collection-define-key 'normal 'dired-mode-map
39 "y" 'dired-ranger-copy
40 "p" 'dired-ranger-paste
41 "X" 'dired-ranger-move
42 "h" 'dired-up-directory
43 "t" 'dired-create-empty-file
44 "T" 'dired-toggle-marks
45 "l" 'dired-find-file)
46 (setq dired-kill-when-opening-new-dired-buffer t)
47 (evil-define-key 'normal dired-mode-map (kbd "q") 'kill-current-buffer))
48
49(use-package emms
50 :config
51 (require 'emms-setup)
52 (emms-all)
53 (emms-standard)
54 (emms-default-players)
55 (emms-mode-line-disable)
56 ; (setq emms-info-functions '(emms-info-tinytag))
57 (setq emms-browser-covers 'emms-browser-cache-thumbnail-async)
58 ;; (setq emms-lyrics-dir "~/Documents/music/lyrics")
59 (emms-add-directory-tree "~/Documents/Music/"))
60
61(use-package pdf-tools)
62
63(require 'jd-mu4e)
64
65(use-package elfeed
66 :config
67 (setq elfeed-feeds
68 '(("https://www.reddit.com/r/emacs.rss" emacs)
69 ("https://www.reddit.com/r/gnu.rss" gnu)
70 ("https://stallman.org/rss/rss.xml" stallman))))
71
72(use-package langtool
73 :config
74 (setq langtool-language-tool-jar "/home/jakub/Documents/LanguageTool-6.0/languagetool-commandline.jar")
75 (setq langtool-default-language "pl-PL"))
76
77(jd/leader-key-def
78 "l" '(:ignore t :which-key "langtool")
79 "lc" 'langtool-check-buffer
80 "ld" 'langtool-check-done
81 "li" 'langtool-interactive-correction)
82
83(use-package mastodon
84 :config
85 (setq mastodon-active-user "jdlugosz963"
86 mastodon-instance-url "https://fosstodon.org/"))
87
88;;; jd-apps.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-custom.el b/.config/emacs/jd-emacs/jd-emacs-custom.el
deleted file mode 100644
index aef824f..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-custom.el
+++ /dev/null
@@ -1,36 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defun jd/generete-qr-from-clipboard ()
7 (interactive)
8 (let ((clipboard-value (x-get-clipboard))
9 (clipboard-file-path "/tmp/clipboard_value.txt")
10 (clipboard-out-image "/tmp/qr.png"))
11 (with-temp-file clipboard-file-path
12 (insert clipboard-value))
13 (shell-command (concat
14 "qrencode -o "
15 clipboard-out-image
16 " < "
17 clipboard-file-path))
18 (find-file clipboard-out-image)))
19
20(defun jd-emacs/erc-notify-sound ()
21 (jd-exwm/run-in-background "mpv /home/jakub/.config/emacs/resources/beep.wav"))
22
23;; (add-hook 'erc-notifications-mode-hook #'jd-emacs/erc-notify-sound)
24
25(setq
26 erc-nick "bobbma"
27 erc-user-full-name "Jakub Dlugosz"
28 erc-notify-list '("akuleszaa"))
29
30;; Define a function to connect to a server
31(defun hipis-znc ()
32 (interactive)
33 (erc :server "195.74.91.18"
34 :port "6697"))
35
36;;; jd-custom.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-dev.el b/.config/emacs/jd-emacs/jd-emacs-dev.el
deleted file mode 100644
index 620a7ad..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-dev.el
+++ /dev/null
@@ -1,175 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq c-default-style "linux"
7 c-basic-offset 8)
8
9(setq gdb-many-windows t)
10
11(use-package lsp-mode
12 :commands (lsp lsp-deferred)
13 :init
14 (setq lsp-headerline-breadcrumb-enable nil)
15 (setq lsp-diagnostics-provider :none)
16 (setq lsp-modeline-diagnostics-enable nil)
17 (setq lsp-keymap-prefix "C-c l")
18 :config
19 (lsp-enable-which-key-integration t))
20
21(use-package lsp-ivy
22 :after lsp)
23
24(use-package paredit)
25(use-package evil-paredit)
26(use-package rainbow-delimiters)
27
28(defun jd/lisp-mode-setup ()
29 (rainbow-delimiters-mode)
30 (evil-paredit-mode)
31 (paredit-mode))
32
33(add-hook 'emacs-startup-hook
34 (lambda ()
35 (add-hook 'scheme-mode-hook 'jd/lisp-mode-setup)
36 (add-hook 'emacs-lisp-mode-hook 'jd/lisp-mode-setup)
37 (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup)
38 (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup)))
39
40
41(evil-define-key 'normal paredit-mode-map (kbd "g h") 'paredit-forward-barf-sexp)
42(evil-define-key 'normal paredit-mode-map (kbd "g l") 'paredit-forward-slurp-sexp)
43
44(evil-define-key 'normal paredit-mode-map (kbd "g H") 'paredit-backward-slurp-sexp)
45(evil-define-key 'normal paredit-mode-map (kbd "g L") 'paredit-backward-barf-sexp)
46
47(use-package geiser)
48(use-package geiser-guile)
49
50(defun jd/python-mode-setup ()
51 (let ((project-venv-path (concat (projectile-project-root) "venv/")))
52 (when (projectile--directory-p project-venv-path)
53 (pyvenv-activate project-venv-path)
54 (pyvenv-mode))))
55
56;; (use-package python-mode ;;TODO: find alternative
57;; :hook (python-mode . lsp-deferred)
58;; :hook (python-mode . jd/python-mode-setup)
59;; :config
60;; (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)))
61
62(use-package pyvenv
63 :after python-mode)
64
65(use-package typescript-mode
66 :mode ("\\.ts\\'")
67 :config
68 (setq typescript-indent-level 2))
69
70(defun jd/activate-tide-mode ()
71 (when (and (stringp buffer-file-name)
72 (string-match "\\.[tj]sx?\\'" buffer-file-name))
73 (tide-setup)
74 (tide-hl-identifier-mode)))
75
76(use-package tide
77 :after (typescript-mode company web-mode))
78
79(use-package flycheck
80 :hook ((after-init . global-flycheck-mode)))
81
82(use-package web-mode
83 :hook ((web-mode . jd/activate-tide-mode))
84 :mode
85 ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'")
86 :config
87 (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'")))
88 (setq web-mode-markup-indent-offset 2)
89 (setq web-mode-css-indent-offset 2)
90 (setq web-mode-code-indent-offset 2)
91 (setq web-mode-script-padding 2)
92 (setq web-mode-block-padding 2)
93 (setq web-mode-style-padding 2)
94 (setq web-mode-enable-auto-pairing t)
95 (setq web-mode-enable-auto-closing t)
96 (setq web-mode-enable-current-element-highlight t))
97
98(use-package yaml-mode)
99
100(use-package docker)
101
102(jd/leader-key-def
103 "d" '(:ignore t :which-key "Docker")
104 "dc" '(docker-containers :which-key "Docker containers")
105 "dd" '(docker :which-key "Docker"))
106
107(use-package company
108 :after lsp-mode
109 :hook (lsp-mode . company-mode)
110 :bind (:map company-active-map
111 ("<tab>" . company-complete-selection))
112 (:map lsp-mode-map
113 ("<tab>" . company-indent-or-complete-common))
114 :custom
115 (company-minimum-prefix-length 1)
116 (company-idle-delay 0.0)
117 :config
118 (global-company-mode))
119
120(use-package company-box
121 :hook (company-mode . company-box-mode))
122
123(use-package projectile
124 :diminish projectile-mode
125 :init
126 (when (file-directory-p "~/Documents/code")
127 (setq projectile-project-search-path '("~/Documents/code/")))
128 :custom ((projectile-Completion-system 'ivy))
129 :config
130 (setq projectile-switch-project-action #'projectile-dired)
131 (projectile-mode))
132
133(jd/leader-key-def
134 "p" '(projectile-command-map :which-key "Project")
135 "p <ESC>" '()
136 "SPC" '(projectile-find-file :which-key "Find file in project"))
137
138(defun jd/neotree-project-dir ()
139 "Open NeoTree using the git root."
140 (interactive)
141 (let ((project-dir (projectile-project-root))
142 (file-name (buffer-file-name)))
143 (neotree-toggle)
144 (if project-dir
145 (if (neo-global--window-exists-p)
146 (progn
147 (neotree-dir project-dir)
148 (neotree-find file-name)))
149 (message "Could not find git project root."))))
150
151(use-package neotree
152 :init
153 (setq neo-theme 'icons)
154 :config
155
156 (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
157 (evil-define-key 'normal neotree-mode-map (kbd "C-RET") 'neotree-quick-look)
158 (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
159 (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
160 (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
161 (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle)
162 (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle))
163
164(jd/leader-key-def
165 "op" '(jd/neotree-project-dir :which-key "Open neotree"))
166
167(use-package magit
168 :custom
169 (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
170
171(jd/leader-key-def
172 "g" '(:ignore t :which-key "Git")
173 "gg" '(magit-status-here :which-key "Magit status"))
174
175;;; jd-dev.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-init.el b/.config/emacs/jd-emacs/jd-emacs-init.el
deleted file mode 100644
index 7f80cac..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-init.el
+++ /dev/null
@@ -1,81 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defvar jd-emacs/directory
7 (concat user-emacs-directory
8 "/jd-emacs/")
9 "Path to jd-emacs config directory.")
10
11(defun jd-emacs/load (file-name)
12 "Load file from jd-emacs directory.
13FILE-NAME - file name to load."
14 (let ((file (expand-file-name (concat jd-emacs/directory
15 "jd-emacs-" file-name ".el"))))
16 (load file)))
17
18(setq gc-cons-threshold (* 2 1000 1000))
19
20
21(defun jd/display-startup-time ()
22 (message "Emacs loaded in %s with %d garbage collections."
23 (format "%.2f seconds"
24 (float-time
25 (time-subtract after-init-time before-init-time)))
26 gcs-done))
27
28
29(defun jd-emacs/startup ()
30 "This procedure will run after Emacs startup."
31 (electric-pair-mode 1)
32 (global-company-mode 1)
33 (jd/display-startup-time))
34
35(setq gc-cons-threshold (* 50 1000 1000))
36(add-hook 'emacs-startup-hook #'jd-emacs/startup)
37
38(setq user-full-name "Jakub Dlugosz"
39 user-mail-address "jdlugosz963@gmail.com")
40
41(setq backup-directory-alist '(("." . "~/.cache/emacs/backup"))
42 backup-by-copying t
43 version-control t
44 delete-old-versions t
45 kept-new-versions 20
46 kept-old-versions 5)
47
48(setq user-emacs-directory "~/.cache/emacs")
49
50(require 'package)
51(setq package-archives '(("melpa" . "https://melpa.org/packages/")
52 ("org" . "https://orgmode.org/elpa/")
53 ("gnu-devel" . "https://elpa.gnu.org/devel/")
54 ("elpa" . "https://elpa.gnu.org/packages/")))
55(package-initialize)
56
57(unless package-archive-contents
58 (package-refresh-contents))
59
60(unless (package-installed-p 'use-package)
61 (package-install 'use-package))
62
63(setq use-package-always-ensure t)
64
65(add-to-list 'load-path (expand-file-name "~/.config/emacs/jd/"))
66
67(require 'use-package)
68
69
70(jd-emacs/load "keys")
71(jd-emacs/load "ui")
72(jd-emacs/load "org-mode")
73(jd-emacs/load "dev")
74(jd-emacs/load "apps")
75(jd-emacs/load "custom")
76
77
78(setq gc-cons-threshold (* 2 1000 1000))
79
80
81;; jd-int.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-keys.el b/.config/emacs/jd-emacs/jd-emacs-keys.el
deleted file mode 100644
index cf7f06c..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-keys.el
+++ /dev/null
@@ -1,51 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(use-package general
7 :config
8 (general-create-definer jd/leader-key-def
9 :keymaps '(normal insert visual emacs)
10 :prefix "SPC"
11 :global-prefix "C-SPC")
12
13 (general-create-definer jd/ctrl-c-keys
14 :prefix "C-c"))
15
16(use-package undo-tree
17 :diminish
18 :config
19 (setq undo-tree-auto-save-history nil)
20 (global-undo-tree-mode 1))
21
22(use-package evil
23 :init
24 (setq evil-want-integration t)
25 (setq evil-want-keybinding nil)
26 (setq evil-want-C-u-scroll t)
27 (setq evil-want-Y-yank-to-eol t)
28 (setq evil-want-C-i-jump nil)
29 (setq evil-undo-system 'undo-tree)
30 (setq evil-kill-on-visual-paste nil)
31 :config
32 (evil-set-initial-state 'exwm-mode 'emacs)
33 (evil-mode 1))
34
35(use-package evil-collection
36 :after evil
37 :config
38 (evil-collection-init))
39
40(jd/leader-key-def
41 "w" 'evil-window-map
42 "wr" '(hydra-resize-window/body :which-key "Rezize window")
43 "wd" '(evil-window-delete :which-key "Window delete"))
44
45(jd/leader-key-def
46 "ou" '(undo-tree-visualize :which-key "Open"))
47
48;; remove . key
49(define-key evil-normal-state-map (kbd ".") '())
50
51;;; jd-keys.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-org-mode.el b/.config/emacs/jd-emacs/jd-emacs-org-mode.el
deleted file mode 100644
index 0e5ae42..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-org-mode.el
+++ /dev/null
@@ -1,200 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defvar jd/org-home "~/Documents/Org")
7(defvar jd/org-roam-home (concat jd/org-home "/roam"))
8(defvar jd/org-roam-daily-home (concat jd/org-home "/roam/daily"))
9
10(defun jd/org-mode-init ()
11 (org-indent-mode)
12 (variable-pitch-mode 1)
13 (visual-line-mode 1))
14
15;; (defun jd-emacs/org-insert-date (&optional date)
16;; (let ((d (or date "+0d")))
17;; (org-insert-time-stamp (org-read-date nil t d)))) TODO
18
19
20(use-package org
21 :pin org
22 :commands (org-capture org-agenda)
23 :hook (org-mode . jd/org-mode-init)
24 :config
25 (setq org-directory (file-truename "~/Documents/Org/"))
26 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
27 (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
28 (setq org-agenda-files
29 '("Tasks.org"))
30 (setq org-ellipsis " ▾")
31 (setq org-agenda-start-with-log-mode t)
32 (setq org-log-done 'time)
33 (setq org-log-into-drawer t)
34 (setq org-return-follows-link t)
35 (setq org-capture-templates
36 `(("t" "Tasks / Projects")
37 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
38 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
39 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
40 "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1)
41
42 ("m" "Metrics Capture")
43 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
44 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)
45 ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org"))))
46
47 (setq org-latex-listings 'minted
48 org-latex-packages-alist '(("" "minted"))
49 org-latex-pdf-process
50 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
51 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
52 (require 'org-tempo))
53(jd/leader-key-def
54 "o" '(:ignore t :which-key "Open/Org")
55 "oc" '(org-capture :which-key "Open org-capture")
56 "oop" '(org-mobile-pull :which-key "Org mobile pull")
57 "ooP" '(org-mobile-push :which-key "Org mobile push")
58 "oa" '(org-agenda :which-key "Open org-agenda"))
59
60(use-package evil-org
61 :after org
62 :hook (org-mode . (lambda () evil-org-mode))
63 :config
64 (require 'evil-org-agenda)
65 (evil-org-agenda-set-keys))
66
67(use-package toc-org
68 :config
69 (add-hook 'org-mode-hook 'toc-org-mode))
70
71(defun jd/org-font-setup ()
72 ;; Replace list hyphen with dot
73 (font-lock-add-keywords 'org-mode
74 '(("^ *\\([-]\\) "
75 (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-"))))))
76
77 ;; Set faces for heading levels
78 (dolist (face '((org-level-1 . 1.3)
79 (org-level-2 . 1.2)
80 (org-level-3 . 1.1)
81 (org-level-4 . 1.0)
82 (org-level-5 . 1.0)
83 (org-level-6 . 1.0)
84 (org-level-7 . 1.0)
85 (org-level-8 . 1.0)))
86 (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face)))
87
88 ;; Ensure that anything that should be fixed-pitch in Org files appears that way
89 (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100)
90 (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
91 (set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
92 (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
93 (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch))
94 (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
95 (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
96 (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
97 (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
98 (set-face-attribute 'line-number nil :inherit 'fixed-pitch)
99 (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
100
101(with-eval-after-load 'org (jd/org-font-setup))
102
103(defun jd-emacs/org-timer-stop ()
104 (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie"))
105
106
107(add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop)
108
109(defun jd/org-tempo-setup ()
110 (add-to-list 'org-structure-template-alist '("s" . "src"))
111 (add-to-list 'org-structure-template-alist '("sql" . "src sql"))
112 (add-to-list 'org-structure-template-alist '("sh" . "src sh"))
113 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
114 (add-to-list 'org-structure-template-alist '("li" . "src lisp"))
115 (add-to-list 'org-structure-template-alist '("sc" . "src scheme"))
116 (add-to-list 'org-structure-template-alist '("ts" . "src typescript"))
117 (add-to-list 'org-structure-template-alist '("py" . "src python"))
118 (add-to-list 'org-structure-template-alist '("go" . "src go"))
119 (add-to-list 'org-structure-template-alist '("yaml" . "src yaml")))
120
121(with-eval-after-load 'org-tempo (jd/org-tempo-setup))
122
123(org-babel-do-load-languages
124 'org-babel-load-languages
125 '((emacs-lisp . t)
126 (python . t)))
127
128(defun jd/org-babel-tangle-config ()
129 (when (string-equal (file-name-directory (buffer-file-name))
130 (expand-file-name "~/dotfiles/"))
131 ;; Dynamic scoping to the rescue
132 (let ((org-confirm-babel-evaluate nil))
133 (org-babel-tangle))))
134
135(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))
136
137(defun jd/org-mode-visual-fill ()
138 (setq visual-fill-column-width 100
139 visual-fill-column-center-text t)
140 (visual-fill-column-mode 1))
141
142(use-package visual-fill-column
143 :hook (org-mode . jd/org-mode-visual-fill))
144
145(use-package org-superstar
146 :hook (org-mode . org-superstar-mode)
147 :init
148 (setq org-superstar-special-todo-items t)
149 (setq org-superstar-remove-leading-stars t)
150 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
151
152(defun jd/org-roam-filter-by-tag (tag-name)
153 (lambda (node)
154 (member tag-name (org-roam-node-tags node))))
155
156(defun jd/org-roam-list-notes-by-tag (tag-name)
157 (mapcar #'org-roam-node-file
158 (seq-filter
159 (jd/org-roam-filter-by-tag tag-name)
160 (org-roam-node-list))))
161
162(defun jd/org-roam-refreshagenda-list ()
163 (interactive)
164 (setq org-agenda-files (org-roam-list-files)))
165
166(use-package org-roam
167 :custom
168 (org-roam-directory (file-truename jd/org-roam-home))
169 :bind (("C-c n l" . org-roam-buffer-toggle)
170 ("C-c n f" . org-roam-node-find)
171 ("C-c n g" . org-roam-graph)
172 ("C-c n i" . org-roam-node-insert)
173 ("C-c n c" . org-roam-capture)
174 ;; Dailies
175 ("C-c n j" . org-roam-dailies-capture-today))
176 :bind-keymap
177 ("C-c n d" . org-roam-dailies-map)
178 :config
179 ;; If you're using a vertical completion framework, you might want a more informative completion interface
180 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
181 (setq org-roam-capture-templates
182 '(("a" "workstuff" plain (file (concat org-roam-directory "/work"))
183 :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org"
184 "#+title: ${title}\n") :unnarrowed t)
185 ("b" "research" plain (file "~/Documents/roam/study/templates/research.org")
186 :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org"
187 "#+title: ${title}\n") :unnarrowed t)
188 ("s" "School" plain nil
189 :target (file+head
190 "school/%<%Y%m%d%H%M%S>-${slug}.org"
191 "#+title: ${title}\n")
192 :unnarrowed t)
193 ("d" "default" plain nil
194 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
195 "#+title: ${title}\n") :unnarrowed t)
196 ))
197
198 (org-roam-db-autosync-mode))
199
200;;; jd-emacs-org-mode.el ends here
diff --git a/.config/emacs/jd-emacs/jd-emacs-ui.el b/.config/emacs/jd-emacs/jd-emacs-ui.el
deleted file mode 100644
index c8236af..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-ui.el
+++ /dev/null
@@ -1,154 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq inhibit-startup-message t)
7(setq visible-bell t)
8(scroll-bar-mode -1)
9(tool-bar-mode -1)
10(tooltip-mode -1)
11(menu-bar-mode -1)
12(set-fringe-mode 10)
13
14(set-face-attribute 'default nil :font "Terminus" :height 100)
15
16(add-hook 'prog-mode-hook 'menu-bar--display-line-numbers-mode-relative)
17
18(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
19
20(global-prettify-symbols-mode 1)
21
22(defalias 'yes-or-no-p 'y-or-n-p)
23
24(use-package doom-themes
25 :config
26 (load-theme 'ujelly t))
27
28(use-package diminish)
29
30(use-package hl-todo
31 :init
32 (setq hl-todo-keyword-faces
33 '(("TODO" . "#FF0000")
34 ("FIXME" . "#FF0000")
35 ("DEBUG" . "#A020F0")))
36 :config
37 (global-hl-todo-mode 1))
38
39(defun jd/switch-buffer ()
40 (interactive)
41 (let ((completion-regexp-list '("\\`[^*]"
42 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*")))
43 (call-interactively 'counsel-switch-buffer)))
44
45(defvar jd/load-theme-hook nil)
46(defun jd/load-theme ()
47 (interactive)
48 (counsel-load-theme)
49 (run-hooks 'jd/load-theme-hook))
50
51(use-package ivy
52 :diminish
53 :bind
54 (("C-s" . swiper)
55 :map ivy-minibuffer-map
56 ("C-k" . ivy-previous-line)
57 ("C-j" . ivy-next-line)
58 :map ivy-switch-buffer-map
59 ("C-k" . ivy-previous-line))
60 :config
61 (ivy-mode 1))
62
63(use-package counsel
64 :config
65 (counsel-mode 1))
66
67(jd/leader-key-def
68 "t" '(:ignore t :which-key "Toggle")
69 "tT" '(toggle-truncate-lines :which-key "Toggle truncate lines")
70 "tt" '(jd/load-theme :which-key "Choose theme"))
71
72(jd/leader-key-def
73 "bb" '(jd/switch-buffer :which-key "Buffer switch")
74 "ba" '(counsel-switch-buffer :which-key "Buffer switch")
75 "b" '(:ignore t :which-key "Buffer")
76 "," '(counsel-switch-buffer :which-key "Buffer switch"))
77
78(use-package which-key
79 :diminish
80 :config
81 (which-key-mode)
82 (setq which-key-idle-delay 0.3))
83
84(use-package all-the-icons)
85
86(use-package doom-modeline
87 ; :init (doom-modeline-mode 0)
88 :custom ((doom-modeline-height 15)))
89
90(use-package hydra
91 :defer t)
92
93(defun jd/text-scale-increase ()
94 (interactive)
95 (let ((old-face-attribute (face-attribute 'default :height)))
96 (set-face-attribute 'default nil :height (+ old-face-attribute 10))))
97
98(defun jd/text-scale-decrease ()
99 (interactive)
100 (let ((old-face-attribute (face-attribute 'default :height)))
101 (set-face-attribute 'default nil :height (- old-face-attribute 10))))
102
103(defhydra hydra-resize-window (:timeout 4)
104 ("h" evil-window-decrease-width "<")
105 ("l" evil-window-increase-width ">")
106 ("k" evil-window-decrease-height "^")
107 ("j" evil-window-increase-height "v")
108 ("q" nil "finished" :exit t))
109
110(defhydra hydra-text-scale-global (:timeout 4)
111 "scale text"
112 ("j" jd/text-scale-increase "in")
113 ("k" jd/text-scale-decrease "out")
114 ("q" nil "finished" :exit t))
115
116(defhydra hydra-text-scale (:timeout 4)
117 "scale text"
118 ("j" text-scale-increase "in")
119 ("k" text-scale-decrease "out")
120 ("q" nil "finished" :exit t))
121
122(jd/leader-key-def
123 "tS" '(hydra-text-scale-global/body :which-key "Scale text")
124 "ts" '(hydra-text-scale/body :which-key "Scale text"))
125
126(use-package beacon
127 :config
128 (beacon-mode 1))
129
130(jd/leader-key-def
131 "f" '(:ignore t :which-key "Files")
132 "fs" '(save-buffer :which-key "File save")
133 "." '(find-file :which-key "Find file")
134 "ff" '(find-file :which-key "Find file"))
135
136(jd/leader-key-def
137 "e" '(:ignore t :which-key "Eval")
138 "eb" '(eval-buffer :which-key "Eval buffer")
139 "ee" '(eval-defun :which-key "Eval defun"))
140
141(jd/leader-key-def
142 :keymaps '(visual)
143 "er" '(eval-region :which-key "Eval region"))
144
145(defun jd/kill-other-buffers ()
146 (interactive)
147 (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))))
148
149(jd/leader-key-def
150 "bK" '(jd/kill-other-buffers :which-key "Kill other buffers")
151 "bk" '(kill-current-buffer :which-key "Kill buffer")
152 "bB" '(ibuffer :which-key "Open ibuffer"))
153
154;;; jd-ui.el ends here