-
Notifications
You must be signed in to change notification settings - Fork 31
/
+ui.el
199 lines (173 loc) · 9.05 KB
/
+ui.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
;;; +ui.el -*- lexical-binding: t; -*-
;; (setq doom-one-brighter-comments t
;; doom-city-lights-brighter-comments t
;; doom-one-light-brighter-comments t)
(defun my/apply-theme (appearance)
"Load theme, taking current system APPEARANCE into consideration."
(mapc #'disable-theme custom-enabled-themes)
(pcase appearance
('light (load-theme (get-random-element '(doom-acario-light doom-one-light)) t))
('dark (load-theme 'doom-city-lights t))))
(if (display-graphic-p)
(add-hook 'ns-system-appearance-change-functions #'my/apply-theme)
(progn
(if (string= (getenv "DOTTY_THEME") "dark")
(load-theme 'doom-city-lights t)
(load-theme (get-random-element '(doom-acario-light doom-one-light)) t))))
;; no title bar https://github.com/d12frosted/homebrew-emacs-plus?tab=readme-ov-file#emacs-29-and-emacs-30
(add-to-list 'default-frame-alist '(undecorated-round . t))
(setq fancy-splash-image (concat doom-private-dir "assets/GNUEmacs.png"))
(setq evil-emacs-state-cursor `(box ,(doom-color 'violet)))
(when (display-graphic-p)
(setq user-font
(cond
((find-font (font-spec :name "Mononoki Nerd Font Mono")) "Mononoki Nerd Font Mono")
((find-font (font-spec :name "CartographCF Nerd Font")) "CartographCF Nerd Font")
((find-font (font-spec :name "OperatorMono Nerd Font")) "OperatorMono Nerd Font")
((find-font (font-spec :name "Droid Sans Mono")) "Droid Sans Mono")
((find-font (font-spec :name "Droid Sans Fallback")) "Droid Sans Fallback")))
;; Some font uses Light font as regular, not sure why. Only use medium weight for this font.
(setq user-font-weight
(cond
((string= user-font "CartographCF Nerd Font") 'medium)
(t 'normal))
)
;; calculate the font size based on display-pixel-height
(setq resolution-factor (eval (/ (x-display-pixel-height) 1080.0)))
(setq doom-font (font-spec :family user-font :weight user-font-weight :size (eval (round (* 14 resolution-factor))))
doom-big-font (font-spec :family user-font :weight user-font-weight :size (eval (round (* 18 resolution-factor))))
doom-variable-pitch-font (font-spec :family user-font :weight user-font-weight :size (eval (round (* 13 resolution-factor))))
doom-modeline-height (eval (round (* 24 resolution-factor))))
(setq doom-font-increment 1)
;; set initl screen size
(setq initial-frame-alist
'((width . 110)
(height . 65))))
(add-hook! 'doom-first-buffer-hook
(defun +my/change-cjk-font ()
"change the cjk font and its size to align the org/markdown tables when have
cjk characters. Font should be twice the width of asci chars so that org tables align.
This will break if run in terminal mode, so use conditional to only run for GUI."
(when (display-graphic-p)
(setq user-cjk-font
(cond
((find-font (font-spec :name "Hiragino Sans GB")) "Hiragino Sans GB") ; for macos
((find-font (font-spec :name "Noto Sans CJK SC")) "Noto Sans CJK SC") ; for linux
))
(dolist (charset '(kana han cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset (font-spec :family user-cjk-font
:size (eval (round (* 15 resolution-factor)))))))))
;; Update window divider in terminal
;; https://www.reddit.com/r/emacs/comments/3u0d0u/how_do_i_make_the_vertical_window_divider_more/
(unless (display-graphic-p)
(defun my-change-window-divider ()
(ignore-errors
(let ((display-table (or buffer-display-table standard-display-table)))
(set-display-table-slot display-table 5 ?│)
;; (set-window-display-table (selected-window) display-table)
)))
(add-hook 'window-configuration-change-hook #'my-change-window-divider))
(after! doom-modeline
(setq doom-modeline-buffer-file-name-style 'truncate-with-project
doom-modeline-major-mode-icon t
;; My mac vsplit screen won't fit
doom-modeline-window-width-limit (- fill-column 10)))
(setq +workspaces-on-switch-project-behavior t)
(remove-hook 'doom-init-ui-hook #'blink-cursor-mode)
;; disable line-numbers by default
(setq display-line-numbers-type nil)
(defface breakpoint-enabled '((t)) "Breakpoint face.")
;; Faces need to postpone renderring
;; custom-set-faces! doesn't work properly when you switch doom themes
(custom-theme-set-faces! doom-theme
`(hl-line :background ,(doom-color 'bg-alt)) ; sometimes ranger doesn't show hl-line color
`(doom-modeline-debug-visual :background ,(doom-blend 'red 'bg 0.3))
`(mode-line :background ,(doom-blend 'dark-blue 'bg 0.6))
`(mode-line-inactive :background ,(doom-color 'bg-alt))
`(vertical-border :foreground ,(doom-color 'bg-alt))
'(font-lock-doc-face :italic t)
'(font-lock-comment-face :italic t)
'(font-lock-builtin-face :italic t)
'(font-lock-type-face :italic t)
'(tide-hl-identifier-face :inherit 'lsp-face-highlight-read)
`(breakpoint-enabled :background ,(doom-blend 'red 'bg 0.15))
`(dap-ui-pending-breakpoint-face :background ,(doom-blend 'red 'bg 0.30))
`(dap-ui-verified-breakpoint-face :background ,(doom-blend 'red 'bg 0.30))
`(lsp-ui-peek-highlight :foreground ,(doom-color 'blue))
`(ivy-posframe-border :background ,(doom-color 'blue))
`(magit-diff-file-heading :background ,(doom-blend 'blue 'bg 0.2))
`(magit-diff-file-heading-highlight :background ,(doom-blend 'blue 'bg 0.5))
'(markdown-header-face-1 :inherit 'org-level-1)
'(markdown-header-face-2 :inherit 'org-level-2)
'(markdown-header-face-3 :inherit 'org-level-3)
`(smerge-upper :background ,(doom-blend 'red 'bg 0.2))
`(smerge-lower :background ,(doom-blend 'green 'bg 0.2))
`(web-mode-jsx-depth-1-face :background ,(doom-blend 'teal 'fg 0.1))
`(web-mode-jsx-depth-2-face :background ,(doom-blend 'teal 'fg 0.2))
`(web-mode-jsx-depth-3-face :background ,(doom-blend 'teal 'fg 0.3))
`(web-mode-jsx-depth-4-face :background ,(doom-blend 'teal 'fg 0.4))
`(web-mode-jsx-depth-5-face :background ,(doom-blend 'teal 'fg 0.5))
`(flyspell-incorrect :underline ,(doom-color 'red))
`(flyspell-duplicate :underline ,(doom-color 'orange))
`(flymake-warning :underline nil :bold t)
`(flycheck-warning :underline nil :bold t)
`(flycheck-error :underline (:style wave :color ,(doom-color 'red)))
`(flycheck-info :underline (:style wave :color ,(doom-color 'green)))
`(ein:cell-input-area :background ,(doom-blend 'red 'fg 0.15))
`(ein:cell-input-prompt :background ,(doom-color 'red) :foreground ,(doom-color 'fg) :bold t)
`(font-lock-comment-face :foreground ,(doom-color 'blue))
`(font-lock-doc-face :foreground ,(doom-color 'blue)))
(custom-theme-set-faces! 'doom-city-lights
`(mode-line :background ,(doom-blend 'dark-blue 'bg 0.2))
`(hl-todo :foreground ,(doom-lighten 'fg 0.7))
`(region :background ,(doom-color 'base5))
;; ediff
`(ediff-current-diff-A :foreground ,(doom-color 'red) :background ,(doom-blend 'red 'fg 0.2))
`(ediff-current-diff-B :foreground ,(doom-color 'green) :background ,(doom-blend 'green 'fg 0.2))
`(ediff-current-diff-C :foreground ,(doom-color 'blue) :background ,(doom-blend 'blue 'fg 0.2))
`(ediff-current-diff-Ancestor :foreground ,(doom-color 'teal) :background ,(doom-blend 'teal 'fg 0.2))
)
(custom-theme-set-faces! 'doom-acario-light
;; ediff
`(ediff-current-diff-A :foreground ,(doom-color 'red) :background ,(doom-blend 'red 'bg 0.2))
`(ediff-current-diff-B :foreground ,(doom-color 'green) :background ,(doom-blend 'green 'bg 0.2))
`(ediff-current-diff-C :foreground ,(doom-color 'blue) :background ,(doom-blend 'blue 'bg 0.2))
`(ediff-current-diff-Ancestor :foreground ,(doom-color 'teal) :background ,(doom-blend 'teal 'bg 0.2))
`(wgrep-face :background ,(doom-blend 'grey 'bg 0.2))
`(markdown-code-face :background ,(doom-color 'bg-alt))
)
;; for terminal
(unless (display-graphic-p)
(custom-set-faces!
`(mode-line-inactive :background ,(doom-darken (doom-color 'bg-alt) 0.05) :foreground ,(doom-color 'fg))))
;; (when IS-MAC
;; ;; enable ligatures support
;; ;; details here: https://github.com/tonsky/FiraCode/wiki/Emacs-instructions
;; (ignore-errors
;; (mac-auto-operator-composition-mode)))
(after! ibuffer
(setq-hook! 'ibuffer-hook ibuffer-formats
'((mark modified read-only locked " "
(name 50 18 :left :elide)
" "
(size 9 -1 :right)
" "
(mode 16 16 :left :elide)
" " filename-and-process)
(mark " "
(name 16 -1)
" " filename))))
(use-package! all-the-icons-ibuffer
:after ibuffer
:init (all-the-icons-ibuffer-mode 1)
)
(add-hook! 'process-menu-mode-hook
(setq-local tabulated-list-format [("Process" 30 t)
("PID" 7 t)
("Status" 7 t)
("Buffer" 15 t)
("TTY" 12 t)
("Command" 0 t)]))
(after! centered-window
(setq cwm-centered-window-width 160))