diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2022-08-12 17:48:25 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2022-08-12 17:48:25 +0200 |
commit | 060362883a088f4779e247d232455b80f41f2f65 (patch) | |
tree | ad719f07ff8f5d27f127603f7e36713e1b451ecb /.config | |
parent | 9ff9098d793c4f05b77a7deb2f40c0470e9fe8ae (diff) | |
download | dotfiles-060362883a088f4779e247d232455b80f41f2f65.tar.gz dotfiles-060362883a088f4779e247d232455b80f41f2f65.zip |
Add emacs config
Diffstat (limited to '.config')
-rw-r--r-- | .config/emacs/Emacs.org | 520 | ||||
-rw-r--r-- | .config/emacs/init.el | 289 |
2 files changed, 809 insertions, 0 deletions
diff --git a/.config/emacs/Emacs.org b/.config/emacs/Emacs.org new file mode 100644 index 0000000..c151ad5 --- /dev/null +++ b/.config/emacs/Emacs.org | |||
@@ -0,0 +1,520 @@ | |||
1 | #+title: Emacs Configuration | ||
2 | #+author: jdlugosz963 | ||
3 | #+PROPERTY: header-args:emacs-lisp :tangle ./init.el | ||
4 | |||
5 | * Table of contents :toc: | ||
6 | :PROPERTIES: | ||
7 | :TOC: :include all | ||
8 | :END: | ||
9 | :CONTENTS: | ||
10 | - [[#table-of-contents][Table of contents]] | ||
11 | - [[#user-information-setup][User information setup]] | ||
12 | - [[#startup-performance][Startup Performance]] | ||
13 | - [[#package-setup][Package setup]] | ||
14 | - [[#keboard-setup][Keboard Setup]] | ||
15 | - [[#general-setup][General Setup]] | ||
16 | - [[#evil-mode-setup][Evil mode setup]] | ||
17 | - [[#keybinds][Keybinds]] | ||
18 | - [[#ui-configuration][UI Configuration]] | ||
19 | - [[#basic-ui-setup][Basic UI setup]] | ||
20 | - [[#ivy-and-counsel][Ivy and Counsel]] | ||
21 | - [[#keybinds][Keybinds]] | ||
22 | - [[#which-key][Which key]] | ||
23 | - [[#modline][Modline]] | ||
24 | - [[#other-keybindings][Other Keybindings]] | ||
25 | - [[#files][Files]] | ||
26 | - [[#eval][Eval]] | ||
27 | - [[#buffers][Buffers]] | ||
28 | - [[#org][Org]] | ||
29 | - [[#org-mode-setup][Org-mode setup]] | ||
30 | - [[#keybinds][Keybinds]] | ||
31 | - [[#org-make-toc][Org make toc]] | ||
32 | - [[#org-fonts][Org fonts]] | ||
33 | - [[#org-tempo-setup][Org tempo setup]] | ||
34 | - [[#org-babel-setup][Org babel setup]] | ||
35 | - [[#auto-tangle][Auto tangle]] | ||
36 | - [[#org-margin][Org margin]] | ||
37 | - [[#org-superstar][Org superstar]] | ||
38 | - [[#development][Development]] | ||
39 | - [[#projectile][Projectile]] | ||
40 | - [[#keybinds][Keybinds]] | ||
41 | - [[#magit][Magit]] | ||
42 | - [[#keybinds][Keybinds]] | ||
43 | - [[#apps][Apps]] | ||
44 | - [[#vterm][Vterm]] | ||
45 | - [[#keybinds][Keybinds]] | ||
46 | - [[#dired][Dired]] | ||
47 | :END: | ||
48 | |||
49 | |||
50 | * User information setup | ||
51 | |||
52 | #+begin_src emacs-lisp | ||
53 | |||
54 | (setq user-full-name "Jakub Dlugosz" | ||
55 | user-mail-address "jdlugosz963@gmail.com") | ||
56 | |||
57 | #+end_src | ||
58 | |||
59 | * Startup Performance | ||
60 | |||
61 | #+begin_src emacs-lisp | ||
62 | |||
63 | (setq gc-cons-threshold (* 50 1000 1000)) | ||
64 | |||
65 | (defun jd/display-startup-time () | ||
66 | (message "Emacs loaded in %s with %d garbage collections." | ||
67 | (format "%.2f seconds" | ||
68 | (float-time | ||
69 | (time-subtract after-init-time before-init-time))) | ||
70 | gcs-done)) | ||
71 | |||
72 | (add-hook 'emacs-startup-hook #'jd/display-startup-time) | ||
73 | |||
74 | #+end_src | ||
75 | |||
76 | * Package setup | ||
77 | |||
78 | #+begin_src emacs-lisp | ||
79 | |||
80 | (require 'package) | ||
81 | (setq package-archives '(("melpa" . "https://melpa.org/packages/") | ||
82 | ("org" . "https://orgmode.org/elpa/") | ||
83 | ("gnu-devel" . "https://elpa.gnu.org/devel/") | ||
84 | ("elpa" . "https://elpa.gnu.org/packages/"))) | ||
85 | (package-initialize) | ||
86 | |||
87 | (unless package-archive-contents | ||
88 | (package-refresh-contents)) | ||
89 | |||
90 | (unless (package-installed-p 'use-package) | ||
91 | (package-install 'use-package)) | ||
92 | |||
93 | (setq use-package-always-ensure t) | ||
94 | |||
95 | (require 'use-package) | ||
96 | |||
97 | #+end_src | ||
98 | |||
99 | * Keboard Setup | ||
100 | ** General Setup | ||
101 | |||
102 | #+begin_src emacs-lisp | ||
103 | |||
104 | (use-package general | ||
105 | :config | ||
106 | (general-create-definer jd/leader-key-def | ||
107 | :keymaps '(normal insert visual emacs) | ||
108 | :prefix "SPC" | ||
109 | :global-prefix "C-SPC") | ||
110 | |||
111 | (general-create-definer jd/ctrl-c-keys | ||
112 | :prefix "C-c")) | ||
113 | |||
114 | #+end_src | ||
115 | |||
116 | ** Evil mode setup | ||
117 | |||
118 | #+begin_src emacs-lisp | ||
119 | |||
120 | (use-package undo-tree | ||
121 | :config | ||
122 | (setq undo-tree-auto-save-history nil) | ||
123 | (global-undo-tree-mode 1)) | ||
124 | |||
125 | (use-package evil | ||
126 | :init | ||
127 | (setq evil-want-integration t) | ||
128 | (setq evil-want-keybinding nil) | ||
129 | (setq evil-want-C-u-scroll t) | ||
130 | (setq evil-want-C-i-jump nil) | ||
131 | (setq evil-undo-system 'undo-tree) | ||
132 | :config | ||
133 | (evil-mode 1)) | ||
134 | |||
135 | (use-package evil-collection | ||
136 | :after evil | ||
137 | :config | ||
138 | (evil-collection-init)) | ||
139 | |||
140 | #+end_src | ||
141 | |||
142 | *** Keybinds | ||
143 | |||
144 | #+begin_src emacs-lisp | ||
145 | |||
146 | (jd/leader-key-def | ||
147 | "w" 'evil-window-map | ||
148 | "wd" '(evil-window-delete :which-key "Window delete")) | ||
149 | |||
150 | (jd/leader-key-def | ||
151 | "ou" '(undo-tree-visualize :which-key "Open")) | ||
152 | |||
153 | ;; remove . key | ||
154 | (define-key evil-normal-state-map (kbd ".") '()) | ||
155 | #+end_src | ||
156 | |||
157 | * UI Configuration | ||
158 | |||
159 | ** Basic UI setup | ||
160 | #+begin_src emacs-lisp | ||
161 | |||
162 | (setq inhibit-startup-message t) | ||
163 | (scroll-bar-mode -1) | ||
164 | (tool-bar-mode -1) | ||
165 | (tooltip-mode -1) | ||
166 | (menu-bar-mode -1) | ||
167 | (set-fringe-mode 10) | ||
168 | |||
169 | (set-face-attribute 'default nil :font "Hack" :height 100) | ||
170 | |||
171 | ; (load-theme 'wombat) | ||
172 | |||
173 | (global-set-key (kbd "<escape>") 'keyboard-escape-quit) | ||
174 | |||
175 | (use-package monokai-theme | ||
176 | :config | ||
177 | (load-theme 'monokai t)) | ||
178 | |||
179 | (use-package diminish) | ||
180 | |||
181 | #+end_src | ||
182 | |||
183 | ** Ivy and Counsel | ||
184 | |||
185 | #+begin_src emacs-lisp | ||
186 | |||
187 | (use-package counsel) | ||
188 | (use-package ivy | ||
189 | :diminish | ||
190 | :bind | ||
191 | (("C-s" . swiper) | ||
192 | :map ivy-minibuffer-map | ||
193 | ("C-k" . ivy-previous-line) | ||
194 | ("C-j" . ivy-next-line) | ||
195 | :map ivy-switch-buffer-map | ||
196 | ("C-k" . ivy-previous-line)) | ||
197 | :config | ||
198 | (ivy-mode 1)) | ||
199 | |||
200 | #+end_src | ||
201 | |||
202 | *** Keybinds | ||
203 | |||
204 | #+begin_src emacs-lisp | ||
205 | |||
206 | (jd/leader-key-def | ||
207 | "t" '(:ignore t :which-key "Toogle") | ||
208 | "tt" '(counsel-load-theme :which-key "Choose theme")) | ||
209 | |||
210 | (jd/leader-key-def | ||
211 | "bb" '(counsel-switch-buffer :which-key "Buffer switch") | ||
212 | "b" '(:ignore t :which-key "Buffer") | ||
213 | "," '(counsel-switch-buffer :which-key "Buffer switch")) | ||
214 | |||
215 | #+end_src | ||
216 | |||
217 | ** Which key | ||
218 | |||
219 | #+begin_src emacs-lisp | ||
220 | |||
221 | (use-package which-key | ||
222 | :diminish | ||
223 | :config | ||
224 | (which-key-mode) | ||
225 | (setq which-key-idle-delay 0.3)) | ||
226 | |||
227 | #+end_src | ||
228 | |||
229 | ** Modline | ||
230 | |||
231 | #+begin_src emacs-lisp | ||
232 | |||
233 | (use-package all-the-icons) | ||
234 | |||
235 | (use-package doom-modeline | ||
236 | :init (doom-modeline-mode 1) | ||
237 | :custom ((doom-modeline-height 15))) | ||
238 | |||
239 | #+end_src | ||
240 | |||
241 | ** Other Keybindings | ||
242 | *** Files | ||
243 | |||
244 | #+begin_src emacs-lisp | ||
245 | |||
246 | (jd/leader-key-def | ||
247 | "f" '(:ignore t :which-key "Files") | ||
248 | "fs" '(save-buffer :which-key "File save") | ||
249 | "." '(find-file :which-key "Find file") | ||
250 | "ff" '(find-file :which-key "Find file")) | ||
251 | |||
252 | #+end_src | ||
253 | |||
254 | *** Eval | ||
255 | |||
256 | #+begin_src emacs-lisp | ||
257 | |||
258 | (jd/leader-key-def | ||
259 | "e" '(:ignore t :which-key "Eval") | ||
260 | "eb" '(eval-buffer :which-key "Eval buffer")) | ||
261 | |||
262 | (jd/leader-key-def | ||
263 | :keymaps '(visual) | ||
264 | "er" '(eval-region :which-key "Eval region")) | ||
265 | |||
266 | #+end_src | ||
267 | |||
268 | *** Buffers | ||
269 | |||
270 | #+begin_src emacs-lisp | ||
271 | |||
272 | (jd/leader-key-def | ||
273 | "bk" '(kill-this-buffer :which-key "Buffer kill")) | ||
274 | |||
275 | #+end_src | ||
276 | |||
277 | * Org | ||
278 | |||
279 | ** Org-mode setup | ||
280 | |||
281 | #+begin_src emacs-lisp | ||
282 | |||
283 | (defun jd/org-mode-setup () | ||
284 | (org-indent-mode) | ||
285 | (variable-pitch-mode 1) | ||
286 | (visual-line-mode 1)) | ||
287 | |||
288 | (use-package org | ||
289 | :pin org | ||
290 | :commands (org-capture org-agenda) | ||
291 | :hook (org-mode . jd/org-mode-setup) | ||
292 | :config | ||
293 | (setq org-ellipsis " ▾") | ||
294 | |||
295 | (setq org-agenda-start-with-log-mode t) | ||
296 | (setq org-log-done 'time) | ||
297 | (setq org-log-into-drawer t) | ||
298 | (require 'org-tempo)) | ||
299 | |||
300 | #+end_src | ||
301 | |||
302 | *** Keybinds | ||
303 | |||
304 | #+begin_src emacs-lisp | ||
305 | |||
306 | (jd/leader-key-def | ||
307 | "o" '(:ignore t :which-key "Open") | ||
308 | "oa" '(org-agenda :which-key "Open org-agenda")) | ||
309 | |||
310 | #+end_src | ||
311 | |||
312 | ** Org make toc | ||
313 | |||
314 | #+begin_src emacs-lisp | ||
315 | (use-package org-make-toc) | ||
316 | |||
317 | (add-hook 'org-mode-hook #'org-make-toc-mode) | ||
318 | ; (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'org-make-toc))) | ||
319 | #+end_src | ||
320 | |||
321 | ** Org fonts | ||
322 | |||
323 | #+begin_src emacs-lisp | ||
324 | |||
325 | (defun jd/org-font-setup () | ||
326 | ;; Replace list hyphen with dot | ||
327 | (font-lock-add-keywords 'org-mode | ||
328 | '(("^ *\\([-]\\) " | ||
329 | (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) | ||
330 | |||
331 | ;; Set faces for heading levels | ||
332 | (dolist (face '((org-level-1 . 1.3) | ||
333 | (org-level-2 . 1.2) | ||
334 | (org-level-3 . 1.1) | ||
335 | (org-level-4 . 1.0) | ||
336 | (org-level-5 . 1.1) | ||
337 | (org-level-6 . 1.1) | ||
338 | (org-level-7 . 1.1) | ||
339 | (org-level-8 . 1.1))) | ||
340 | (set-face-attribute (car face) nil :font "Monospace" :weight 'Bold :height (cdr face))) | ||
341 | |||
342 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way | ||
343 | (set-face-attribute 'org-block nil :font "mononoki Nerd Font" :inherit 'fixed-pitch) | ||
344 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) | ||
345 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) | ||
346 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) | ||
347 | (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) | ||
348 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) | ||
349 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
350 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
351 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | ||
352 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) | ||
353 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) | ||
354 | |||
355 | (with-eval-after-load 'org-faces (jd/org-font-setup)) | ||
356 | |||
357 | #+end_src | ||
358 | |||
359 | ** Org tempo setup | ||
360 | |||
361 | #+begin_src emacs-lisp | ||
362 | |||
363 | (defun jd/org-tempo-setup () | ||
364 | (add-to-list 'org-structure-template-alist '("sh" . "src sh")) | ||
365 | (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) | ||
366 | (add-to-list 'org-structure-template-alist '("li" . "src lisp")) | ||
367 | (add-to-list 'org-structure-template-alist '("sc" . "src scheme")) | ||
368 | (add-to-list 'org-structure-template-alist '("ts" . "src typescript")) | ||
369 | (add-to-list 'org-structure-template-alist '("py" . "src python")) | ||
370 | (add-to-list 'org-structure-template-alist '("go" . "src go")) | ||
371 | (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) | ||
372 | |||
373 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) | ||
374 | |||
375 | #+end_src | ||
376 | |||
377 | ** Org babel setup | ||
378 | |||
379 | *** Auto tangle | ||
380 | |||
381 | #+begin_src emacs-lisp | ||
382 | |||
383 | (defun jd/org-babel-tangle-config () | ||
384 | (when (string-equal (file-name-directory (buffer-file-name)) | ||
385 | (expand-file-name user-emacs-directory)) | ||
386 | ;; Dynamic scoping to the rescue | ||
387 | (let ((org-confirm-babel-evaluate nil)) | ||
388 | (org-babel-tangle)))) | ||
389 | |||
390 | (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))) | ||
391 | |||
392 | #+end_src | ||
393 | |||
394 | ** Org margin | ||
395 | |||
396 | #+begin_src emacs-lisp | ||
397 | |||
398 | (defun jd/org-mode-visual-fill () | ||
399 | (setq visual-fill-column-width 100 | ||
400 | visual-fill-column-center-text t) | ||
401 | (visual-fill-column-mode 1)) | ||
402 | |||
403 | (use-package visual-fill-column | ||
404 | :hook (org-mode . jd/org-mode-visual-fill)) | ||
405 | |||
406 | #+end_src | ||
407 | |||
408 | ** Org superstar | ||
409 | |||
410 | #+begin_src emacs-lisp | ||
411 | |||
412 | (use-package org-superstar | ||
413 | :hook (org-mode . org-superstar-mode) | ||
414 | :config | ||
415 | (setq org-superstar-special-todo-items t) | ||
416 | (setq org-superstar-remove-leading-stars t) | ||
417 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) | ||
418 | |||
419 | #+end_src | ||
420 | |||
421 | * Development | ||
422 | |||
423 | ** Projectile | ||
424 | |||
425 | #+begin_src emacs-lisp | ||
426 | |||
427 | (use-package projectile | ||
428 | :diminish projectile-mode | ||
429 | :init | ||
430 | (when (file-directory-p "~/Documents/code") | ||
431 | (setq projectile-project-search-path '("~/Documents/code/"))) | ||
432 | :config (projectile-mode) | ||
433 | :custom ((projectile-Completion-system 'ivy))) | ||
434 | |||
435 | #+end_src | ||
436 | |||
437 | *** Keybinds | ||
438 | |||
439 | #+begin_src emacs-lisp | ||
440 | |||
441 | (jd/leader-key-def | ||
442 | "p" '(projectile-command-map :which-key "Project") | ||
443 | "p <ESC>" '() | ||
444 | "SPC" '(projectile-find-file :which-key "Find file in project")) | ||
445 | |||
446 | #+end_src | ||
447 | |||
448 | ** Magit | ||
449 | |||
450 | #+begin_src emacs-lisp | ||
451 | |||
452 | (use-package magit | ||
453 | :custom | ||
454 | (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) | ||
455 | |||
456 | #+end_src | ||
457 | *** Keybinds | ||
458 | |||
459 | #+begin_src emacs-lisp | ||
460 | |||
461 | (jd/leader-key-def | ||
462 | "g" '(:ignore t :which-key "Git") | ||
463 | "gg" '(magit-status-here :which-key "Magit status")) | ||
464 | |||
465 | #+end_src | ||
466 | |||
467 | * Apps | ||
468 | |||
469 | ** Vterm | ||
470 | |||
471 | #+begin_src emacs-lisp | ||
472 | |||
473 | (use-package vterm) | ||
474 | (use-package vterm-toggle | ||
475 | :init | ||
476 | (setq vterm-toggle-fullscreen-p nil) | ||
477 | :config | ||
478 | (add-to-list 'display-buffer-alist | ||
479 | '((lambda (buffer-or-name _) | ||
480 | (let ((buffer (get-buffer buffer-or-name))) | ||
481 | (with-current-buffer buffer | ||
482 | (or (equal major-mode 'vterm-mode) | ||
483 | (string-prefix-p vterm-buffer-name (buffer-name buffer)))))) | ||
484 | (display-buffer-reuse-window display-buffer-at-bottom) | ||
485 | (reusable-frames . visible) | ||
486 | (window-height . 0.3)))) | ||
487 | |||
488 | #+end_src | ||
489 | |||
490 | *** Keybinds | ||
491 | |||
492 | #+begin_src emacs-lisp | ||
493 | |||
494 | (jd/leader-key-def | ||
495 | "oT" '(vterm :which-key "Open terminal in current window") | ||
496 | "ot" '(vterm-toggle :which-key "Toggle terminal")) | ||
497 | |||
498 | #+end_src | ||
499 | |||
500 | |||
501 | ** Dired | ||
502 | |||
503 | #+begin_src emacs-lisp | ||
504 | |||
505 | (use-package all-the-icons-dired | ||
506 | :hook (dired-mode . all-the-icons-dired-mode)) | ||
507 | |||
508 | (use-package dired-ranger) | ||
509 | |||
510 | (use-package dired | ||
511 | :ensure nil | ||
512 | :commands (dired dired-jump) | ||
513 | :bind (("C-x C-j" . dired-jump)) | ||
514 | :custom ((dired-listing-switches "-agho --group-directories-first")) | ||
515 | :config | ||
516 | (evil-collection-define-key 'normal 'dired-mode-map | ||
517 | "h" 'dired-up-directory | ||
518 | "l" 'dired-single-buffer)) | ||
519 | |||
520 | #+end_src | ||
diff --git a/.config/emacs/init.el b/.config/emacs/init.el new file mode 100644 index 0000000..ffcd1bb --- /dev/null +++ b/.config/emacs/init.el | |||
@@ -0,0 +1,289 @@ | |||
1 | (setq user-full-name "Jakub Dlugosz" | ||
2 | user-mail-address "jdlugosz963@gmail.com") | ||
3 | |||
4 | (setq gc-cons-threshold (* 50 1000 1000)) | ||
5 | |||
6 | (defun jd/display-startup-time () | ||
7 | (message "Emacs loaded in %s with %d garbage collections." | ||
8 | (format "%.2f seconds" | ||
9 | (float-time | ||
10 | (time-subtract after-init-time before-init-time))) | ||
11 | gcs-done)) | ||
12 | |||
13 | (add-hook 'emacs-startup-hook #'jd/display-startup-time) | ||
14 | |||
15 | (require 'package) | ||
16 | (setq package-archives '(("melpa" . "https://melpa.org/packages/") | ||
17 | ("org" . "https://orgmode.org/elpa/") | ||
18 | ("gnu-devel" . "https://elpa.gnu.org/devel/") | ||
19 | ("elpa" . "https://elpa.gnu.org/packages/"))) | ||
20 | (package-initialize) | ||
21 | |||
22 | (unless package-archive-contents | ||
23 | (package-refresh-contents)) | ||
24 | |||
25 | (unless (package-installed-p 'use-package) | ||
26 | (package-install 'use-package)) | ||
27 | |||
28 | (setq use-package-always-ensure t) | ||
29 | |||
30 | (require 'use-package) | ||
31 | |||
32 | (use-package general | ||
33 | :config | ||
34 | (general-create-definer jd/leader-key-def | ||
35 | :keymaps '(normal insert visual emacs) | ||
36 | :prefix "SPC" | ||
37 | :global-prefix "C-SPC") | ||
38 | |||
39 | (general-create-definer jd/ctrl-c-keys | ||
40 | :prefix "C-c")) | ||
41 | |||
42 | (use-package undo-tree | ||
43 | :config | ||
44 | (setq undo-tree-auto-save-history nil) | ||
45 | (global-undo-tree-mode 1)) | ||
46 | |||
47 | (use-package evil | ||
48 | :init | ||
49 | (setq evil-want-integration t) | ||
50 | (setq evil-want-keybinding nil) | ||
51 | (setq evil-want-C-u-scroll t) | ||
52 | (setq evil-want-C-i-jump nil) | ||
53 | (setq evil-undo-system 'undo-tree) | ||
54 | :config | ||
55 | (evil-mode 1)) | ||
56 | |||
57 | (use-package evil-collection | ||
58 | :after evil | ||
59 | :config | ||
60 | (evil-collection-init)) | ||
61 | |||
62 | (jd/leader-key-def | ||
63 | "w" 'evil-window-map | ||
64 | "wd" '(evil-window-delete :which-key "Window delete")) | ||
65 | |||
66 | (jd/leader-key-def | ||
67 | "ou" '(undo-tree-visualize :which-key "Open")) | ||
68 | |||
69 | ;; remove . key | ||
70 | (define-key evil-normal-state-map (kbd ".") '()) | ||
71 | |||
72 | (setq inhibit-startup-message t) | ||
73 | (scroll-bar-mode -1) | ||
74 | (tool-bar-mode -1) | ||
75 | (tooltip-mode -1) | ||
76 | (menu-bar-mode -1) | ||
77 | (set-fringe-mode 10) | ||
78 | |||
79 | (set-face-attribute 'default nil :font "Hack" :height 100) | ||
80 | |||
81 | ; (load-theme 'wombat) | ||
82 | |||
83 | (global-set-key (kbd "<escape>") 'keyboard-escape-quit) | ||
84 | |||
85 | (use-package monokai-theme | ||
86 | :config | ||
87 | (load-theme 'monokai t)) | ||
88 | |||
89 | (use-package diminish) | ||
90 | |||
91 | (use-package counsel) | ||
92 | (use-package ivy | ||
93 | :diminish | ||
94 | :bind | ||
95 | (("C-s" . swiper) | ||
96 | :map ivy-minibuffer-map | ||
97 | ("C-k" . ivy-previous-line) | ||
98 | ("C-j" . ivy-next-line) | ||
99 | :map ivy-switch-buffer-map | ||
100 | ("C-k" . ivy-previous-line)) | ||
101 | :config | ||
102 | (ivy-mode 1)) | ||
103 | |||
104 | (jd/leader-key-def | ||
105 | "t" '(:ignore t :which-key "Toogle") | ||
106 | "tt" '(counsel-load-theme :which-key "Choose theme")) | ||
107 | |||
108 | (jd/leader-key-def | ||
109 | "bb" '(counsel-switch-buffer :which-key "Buffer switch") | ||
110 | "b" '(:ignore t :which-key "Buffer") | ||
111 | "," '(counsel-switch-buffer :which-key "Buffer switch")) | ||
112 | |||
113 | (use-package which-key | ||
114 | :diminish | ||
115 | :config | ||
116 | (which-key-mode) | ||
117 | (setq which-key-idle-delay 0.3)) | ||
118 | |||
119 | (use-package all-the-icons) | ||
120 | |||
121 | (use-package doom-modeline | ||
122 | :init (doom-modeline-mode 1) | ||
123 | :custom ((doom-modeline-height 15))) | ||
124 | |||
125 | (jd/leader-key-def | ||
126 | "f" '(:ignore t :which-key "Files") | ||
127 | "fs" '(save-buffer :which-key "File save") | ||
128 | "." '(find-file :which-key "Find file") | ||
129 | "ff" '(find-file :which-key "Find file")) | ||
130 | |||
131 | (jd/leader-key-def | ||
132 | "e" '(:ignore t :which-key "Eval") | ||
133 | "eb" '(eval-buffer :which-key "Eval buffer")) | ||
134 | |||
135 | (jd/leader-key-def | ||
136 | :keymaps '(visual) | ||
137 | "er" '(eval-region :which-key "Eval region")) | ||
138 | |||
139 | (jd/leader-key-def | ||
140 | "bk" '(kill-this-buffer :which-key "Buffer kill")) | ||
141 | |||
142 | (defun jd/org-mode-setup () | ||
143 | (org-indent-mode) | ||
144 | (variable-pitch-mode 1) | ||
145 | (visual-line-mode 1)) | ||
146 | |||
147 | (use-package org | ||
148 | :pin org | ||
149 | :commands (org-capture org-agenda) | ||
150 | :hook (org-mode . jd/org-mode-setup) | ||
151 | :config | ||
152 | (setq org-ellipsis " ▾") | ||
153 | |||
154 | (setq org-agenda-start-with-log-mode t) | ||
155 | (setq org-log-done 'time) | ||
156 | (setq org-log-into-drawer t) | ||
157 | (require 'org-tempo)) | ||
158 | |||
159 | (jd/leader-key-def | ||
160 | "o" '(:ignore t :which-key "Open") | ||
161 | "oa" '(org-agenda :which-key "Open org-agenda")) | ||
162 | |||
163 | (use-package org-make-toc) | ||
164 | |||
165 | (add-hook 'org-mode-hook #'org-make-toc-mode) | ||
166 | ; (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'org-make-toc))) | ||
167 | |||
168 | (defun jd/org-font-setup () | ||
169 | ;; Replace list hyphen with dot | ||
170 | (font-lock-add-keywords 'org-mode | ||
171 | '(("^ *\\([-]\\) " | ||
172 | (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) | ||
173 | |||
174 | ;; Set faces for heading levels | ||
175 | (dolist (face '((org-level-1 . 1.3) | ||
176 | (org-level-2 . 1.2) | ||
177 | (org-level-3 . 1.1) | ||
178 | (org-level-4 . 1.0) | ||
179 | (org-level-5 . 1.1) | ||
180 | (org-level-6 . 1.1) | ||
181 | (org-level-7 . 1.1) | ||
182 | (org-level-8 . 1.1))) | ||
183 | (set-face-attribute (car face) nil :font "Monospace" :weight 'Bold :height (cdr face))) | ||
184 | |||
185 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way | ||
186 | (set-face-attribute 'org-block nil :font "mononoki Nerd Font" :inherit 'fixed-pitch) | ||
187 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) | ||
188 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) | ||
189 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) | ||
190 | (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) | ||
191 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) | ||
192 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
193 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
194 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | ||
195 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) | ||
196 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) | ||
197 | |||
198 | (with-eval-after-load 'org-faces (jd/org-font-setup)) | ||
199 | |||
200 | (defun jd/org-tempo-setup () | ||
201 | (add-to-list 'org-structure-template-alist '("sh" . "src sh")) | ||
202 | (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) | ||
203 | (add-to-list 'org-structure-template-alist '("li" . "src lisp")) | ||
204 | (add-to-list 'org-structure-template-alist '("sc" . "src scheme")) | ||
205 | (add-to-list 'org-structure-template-alist '("ts" . "src typescript")) | ||
206 | (add-to-list 'org-structure-template-alist '("py" . "src python")) | ||
207 | (add-to-list 'org-structure-template-alist '("go" . "src go")) | ||
208 | (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) | ||
209 | |||
210 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) | ||
211 | |||
212 | (defun jd/org-babel-tangle-config () | ||
213 | (when (string-equal (file-name-directory (buffer-file-name)) | ||
214 | (expand-file-name user-emacs-directory)) | ||
215 | ;; Dynamic scoping to the rescue | ||
216 | (let ((org-confirm-babel-evaluate nil)) | ||
217 | (org-babel-tangle)))) | ||
218 | |||
219 | (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))) | ||
220 | |||
221 | (defun jd/org-mode-visual-fill () | ||
222 | (setq visual-fill-column-width 100 | ||
223 | visual-fill-column-center-text t) | ||
224 | (visual-fill-column-mode 1)) | ||
225 | |||
226 | (use-package visual-fill-column | ||
227 | :hook (org-mode . jd/org-mode-visual-fill)) | ||
228 | |||
229 | (use-package org-superstar | ||
230 | :hook (org-mode . org-superstar-mode) | ||
231 | :config | ||
232 | (setq org-superstar-special-todo-items t) | ||
233 | (setq org-superstar-remove-leading-stars t) | ||
234 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) | ||
235 | |||
236 | (use-package projectile | ||
237 | :diminish projectile-mode | ||
238 | :init | ||
239 | (when (file-directory-p "~/Documents/code") | ||
240 | (setq projectile-project-search-path '("~/Documents/code/"))) | ||
241 | :config (projectile-mode) | ||
242 | :custom ((projectile-Completion-system 'ivy))) | ||
243 | |||
244 | (jd/leader-key-def | ||
245 | "p" '(projectile-command-map :which-key "Project") | ||
246 | "p <ESC>" '() | ||
247 | "SPC" '(projectile-find-file :which-key "Find file in project")) | ||
248 | |||
249 | (use-package magit | ||
250 | :custom | ||
251 | (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) | ||
252 | |||
253 | (jd/leader-key-def | ||
254 | "g" '(:ignore t :which-key "Git") | ||
255 | "gg" '(magit-status-here :which-key "Magit status")) | ||
256 | |||
257 | (use-package vterm) | ||
258 | (use-package vterm-toggle | ||
259 | :init | ||
260 | (setq vterm-toggle-fullscreen-p nil) | ||
261 | :config | ||
262 | (add-to-list 'display-buffer-alist | ||
263 | '((lambda (buffer-or-name _) | ||
264 | (let ((buffer (get-buffer buffer-or-name))) | ||
265 | (with-current-buffer buffer | ||
266 | (or (equal major-mode 'vterm-mode) | ||
267 | (string-prefix-p vterm-buffer-name (buffer-name buffer)))))) | ||
268 | (display-buffer-reuse-window display-buffer-at-bottom) | ||
269 | (reusable-frames . visible) | ||
270 | (window-height . 0.3)))) | ||
271 | |||
272 | (jd/leader-key-def | ||
273 | "oT" '(vterm :which-key "Open terminal in current window") | ||
274 | "ot" '(vterm-toggle :which-key "Toggle terminal")) | ||
275 | |||
276 | (use-package all-the-icons-dired | ||
277 | :hook (dired-mode . all-the-icons-dired-mode)) | ||
278 | |||
279 | (use-package dired-ranger) | ||
280 | |||
281 | (use-package dired | ||
282 | :ensure nil | ||
283 | :commands (dired dired-jump) | ||
284 | :bind (("C-x C-j" . dired-jump)) | ||
285 | :custom ((dired-listing-switches "-agho --group-directories-first")) | ||
286 | :config | ||
287 | (evil-collection-define-key 'normal 'dired-mode-map | ||
288 | "h" 'dired-up-directory | ||
289 | "l" 'dired-single-buffer)) | ||