summaryrefslogtreecommitdiffstats
path: root/.config/emacs/jd-emacs/jd-emacs-ui.el
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2023-06-10 09:36:37 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2023-07-02 13:52:12 +0200
commitef565a486511cbbb86e0d1f80264b3b57d2ac88a (patch)
tree4e0b04e78f288985a629ad8b9a8e56eb266de6a4 /.config/emacs/jd-emacs/jd-emacs-ui.el
parent2b62ae597cc6a4c213f7d4b54b112ff9c216dbaa (diff)
downloaddotfiles-ef565a486511cbbb86e0d1f80264b3b57d2ac88a.tar.gz
dotfiles-ef565a486511cbbb86e0d1f80264b3b57d2ac88a.zip
Migrate from .org to .el Emacs config.
Diffstat (limited to '.config/emacs/jd-emacs/jd-emacs-ui.el')
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-ui.el154
1 files changed, 154 insertions, 0 deletions
diff --git a/.config/emacs/jd-emacs/jd-emacs-ui.el b/.config/emacs/jd-emacs/jd-emacs-ui.el
new file mode 100644
index 0000000..c8236af
--- /dev/null
+++ b/.config/emacs/jd-emacs/jd-emacs-ui.el
@@ -0,0 +1,154 @@
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