diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2023-06-10 09:36:37 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2023-07-02 13:52:12 +0200 |
commit | ef565a486511cbbb86e0d1f80264b3b57d2ac88a (patch) | |
tree | 4e0b04e78f288985a629ad8b9a8e56eb266de6a4 /.config/emacs/init.el | |
parent | 2b62ae597cc6a4c213f7d4b54b112ff9c216dbaa (diff) | |
download | dotfiles-ef565a486511cbbb86e0d1f80264b3b57d2ac88a.tar.gz dotfiles-ef565a486511cbbb86e0d1f80264b3b57d2ac88a.zip |
Migrate from .org to .el Emacs config.
Diffstat (limited to '.config/emacs/init.el')
-rw-r--r-- | .config/emacs/init.el | 611 |
1 files changed, 13 insertions, 598 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 780a1c6..65a8683 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el | |||
@@ -1,602 +1,17 @@ | |||
1 | (setq gc-cons-threshold (* 50 1000 1000)) | 1 | ;;; Dotfiles --- Jakub Dlugosz emacs config |
2 | ;;; Commentary: | ||
2 | 3 | ||
3 | (defun jd/display-startup-time () | 4 | ;;; Code: |
4 | (message "Emacs loaded in %s with %d garbage collections." | ||
5 | (format "%.2f seconds" | ||
6 | (float-time | ||
7 | (time-subtract after-init-time before-init-time))) | ||
8 | gcs-done)) | ||
9 | 5 | ||
10 | (defun jd/startup () | 6 | (defvar jd/exwmp (not (null (getenv "JD_EXWM"))) |
11 | (electric-pair-mode 1) | 7 | "Return non-nil if Emacs is run as a window manager.") |
12 | (global-company-mode 1) | ||
13 | (jd/display-startup-time)) | ||
14 | 8 | ||
15 | (add-hook 'emacs-startup-hook #'jd/startup) | 9 | (let ((jd-emacs-init (concat user-emacs-directory |
10 | "jd-emacs/jd-emacs-init.el")) | ||
11 | (jd-exwm-init (concat user-emacs-directory | ||
12 | "jd-exwm/init.el"))) | ||
13 | (load jd-emacs-init) | ||
14 | (when jd/exwmp | ||
15 | (load jd-exwm-init))) | ||
16 | 16 | ||
17 | (setq user-full-name "Jakub Dlugosz" | 17 | ;;; init.el ends here |
18 | user-mail-address "jdlugosz963@gmail.com") | ||
19 | |||
20 | (setq backup-directory-alist '(("." . "~/.cache/emacs/backup")) | ||
21 | backup-by-copying t | ||
22 | version-control t | ||
23 | delete-old-versions t | ||
24 | kept-new-versions 20 | ||
25 | kept-old-versions 5) | ||
26 | |||
27 | (setq user-emacs-directory "~/.cache/emacs") | ||
28 | |||
29 | (require 'package) | ||
30 | (setq package-archives '(("melpa" . "https://melpa.org/packages/") | ||
31 | ("org" . "https://orgmode.org/elpa/") | ||
32 | ("gnu-devel" . "https://elpa.gnu.org/devel/") | ||
33 | ("elpa" . "https://elpa.gnu.org/packages/"))) | ||
34 | (package-initialize) | ||
35 | |||
36 | (unless package-archive-contents | ||
37 | (package-refresh-contents)) | ||
38 | |||
39 | (unless (package-installed-p 'use-package) | ||
40 | (package-install 'use-package)) | ||
41 | |||
42 | (setq use-package-always-ensure t) | ||
43 | |||
44 | (add-to-list 'load-path ".config/emacs/jd/") | ||
45 | |||
46 | (require 'use-package) | ||
47 | |||
48 | (use-package general | ||
49 | :config | ||
50 | (general-create-definer jd/leader-key-def | ||
51 | :keymaps '(normal insert visual emacs) | ||
52 | :prefix "SPC" | ||
53 | :global-prefix "C-SPC") | ||
54 | |||
55 | (general-create-definer jd/ctrl-c-keys | ||
56 | :prefix "C-c")) | ||
57 | |||
58 | (use-package undo-tree | ||
59 | :diminish | ||
60 | :config | ||
61 | (setq undo-tree-auto-save-history nil) | ||
62 | (global-undo-tree-mode 1)) | ||
63 | |||
64 | (use-package evil | ||
65 | :init | ||
66 | (setq evil-want-integration t) | ||
67 | (setq evil-want-keybinding nil) | ||
68 | (setq evil-want-C-u-scroll t) | ||
69 | (setq evil-want-Y-yank-to-eol t) | ||
70 | (setq evil-want-C-i-jump nil) | ||
71 | (setq evil-undo-system 'undo-tree) | ||
72 | (setq evil-kill-on-visual-paste nil) | ||
73 | :config | ||
74 | (evil-set-initial-state 'exwm-mode 'emacs) | ||
75 | (evil-mode 1)) | ||
76 | |||
77 | (use-package evil-collection | ||
78 | :after evil | ||
79 | :config | ||
80 | (evil-collection-init)) | ||
81 | |||
82 | (jd/leader-key-def | ||
83 | "w" 'evil-window-map | ||
84 | "wr" '(hydra-resize-window/body :which-key "Rezize window") | ||
85 | "wd" '(evil-window-delete :which-key "Window delete")) | ||
86 | |||
87 | (jd/leader-key-def | ||
88 | "ou" '(undo-tree-visualize :which-key "Open")) | ||
89 | |||
90 | ;; remove . key | ||
91 | (define-key evil-normal-state-map (kbd ".") '()) | ||
92 | |||
93 | (setq inhibit-startup-message t) | ||
94 | (setq visible-bell t) | ||
95 | (scroll-bar-mode -1) | ||
96 | (tool-bar-mode -1) | ||
97 | (tooltip-mode -1) | ||
98 | (menu-bar-mode -1) | ||
99 | (set-fringe-mode 10) | ||
100 | |||
101 | (set-face-attribute 'default nil :font "sourcecodepro" :height 100) | ||
102 | |||
103 | (add-hook 'prog-mode-hook 'menu-bar--display-line-numbers-mode-relative) | ||
104 | |||
105 | (global-set-key (kbd "<escape>") 'keyboard-escape-quit) | ||
106 | |||
107 | (defalias 'yes-or-no-p 'y-or-n-p) | ||
108 | |||
109 | (use-package doom-themes | ||
110 | :config | ||
111 | (load-theme 'doom-ayu-dark t)) | ||
112 | |||
113 | (use-package diminish) | ||
114 | |||
115 | (use-package hl-todo | ||
116 | :init | ||
117 | (setq hl-todo-keyword-faces | ||
118 | '(("TODO" . "#FF0000") | ||
119 | ("FIXME" . "#FF0000") | ||
120 | ("DEBUG" . "#A020F0"))) | ||
121 | :config | ||
122 | (global-hl-todo-mode 1)) | ||
123 | |||
124 | (defun jd/switch-buffer () | ||
125 | (interactive) | ||
126 | (let ((completion-regexp-list '("\\`[^*]" | ||
127 | "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*"))) | ||
128 | (call-interactively 'counsel-switch-buffer))) | ||
129 | |||
130 | (defvar jd/load-theme-hook nil) | ||
131 | (defun jd/load-theme () | ||
132 | (interactive) | ||
133 | (counsel-load-theme) | ||
134 | (run-hooks 'jd/load-theme-hook)) | ||
135 | |||
136 | (use-package ivy | ||
137 | :diminish | ||
138 | :bind | ||
139 | (("C-s" . swiper) | ||
140 | :map ivy-minibuffer-map | ||
141 | ("C-k" . ivy-previous-line) | ||
142 | ("C-j" . ivy-next-line) | ||
143 | :map ivy-switch-buffer-map | ||
144 | ("C-k" . ivy-previous-line)) | ||
145 | :config | ||
146 | (ivy-mode 1)) | ||
147 | |||
148 | (use-package counsel | ||
149 | :config | ||
150 | (counsel-mode 1)) | ||
151 | |||
152 | (jd/leader-key-def | ||
153 | "t" '(:ignore t :which-key "Toggle") | ||
154 | "tT" '(toggle-truncate-lines :which-key "Toggle truncate lines") | ||
155 | "tt" '(jd/load-theme :which-key "Choose theme")) | ||
156 | |||
157 | (jd/leader-key-def | ||
158 | "bb" '(jd/switch-buffer :which-key "Buffer switch") | ||
159 | "ba" '(counsel-switch-buffer :which-key "Buffer switch") | ||
160 | "b" '(:ignore t :which-key "Buffer") | ||
161 | "," '(counsel-switch-buffer :which-key "Buffer switch")) | ||
162 | |||
163 | (use-package which-key | ||
164 | :diminish | ||
165 | :config | ||
166 | (which-key-mode) | ||
167 | (setq which-key-idle-delay 0.3)) | ||
168 | |||
169 | (use-package all-the-icons) | ||
170 | |||
171 | (use-package doom-modeline | ||
172 | :init (doom-modeline-mode 1) | ||
173 | :custom ((doom-modeline-height 15))) | ||
174 | |||
175 | (use-package hydra | ||
176 | :defer t) | ||
177 | |||
178 | (defun jd/text-scale-increase () | ||
179 | (interactive) | ||
180 | (let ((old-face-attribute (face-attribute 'default :height))) | ||
181 | (set-face-attribute 'default nil :height (+ old-face-attribute 10)))) | ||
182 | |||
183 | (defun jd/text-scale-decrease () | ||
184 | (interactive) | ||
185 | (let ((old-face-attribute (face-attribute 'default :height))) | ||
186 | (set-face-attribute 'default nil :height (- old-face-attribute 10)))) | ||
187 | |||
188 | (defhydra hydra-resize-window (:timeout 4) | ||
189 | ("h" evil-window-decrease-width "<") | ||
190 | ("l" evil-window-increase-width ">") | ||
191 | ("k" evil-window-decrease-height "^") | ||
192 | ("j" evil-window-increase-height "v") | ||
193 | ("q" nil "finished" :exit t)) | ||
194 | |||
195 | (defhydra hydra-text-scale-global (:timeout 4) | ||
196 | "scale text" | ||
197 | ("j" jd/text-scale-increase "in") | ||
198 | ("k" jd/text-scale-decrease "out") | ||
199 | ("q" nil "finished" :exit t)) | ||
200 | |||
201 | (defhydra hydra-text-scale (:timeout 4) | ||
202 | "scale text" | ||
203 | ("j" text-scale-increase "in") | ||
204 | ("k" text-scale-decrease "out") | ||
205 | ("q" nil "finished" :exit t)) | ||
206 | |||
207 | (jd/leader-key-def | ||
208 | "tS" '(hydra-text-scale-global/body :which-key "Scale text") | ||
209 | "ts" '(hydra-text-scale/body :which-key "Scale text")) | ||
210 | |||
211 | (use-package beacon | ||
212 | :config | ||
213 | (beacon-mode 1)) | ||
214 | |||
215 | (jd/leader-key-def | ||
216 | "f" '(:ignore t :which-key "Files") | ||
217 | "fs" '(save-buffer :which-key "File save") | ||
218 | "." '(find-file :which-key "Find file") | ||
219 | "ff" '(find-file :which-key "Find file")) | ||
220 | |||
221 | (jd/leader-key-def | ||
222 | "e" '(:ignore t :which-key "Eval") | ||
223 | "eb" '(eval-buffer :which-key "Eval buffer")) | ||
224 | |||
225 | (jd/leader-key-def | ||
226 | :keymaps '(visual) | ||
227 | "er" '(eval-region :which-key "Eval region")) | ||
228 | |||
229 | (defun jd/kill-other-buffers () | ||
230 | (interactive) | ||
231 | (mapc 'kill-buffer (cdr (buffer-list (current-buffer))))) | ||
232 | |||
233 | (jd/leader-key-def | ||
234 | "bK" '(jd/kill-other-buffers :which-key "Kill other buffers") | ||
235 | "bk" '(kill-current-buffer :which-key "Kill buffer") | ||
236 | "bB" '(ibuffer :which-key "Open ibuffer")) | ||
237 | |||
238 | (setq jd/org-home "~/Documents/Org") | ||
239 | (setq jd/org-roam-home (concat jd/org-home "/roam")) | ||
240 | (setq jd/org-roam-daily-home (concat jd/org-home "/roam/daily")) | ||
241 | |||
242 | (defun jd/org-mode-setup () | ||
243 | (org-indent-mode) | ||
244 | (variable-pitch-mode 1) | ||
245 | (visual-line-mode 1)) | ||
246 | |||
247 | (use-package org | ||
248 | :pin org | ||
249 | :commands (org-capture org-agenda) | ||
250 | :hook (org-mode . jd/org-mode-setup) | ||
251 | :config | ||
252 | (setq org-directory (file-truename "~/Documents/Org/")) | ||
253 | (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org")) | ||
254 | (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg") | ||
255 | (setq org-agenda-files | ||
256 | '("Tasks.org")) | ||
257 | (setq org-ellipsis " ▾") | ||
258 | (setq org-agenda-start-with-log-mode t) | ||
259 | (setq org-log-done 'time) | ||
260 | (setq org-log-into-drawer t) | ||
261 | (setq org-return-follows-link t) | ||
262 | (setq org-capture-templates | ||
263 | `(("t" "Tasks / Projects") | ||
264 | ("tt" "Task" entry (file+olp "Tasks.org" "Inbox") | ||
265 | "* TODO %?\n %t\n %a\n %i" :empty-lines 1) | ||
266 | ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox") | ||
267 | "* TODO %?\n %t\n SCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+1d\"))\n %a\n %i" :empty-lines 1) | ||
268 | |||
269 | ("m" "Metrics Capture") | ||
270 | ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics") | ||
271 | "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t))) | ||
272 | |||
273 | (setq org-latex-listings 'minted | ||
274 | org-latex-packages-alist '(("" "minted")) | ||
275 | org-latex-pdf-process | ||
276 | '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" | ||
277 | "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) | ||
278 | |||
279 | (require 'org-tempo)) | ||
280 | |||
281 | (jd/leader-key-def | ||
282 | "o" '(:ignore t :which-key "Open/Org") | ||
283 | "oc" '(org-capture :which-key "Open org-capture") | ||
284 | "oop" '(org-mobile-pull :which-key "Org mobile pull") | ||
285 | "ooP" '(org-mobile-push :which-key "Org mobile push") | ||
286 | "oa" '(org-agenda :which-key "Open org-agenda")) | ||
287 | |||
288 | (use-package evil-org | ||
289 | :after org | ||
290 | :hook (org-mode . (lambda () evil-org-mode)) | ||
291 | :config | ||
292 | (require 'evil-org-agenda) | ||
293 | (evil-org-agenda-set-keys)) | ||
294 | |||
295 | (use-package toc-org | ||
296 | :config | ||
297 | (add-hook 'org-mode-hook 'toc-org-mode)) | ||
298 | |||
299 | (defun jd/org-font-setup () | ||
300 | ;; Replace list hyphen with dot | ||
301 | (font-lock-add-keywords 'org-mode | ||
302 | '(("^ *\\([-]\\) " | ||
303 | (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) | ||
304 | |||
305 | ;; Set faces for heading levels | ||
306 | (dolist (face '((org-level-1 . 1.3) | ||
307 | (org-level-2 . 1.2) | ||
308 | (org-level-3 . 1.1) | ||
309 | (org-level-4 . 1.0) | ||
310 | (org-level-5 . 1.1) | ||
311 | (org-level-6 . 1.1) | ||
312 | (org-level-7 . 1.1) | ||
313 | (org-level-8 . 1.1))) | ||
314 | (set-face-attribute (car face) nil :font "Monospace" :weight 'Bold :height (cdr face))) | ||
315 | |||
316 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way | ||
317 | (set-face-attribute 'org-block nil :font "hack" :inherit 'fixed-pitch) | ||
318 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) | ||
319 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) | ||
320 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) | ||
321 | (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) | ||
322 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) | ||
323 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
324 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
325 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | ||
326 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) | ||
327 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) | ||
328 | |||
329 | (with-eval-after-load 'org-faces (jd/org-font-setup)) | ||
330 | |||
331 | (defun jd/org-tempo-setup () | ||
332 | (add-to-list 'org-structure-template-alist '("s" . "src")) | ||
333 | (add-to-list 'org-structure-template-alist '("sql" . "src sql")) | ||
334 | (add-to-list 'org-structure-template-alist '("sh" . "src sh")) | ||
335 | (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) | ||
336 | (add-to-list 'org-structure-template-alist '("li" . "src lisp")) | ||
337 | (add-to-list 'org-structure-template-alist '("sc" . "src scheme")) | ||
338 | (add-to-list 'org-structure-template-alist '("ts" . "src typescript")) | ||
339 | (add-to-list 'org-structure-template-alist '("py" . "src python")) | ||
340 | (add-to-list 'org-structure-template-alist '("go" . "src go")) | ||
341 | (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) | ||
342 | |||
343 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) | ||
344 | |||
345 | (org-babel-do-load-languages | ||
346 | 'org-babel-load-languages | ||
347 | '((emacs-lisp . t) | ||
348 | (python . t))) | ||
349 | |||
350 | (defun jd/org-babel-tangle-config () | ||
351 | (when (string-equal (file-name-directory (buffer-file-name)) | ||
352 | (expand-file-name "~/dotfiles/")) | ||
353 | ;; Dynamic scoping to the rescue | ||
354 | (let ((org-confirm-babel-evaluate nil)) | ||
355 | (org-babel-tangle)))) | ||
356 | |||
357 | (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))) | ||
358 | |||
359 | (defun jd/org-mode-visual-fill () | ||
360 | (setq visual-fill-column-width 100 | ||
361 | visual-fill-column-center-text t) | ||
362 | (visual-fill-column-mode 1)) | ||
363 | |||
364 | (use-package visual-fill-column | ||
365 | :hook (org-mode . jd/org-mode-visual-fill)) | ||
366 | |||
367 | (use-package org-superstar | ||
368 | :hook (org-mode . org-superstar-mode) | ||
369 | :init | ||
370 | (setq org-superstar-special-todo-items t) | ||
371 | (setq org-superstar-remove-leading-stars t) | ||
372 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) | ||
373 | |||
374 | (defun jd/org-roam-filter-by-tag (tag-name) | ||
375 | (lambda (node) | ||
376 | (member tag-name (org-roam-node-tags node)))) | ||
377 | |||
378 | (defun jd/org-roam-list-notes-by-tag (tag-name) | ||
379 | (mapcar #'org-roam-node-file | ||
380 | (seq-filter | ||
381 | (jd/org-roam-filter-by-tag tag-name) | ||
382 | (org-roam-node-list)))) | ||
383 | |||
384 | (defun jd/org-roam-refreshagenda-list () | ||
385 | (interactive) | ||
386 | (setq org-agenda-files (org-roam-list-files))) | ||
387 | |||
388 | (use-package org-roam | ||
389 | :custom | ||
390 | (org-roam-directory (file-truename jd/org-roam-home)) | ||
391 | :bind (("C-c n l" . org-roam-buffer-toggle) | ||
392 | ("C-c n f" . org-roam-node-find) | ||
393 | ("C-c n g" . org-roam-graph) | ||
394 | ("C-c n i" . org-roam-node-insert) | ||
395 | ("C-c n c" . org-roam-capture) | ||
396 | ;; Dailies | ||
397 | ("C-c n j" . org-roam-dailies-capture-today)) | ||
398 | :bind-keymap | ||
399 | ("C-c n d" . org-roam-dailies-map) | ||
400 | :config | ||
401 | ;; If you're using a vertical completion framework, you might want a more informative completion interface | ||
402 | (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) | ||
403 | (org-roam-db-autosync-mode)) | ||
404 | |||
405 | (use-package lsp-mode | ||
406 | :commands (lsp lsp-deferred) | ||
407 | :init | ||
408 | (setq lsp-headerline-breadcrumb-enable nil) | ||
409 | (setq lsp-diagnostics-provider :none) | ||
410 | (setq lsp-modeline-diagnostics-enable nil) | ||
411 | (setq lsp-keymap-prefix "C-c l") | ||
412 | :config | ||
413 | (lsp-enable-which-key-integration t)) | ||
414 | |||
415 | (use-package lsp-ivy | ||
416 | :after lsp) | ||
417 | |||
418 | (defun jd/python-mode-setup () | ||
419 | (let ((project-venv-path (concat (projectile-project-root) "venv/"))) | ||
420 | (when (projectile--directory-p project-venv-path) | ||
421 | (pyvenv-activate project-venv-path) | ||
422 | (pyvenv-mode)))) | ||
423 | |||
424 | ;; (use-package python-mode ;;TODO: find alternative | ||
425 | ;; :hook (python-mode . lsp-deferred) | ||
426 | ;; :hook (python-mode . jd/python-mode-setup) | ||
427 | ;; :config | ||
428 | ;; (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))) | ||
429 | |||
430 | (use-package pyvenv | ||
431 | :after python-mode) | ||
432 | |||
433 | (use-package typescript-mode | ||
434 | :mode ("\\.ts\\'") | ||
435 | :config | ||
436 | (setq typescript-indent-level 2)) | ||
437 | |||
438 | (defun jd/activate-tide-mode () | ||
439 | (when (and (stringp buffer-file-name) | ||
440 | (string-match "\\.[tj]sx?\\'" buffer-file-name)) | ||
441 | (tide-setup) | ||
442 | (tide-hl-identifier-mode))) | ||
443 | |||
444 | (use-package tide | ||
445 | :after (typescript-mode company web-mode)) | ||
446 | |||
447 | (use-package flycheck | ||
448 | :hook ((after-init . global-flycheck-mode))) | ||
449 | |||
450 | (use-package web-mode | ||
451 | :hook ((web-mode . jd/activate-tide-mode)) | ||
452 | :mode | ||
453 | ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") | ||
454 | :config | ||
455 | (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'"))) | ||
456 | (setq web-mode-markup-indent-offset 2) | ||
457 | (setq web-mode-css-indent-offset 2) | ||
458 | (setq web-mode-code-indent-offset 2) | ||
459 | (setq web-mode-script-padding 2) | ||
460 | (setq web-mode-block-padding 2) | ||
461 | (setq web-mode-style-padding 2) | ||
462 | (setq web-mode-enable-auto-pairing t) | ||
463 | (setq web-mode-enable-auto-closing t) | ||
464 | (setq web-mode-enable-current-element-highlight t)) | ||
465 | |||
466 | (use-package yaml-mode) | ||
467 | |||
468 | (use-package docker) | ||
469 | |||
470 | (jd/leader-key-def | ||
471 | "d" '(:ignore t :which-key "Docker") | ||
472 | "dc" '(docker-containers :which-key "Docker containers") | ||
473 | "dd" '(docker :which-key "Docker")) | ||
474 | |||
475 | (use-package company | ||
476 | :after lsp-mode | ||
477 | :hook (lsp-mode . company-mode) | ||
478 | :bind (:map company-active-map | ||
479 | ("<tab>" . company-complete-selection)) | ||
480 | (:map lsp-mode-map | ||
481 | ("<tab>" . company-indent-or-complete-common)) | ||
482 | :custom | ||
483 | (company-minimum-prefix-length 1) | ||
484 | (company-idle-delay 0.0) | ||
485 | :config | ||
486 | (global-company-mode)) | ||
487 | |||
488 | (use-package company-box | ||
489 | :hook (company-mode . company-box-mode)) | ||
490 | |||
491 | (use-package projectile | ||
492 | :diminish projectile-mode | ||
493 | :init | ||
494 | (when (file-directory-p "~/Documents/code") | ||
495 | (setq projectile-project-search-path '("~/Documents/code/"))) | ||
496 | :custom ((projectile-Completion-system 'ivy)) | ||
497 | :config | ||
498 | (setq projectile-switch-project-action #'projectile-dired) | ||
499 | (projectile-mode)) | ||
500 | |||
501 | (jd/leader-key-def | ||
502 | "p" '(projectile-command-map :which-key "Project") | ||
503 | "p <ESC>" '() | ||
504 | "SPC" '(projectile-find-file :which-key "Find file in project")) | ||
505 | |||
506 | (defun jd/neotree-project-dir () | ||
507 | "Open NeoTree using the git root." | ||
508 | (interactive) | ||
509 | (let ((project-dir (projectile-project-root)) | ||
510 | (file-name (buffer-file-name))) | ||
511 | (neotree-toggle) | ||
512 | (if project-dir | ||
513 | (if (neo-global--window-exists-p) | ||
514 | (progn | ||
515 | (neotree-dir project-dir) | ||
516 | (neotree-find file-name))) | ||
517 | (message "Could not find git project root.")))) | ||
518 | |||
519 | (use-package neotree | ||
520 | :init | ||
521 | (setq neo-theme 'icons) | ||
522 | :config | ||
523 | |||
524 | (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) | ||
525 | (evil-define-key 'normal neotree-mode-map (kbd "C-RET") 'neotree-quick-look) | ||
526 | (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) | ||
527 | (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) | ||
528 | (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) | ||
529 | (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle) | ||
530 | (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle)) | ||
531 | |||
532 | (jd/leader-key-def | ||
533 | "op" '(jd/neotree-project-dir :which-key "Open neotree")) | ||
534 | |||
535 | (use-package magit | ||
536 | :custom | ||
537 | (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) | ||
538 | |||
539 | (jd/leader-key-def | ||
540 | "g" '(:ignore t :which-key "Git") | ||
541 | "gg" '(magit-status-here :which-key "Magit status")) | ||
542 | |||
543 | (defun jd/open-new-vterm (&optional jd/vterm-buffer-name) | ||
544 | (interactive) | ||
545 | (let ((buffer-name (generate-new-buffer-name vterm-buffer-name))) | ||
546 | (when jd/vterm-buffer-name | ||
547 | (setq buffer-name jd/vterm-buffer-name)) | ||
548 | (switch-to-buffer buffer-name) | ||
549 | (vterm-mode))) | ||
550 | |||
551 | |||
552 | (use-package vterm | ||
553 | :config | ||
554 | (setq vterm-buffer-name "vterm") | ||
555 | (evil-set-initial-state 'vterm-mode 'emacs)) | ||
556 | |||
557 | (jd/leader-key-def | ||
558 | "ot" '(jd/open-new-vterm :which-key "Open terminal in current window")) | ||
559 | |||
560 | (use-package all-the-icons-dired | ||
561 | :hook (dired-mode . all-the-icons-dired-mode)) | ||
562 | |||
563 | (use-package dired-ranger) | ||
564 | |||
565 | (use-package dired | ||
566 | :ensure nil | ||
567 | :commands (dired dired-jump) | ||
568 | :custom ((dired-listing-switches "-agho --group-directories-first")) | ||
569 | :config | ||
570 | (evil-collection-define-key 'normal 'dired-mode-map | ||
571 | "y" 'dired-ranger-copy | ||
572 | "p" 'dired-ranger-paste | ||
573 | "X" 'dired-ranger-move | ||
574 | "h" 'dired-up-directory | ||
575 | "t" 'dired-create-empty-file | ||
576 | "T" 'dired-toggle-marks | ||
577 | "l" 'dired-find-file) | ||
578 | (setq dired-kill-when-opening-new-dired-buffer t) | ||
579 | (evil-define-key 'normal dired-mode-map (kbd "q") 'kill-current-buffer)) | ||
580 | |||
581 | (use-package emms | ||
582 | :config | ||
583 | (require 'emms-setup) | ||
584 | (emms-all) | ||
585 | (emms-standard) | ||
586 | (emms-default-players) | ||
587 | (emms-mode-line-disable) | ||
588 | ; (setq emms-info-functions '(emms-info-tinytag)) | ||
589 | (setq emms-browser-covers 'emms-browser-cache-thumbnail-async) | ||
590 | ;; (setq emms-lyrics-dir "~/Documents/music/lyrics") | ||
591 | (emms-add-directory-tree "~/Documents/Music/")) | ||
592 | |||
593 | (use-package pdf-tools) | ||
594 | |||
595 | (require 'jd-mu4e) | ||
596 | |||
597 | (use-package elfeed | ||
598 | :config | ||
599 | (setq elfeed-feeds | ||
600 | '("https://www.reddit.com/r/emacs.rss"))) | ||
601 | |||
602 | (setq gc-cons-threshold (* 2 1000 1000)) | ||