blob: 8f9132f6d5258cf188ce45268ec5c94efe3eff95 (
about) (
plain)
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
#+title My emacs configuration
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el
* Package System Setup
#+begin_src emacs-lisp
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
#+end_src
* UI Configuration
** Basics Configuration
#+begin_src emacs-lisp
(setq inhibit-startup-message nil)
(defvar apollo/default-font-size 130)
(set-face-attribute 'default nil :font "JetBrains Mono" :height 130)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(set-fringe-mode 10)
(menu-bar-mode -1)
(blink-cursor-mode -1)
(menu-bar--visual-line-mode-enable)
;Visible bell
(setq visible-bell t)
(column-number-mode)
(global-display-line-numbers-mode t)
(menu-bar--display-line-numbers-mode-relative)
;;Disable line numbers for some modes
(dolist (mode '(pdf-view-mode-hook
org-mode-hook
term-mode-hook
shell-mode-hook
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
#+end_src
** Font configuration
I use *JetBrains Mono*, *Arial* and *Cantarell* for this configuration, which will need to be installed in your system for this configuration to work
#+begin_src emacs-lisp
(set-face-attribute 'default nil
:font "JetBrains Mono"
:height apollo/default-font-size)
(set-face-attribute 'fixed-pitch nil
:font "Arial"
:height 260)
(set-face-attribute 'variable-pitch nil
:font "Cantarell"
:height 295
:weight 'regular)
#+end_src
** Color theme
#+begin_src emacs-lisp
(use-package doom-themes
:init (load-theme 'doom-dracula t))
#+end_src
** Modeline
#+begin_src emacs-lisp
(use-package all-the-icons
:ensure t)
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 35)))
#+end_src
** Which Key
#+begin_src emacs-lisp
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 0.5)
)
#+end_src
** Ivy and counsel
#+begin_src emacs-lisp
(use-package ivy
:diminish
:bind (("C-s" . swiper)
:map ivy-minibuffer-map
("TAB" . ivy-alt-done)
("C-l" . ivy-alt-done)
("C-j" . ivy-next-line)
("C-k" . ivy-previous-line)
:map ivy-switch-buffer-map
("C-k" . ivy-previous-line)
("C-l" . ivy-done)
("C-d" . ivy-switch-buffer-kill)
:map ivy-reverse-i-search-map
("C-k" . ivy-previous-line)
("C-d" . ivy-reverse-i-search-kill))
:config
(ivy-mode 1))
(use-package ivy-rich
:init
(ivy-rich-mode 1))
(use-package counsel
:bind (("C-M-j" . 'counsel-switch-buffer)
:map minibuffer-local-map
("C-r" . 'counsel-minibuffer-history)
("C-'" . 'counsel-find-file))
:config
(counsel-mode 1))
#+end_src
** Helpful Help Commands
#+begin_src emacs-lisp
(use-package helpful
:custom
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-variable-function #'helpful-variable)
:bind
([remap describe-function] . counsel-describe-function)
([remap describe-command] . helpful-command)
([remap describe-variable] . counsel-describe-variable)
([remap describe-key] . helpful-key))
#+end_src
** Cursor color
+ I'm using smart-cursor-color-mode
#+begin_src emacs-lisp
(use-package smart-cursor-color
:config
(smart-cursor-color-mode +1))
#+end_src
* Keybinding configuration
** The Essentials
I use [[https://evil.readthedocs.io/en/latest/index.html][evil-mode]] for a vim-like experience, with *general.el* and *evil-collection* for better integration
#+begin_src emacs-lisp
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(use-package general
:config
(general-create-definer apollo/leader-keys
:keymaps '(normal insert visual emacs)
:prefix "SPC"
:global-prefix "C-SPC")
(apollo/leader-keys
"t" '(:ignore t :which-key "toggles")
"tt" '(counsel-load-theme :which-key "choose theme")))
(use-package evil
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
;;:hook (evil-mode . apollo/evil-hook)
:config
(evil-mode 1)
(define-key evil-insert-state-map (kbd "C-f") 'evil-normal-state)
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
(evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal)
(evil-define-key 'normal dired-mode-map
(kbd "h") 'dired-up-directory
(kbd "l") 'dired-find-file
(kbd "m") 'dired-mark
(kbd "R") 'dired-do-rename
(kbd "D") 'dired-do-delete)
)
(use-package evil-collection
:after evil
:config
(evil-collection-init))
;;Ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)
;;Counsel
(global-set-key (kbd "M-;") 'counsel-M-x)
(global-set-key (kbd "C-;") 'counsel-find-file)
#+end_src
** apollo/leader-keys
*** Magit
#+begin_src emacs-lisp
(apollo/leader-keys
"g" '(:ignore t :which-key "Git")
"gs" '(magit-status :which-key "status"))
#+end_src
*** Counsel
#+begin_src emacs-lisp
(apollo/leader-keys
"f" '(counsel-find-file :which-key "Find File"))
#+end_src
* Org mode
** Basic configuration
#+begin_src emacs-lisp
(defun apollo/org-mode-setup ()
(setq evil-auto-indent nil)
(apollo/org-theme-dracula))
(use-package org
:hook (org-mode . apollo/org-mode-setup)
:config
(setq org-directory "~/org/"
org-agenda-files '("~/org/agenda.org"
"~/org/med.org")
org-default-notes-file (expand-file-name "notes.org" org-directory)
org-ellipsis " ▼ "
org-log-done 'time
org-hide-emphasis-markers nil ;change to t to hide emphasis markers
org-table-convert-region-max-lines 20000
org-todo-keywords ; This overwrites the default Doom org-todo-keywords
'((sequence
"TODO(t)" ; A task that is ready to be tackled
"BLOG(b)" ; Blog writing assignments
"GYM(g)" ; Things to accomplish at the gym
"WAIT(w)" ; Something is holding up this task
"|" ; The pipe necessary to separate "active" states and "inactive" states
"DONE(d)" ; Task has been completed
"CANCELLED(c)" )))
(setq org-agenda-start-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
)
#+end_src
*** Org bullets
+ Recently I've been trying out org-superstar as a replacement for org-bullets, but I kept the configuration as a comment for anyone wanting to test it out
#+begin_src emacs-lisp
;; Use either org-bullets or org-superstar
;; (use-package org-bullets
;; :after org
;; :hook (org-mode . org-bullets-mode)
;; :custom
;; (org-bullets-bullet-list '("●" "○" "●" "○" "●" "●" )))
(use-package org-superstar
:after org
:hook (org-mode . org-superstar-mode)
:config
(setq
org-superstar-headline-bullets-list '("◉" "●" "○" "●" "○" "●" "◆")
org-superstar-itembullet-alist '((?+ . ?➤) (?- . ?✦))) ; changes +/- symbols in item lists
)
#+end_src
*** Org Themes
**** Dark-one
#+begin_src emacs-lisp
(defun apollo/org-theme-darkone ()
"My custom org theme for doom themes"
(interactive)
(dolist
(face
'((org-level-1 1.70 "#51afef" ultra-bold)
(org-level-2 1.55 "#7FBCD2" extra-bold)
(org-level-3 1.40 "#da8548" bold)
(org-level-4 1.20 "#da8548" semi-bold)
(org-level-5 1.20 "#5699af" normal)
(org-level-6 1.20 "#a9a1e1" normal)
(org-level-7 1.10 "#46d9ff" normal)
(org-level-8 1.00 "#ff6c6b" normal)))
(set-face-attribute (nth 0 face) nil
:font "Jetbrains Mono"
:weight (nth 3 face)
:height (nth 1 face)
:foreground (nth 2 face)))
(set-face-attribute 'org-table nil
:font "Jetbrains Mono"
:weight 'normal
:height 1.0
:foreground "#A66CFF"))
#+end_src
**** Dracula
#+begin_src emacs-lisp
(defun apollo/org-theme-dracula ()
"Enable Dracula theme for Org headers."
(interactive)
(dolist
(face
'((org-level-1 1.7 "#8be9fd" ultra-bold)
(org-level-2 1.6 "#bd93f9" extra-bold)
(org-level-3 1.5 "#50fa7b" bold)
(org-level-4 1.4 "#ff79c6" semi-bold)
(org-level-5 1.3 "#9aedfe" normal)
(org-level-6 1.2 "#caa9fa" normal)
(org-level-7 1.1 "#5af78e" normal)
(org-level-8 1.0 "#ff92d0" normal)))
(set-face-attribute (nth 0 face) nil
:font "JetBrains Mono"
:weight (nth 3 face)
:height (nth 1 face)
:foreground (nth 2 face)))
(set-face-attribute 'org-table nil
:font "JetBrains Mono"
:weight 'normal
:height 1.0
:foreground "#bfafdf"))
#+end_src
**** Center text function
#+begin_src emacs-lisp
(defun apollo/org-mode-visual ()
(interactive)
(setq visual-fill-column-width 100
visual-fill-column-center-text t)
(visual-fill-column-mode 1))
(defun apollo/org-mode-visual-undo ()
(interactive)
(setq visual-fill-column-width 2000
visual-fill-column-center-text nil)
(visual-fill-column-mode 1))
(use-package visual-fill-column)
#+end_src
** Babel Languages
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)))
#+end_src
** Babel templates
#+begin_src emacs-lisp
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
#+end_src
** Auto-tangle configuration
#+begin_src emacs-lisp
;; Automatically tangle our Emacs.org config file when we save it
(defun apollo/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/.emacs.d/emacs.org"))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'apollo/org-babel-tangle-config)))
#+end_src
Add some text
* Development
** Languages
*** IDE Features | lsp-mode
**** lsp-mode
#+begin_src emacs-lisp
;;instal flyckeck
(use-package flyckeck)
;;setup lsp-mode
(defun apollo/lsp-mode-setup ()
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
(use-package lsp-mode
:commands (lsp lsp-deferred)
:hook (lsp-mode . apollo/lsp-mode-setup)
:init
(setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l'
:config
(lsp-enable-which-key-integration t)
)
#+end_src
**** lsp-ui
#+begin_src emacs-lisp
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
:custom
(lsp-ui-doc-position 'bottom))
#+end_src
*** Debugging with dap
#+begin_src emacs-lisp
(use-package dap-mode
;; Uncomment the config below if you want all UI panes to be hidden by default!
;; :custom
;; (lsp-enable-dap-auto-configure nil)
;; :config
;; (dap-ui-mode 1)
:config
;; Set up Node debugging
(require 'dap-node)
(dap-node-setup) ;; Automatically installs Node debug adapter if needed
;; Bind `C-c l d` to `dap-hydra` for easy access
(general-define-key
:keymaps 'lsp-mode-map
:prefix lsp-keymap-prefix
"d" '(dap-hydra t :wk "debugger")))
#+end_src
*** Javascript
+ For javascript, automatic installation guide [[https://emacs-lsp.github.io/lsp-mode/page/lsp-typescript/][here]]
#+begin_src emacs-lisp
#+end_src
*** TypeScript
#+begin_src emacs-lisp
(use-package typescript-mode
:mode "\\.ts\\'"
:hook (typescript-mode .lsp-deferred)
:config
(setq typescript-indent-level 2))
#+end_src
*** Python
#+begin_src emacs-lisp
(use-package python-mode
:ensure t
:hook (python-mode . lsp-deferred)
:custom
;; NOTE: Set these if Python 3 is called "python3" on your system!
;; (python-shell-interpreter "python3")
;; (dap-python-executable "python3")
(dap-python-debugger 'debugpy)
:config
(require 'dap-python))
;;Pyenv
(use-package pyvenv
:config
(pyvenv-mode 1))
;;set PATH of pyls
(setq lsp-pyls-server-command "/home/apollo/.local/bin/pylsp")
#+end_src
*** Company mode
#+begin_src emacs-lisp
(use-package company
:after lsp-mode
:hook (lsp-mode . company-mode)
:bind (:map company-active-map
("<tab>" . company-complete-selection))
(:map lsp-mode-map
("<tab>" . company-indent-or-complete-common))
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0))
(use-package company-box
:hook (company-mode . company-box-mode))
#+end_src
** Magit
The best Git interface
#+begin_src emacs-lisp
(use-package magit
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
#+end_src
|