]> git.armaanb.net Git - config.org.git/blob - config.org
a711376f67726560a8c427bfaf6d8e23e87b3caf
[config.org.git] / config.org
1 #+TITLE: System Configuration
2 #+DESCRIPTION: Armaan's system configuration.
3
4 * Welcome
5 Welcome to my system configuration! This file contains my Emacs configuration, but also my config files for many of the other programs on my system!
6 ** Compatability
7 I am currently using GCCEmacs 28 from the feature/native-comp branch, so some settings may not be available for older versions of Emacs. This is a purely personal configuration, so while I can garuntee that it works on my setup, I can't for anything else.
8 ** Choices
9 I chose to create a powerful, yet not overly heavy Emacs configuration. Things like LSP mode are important to my workflow and help me be productive, so despite its weight, it is kept. Things like a fancy modeline or icons on the other hand, do not increase my productivity, and create visual clutter, and thus have been excluded.
10
11 Another important choice has been to integrate Emacs into a large part of my computing environment (see [[*EmacsOS]]). I use Email, IRC, et cetera, all through Emacs which simplifies my workflow.
12
13 Lastly, I use Evil mode. I think modal keybindings are simple and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
14 ** TODOs
15 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
16 *** TODO Put configs with passwords in here with some kind of authentication
17 - Offlineimap
18 - irc.el
19 ** License
20 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work at the snippet.
21 * Package management
22 ** Bootstrap straight.el
23 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
24 #+begin_src emacs-lisp
25   (defvar bootstrap-version)
26   (let ((bootstrap-file
27          (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
28         (bootstrap-version 5))
29     (unless (file-exists-p bootstrap-file)
30       (with-current-buffer
31           (url-retrieve-synchronously
32            "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
33            'silent 'inhibit-cookies)
34         (goto-char (point-max))
35         (eval-print-last-sexp)))
36     (load bootstrap-file nil 'nomessage))
37 #+end_src
38 ** Replace use-package with straight
39 #+begin_src emacs-lisp
40   (straight-use-package 'use-package)
41   (setq straight-use-package-by-default t)
42 #+end_src
43 * Visual options
44 ** Theme
45 Very nice high contrast theme.
46
47 Its fine to set this here because I run Emacs in daemon mode, but if I were not, then putting it in early-init.el would be a better choice to eliminate the window being white before the theme is loaded.
48 #+begin_src emacs-lisp
49   (setq modus-themes-slanted-constructs t
50         modus-themes-bold-constructs t
51         modus-themes-org-blocks 'grayscale
52         modus-themes-mode-line '3d
53         modus-themes-scale-headings t
54         modus-themes-region 'no-extend
55         modus-themes-diffs 'desaturated)
56   (load-theme 'modus-vivendi t)
57 #+end_src
58 ** Typography
59 *** Font
60 Great programming font with ligatures.
61 #+begin_src emacs-lisp
62   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
63 #+end_src
64 *** Ligatures
65 #+begin_src emacs-lisp
66   (use-package ligature
67     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
68     :config
69     (ligature-set-ligatures
70      '(prog-mode text-mode)
71      '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" "/=="
72        "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
73        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>" "<-|"
74        "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>" "</" "<*"
75        "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>" ":=" "::=" "=>>"
76        "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!==" "!!" "!=" ">]" ">:"
77        ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]"
78        "|}" "|=>" "|->" "|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<"
79        "..." "+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" "##"
80        "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_"
81        "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
82     (global-ligature-mode t))
83 #+end_src
84 *** Emoji
85 #+begin_src emacs-lisp
86   (use-package emojify
87     :config (global-emojify-mode))
88
89   ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
90   (set-fontset-font
91    t
92    '(#x1f300 . #x1fad0)
93    (cond
94     ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
95     ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
96     ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
97 #+end_src
98 ** Line numbers
99 Display relative line numbers except in some modes
100 #+begin_src emacs-lisp
101   (global-display-line-numbers-mode)
102   (setq display-line-numbers-type 'relative)
103   (dolist (no-line-num '(term-mode-hook
104                          pdf-view-mode-hook
105                          shell-mode-hook
106                          org-mode-hook
107                          eshell-mode-hook))
108     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
109 #+end_src
110 ** Highlight matching parenthesis
111 #+begin_src emacs-lisp
112   (use-package paren
113     :config (show-paren-mode)
114     :custom (show-paren-style 'parenthesis))
115 #+end_src
116 ** Modeline
117 *** Show current function
118 #+begin_src emacs-lisp
119   (which-function-mode)
120 #+end_src
121 *** Make position in file more descriptive
122 Show current column and file size.
123 #+begin_src emacs-lisp
124   (column-number-mode)
125   (size-indication-mode)
126 #+end_src
127 *** Hide minor modes
128 #+begin_src emacs-lisp
129   (use-package minions
130     :config (minions-mode))
131 #+end_src
132 ** Ruler
133 Show a ruler at a certain number of chars depending on mode.
134 #+begin_src emacs-lisp
135   (global-display-fill-column-indicator-mode)
136 #+end_src
137 ** Keybinding hints
138 Whenever starting a key chord, show possible future steps.
139 #+begin_src emacs-lisp
140   (use-package which-key
141     :config (which-key-mode)
142     :custom (which-key-idle-delay 0.3))
143 #+end_src
144 ** Visual highlights of changes
145 Highlight when changes are made.
146 #+begin_src emacs-lisp
147   (use-package evil-goggles
148     :config (evil-goggles-mode)
149     (evil-goggles-use-diff-faces))
150 #+end_src
151 ** Highlight TODOs in comments
152 #+begin_src emacs-lisp
153   (use-package hl-todo
154     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
155     :config (global-hl-todo-mode 1))
156 #+end_src
157 ** Don't lose cursor
158 #+begin_src emacs-lisp
159   (blink-cursor-mode)
160 #+end_src
161 ** Visual line mode
162 Soft wrap words and do operations by visual lines.
163 #+begin_src emacs-lisp
164   (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
165 #+end_src
166 ** Display number of matches in search
167 #+begin_src emacs-lisp
168   (use-package anzu
169     :config (global-anzu-mode))
170 #+end_src
171 ** Visual bell
172 Inverts modeline instead of audible bell or the standard visual bell.
173 #+begin_src emacs-lisp
174   (setq visible-bell nil
175         ring-bell-function 'flash-mode-line)
176   (defun flash-mode-line ()
177     (invert-face 'mode-line)
178     (run-with-timer 0.1 nil #'invert-face 'mode-line))
179 #+end_src
180 * Evil mode
181 ** General
182 #+begin_src emacs-lisp
183   (use-package evil
184     :custom (select-enable-clipboard nil)
185     :config
186     (evil-mode)
187     (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
188     ;; Use visual line motions even outside of visual-line-mode buffers
189     (evil-global-set-key 'motion "j" 'evil-next-visual-line)
190     (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
191     (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
192 #+end_src
193 ** Evil collection
194 #+begin_src emacs-lisp
195   (use-package evil-collection
196     :after evil
197     :init (evil-collection-init)
198     :custom (evil-collection-setup-minibuffer t))
199 #+end_src
200 ** Surround
201 tpope prevails!
202 #+begin_src emacs-lisp
203   (use-package evil-surround
204     :config (global-evil-surround-mode))
205 #+end_src
206 ** Leader key
207 #+begin_src emacs-lisp
208   (use-package evil-leader
209     :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
210     :config
211     (evil-leader/set-leader "<SPC>")
212     (global-evil-leader-mode))
213 #+end_src
214 ** Nerd commenter
215 #+begin_src emacs-lisp
216   ;; Nerd commenter
217   (use-package evil-nerd-commenter
218     :bind (:map evil-normal-state-map
219                 ("gc" . evilnc-comment-or-uncomment-lines))
220     :custom (evilnc-invert-comment-line-by-line nil))
221 #+end_src
222 ** Undo tree
223 Fix the oopsies!
224 #+begin_src emacs-lisp
225   (use-package undo-tree
226     :custom
227     (undo-tree-auto-save-history t)
228     (undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree")))
229     :config
230     (global-undo-tree-mode)
231     (evil-set-undo-system 'undo-tree))
232 #+end_src
233 ** Number incrementing
234 Add back C-a/C-x
235 #+begin_src emacs-lisp
236   (use-package evil-numbers
237     :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
238     :bind (:map evil-normal-state-map
239                 ("C-M-a" . evil-numbers/inc-at-pt)
240                 ("C-M-x" . evil-numbers/dec-at-pt)))
241 #+end_src
242 ** Evil org
243 *** Init
244 #+begin_src emacs-lisp
245   (use-package evil-org
246     :after org
247     :hook (org-mode . evil-org-mode)
248     :config
249     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
250   (use-package evil-org-agenda
251     :straight (:type built-in)
252     :after evil-org
253     :config
254     (evil-org-agenda-set-keys))
255 #+end_src
256 *** Leader maps
257 #+begin_src emacs-lisp
258   (evil-leader/set-key-for-mode 'org-mode
259     "T" 'org-show-todo-tree
260     "a" 'org-agenda
261     "c" 'org-archive-subtree)
262 #+end_src
263 * Org mode
264 ** General
265 #+begin_src emacs-lisp
266   (use-package org
267     :straight (:type built-in)
268     :commands (org-capture org-agenda)
269     :custom
270     (org-ellipsis " ▾")
271     (org-agenda-start-with-log-mode t)
272     (org-log-done 'time)
273     (org-log-into-drawer t)
274     (org-src-tab-acts-natively t)
275     (org-src-fontify-natively t)
276     (org-startup-indented t)
277     (org-hide-emphasis-markers t)
278     (org-fontify-whole-block-delimiter-line nil))
279 #+end_src
280 ** Tempo
281 #+begin_src emacs-lisp
282   (use-package org-tempo
283     :after org
284     :straight (:type built-in)
285     :config
286     ;; TODO: There's gotta be a more efficient way to write this
287     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
288     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
289     (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
290     (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
291     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
292     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
293     (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
294     (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc")))
295 #+end_src
296 * Autocompletion
297 ** Ivy
298 Simple, but not too simple autocompletion.
299 #+begin_src emacs-lisp
300   (use-package ivy
301     :bind (("C-s" . swiper)
302            :map ivy-minibuffer-map
303            ("TAB" . ivy-alt-done)
304            :map ivy-switch-buffer-map
305            ("M-d" . ivy-switch-buffer-kill))
306     :config (ivy-mode))
307 #+end_src
308 ** Ivy-rich
309 #+begin_src emacs-lisp
310   (use-package ivy-rich
311     :after (ivy counsel)
312     :config (ivy-rich-mode))
313 #+end_src
314 ** Counsel
315 Ivy everywhere.
316 #+begin_src emacs-lisp
317   (use-package counsel
318     :bind (("C-M-j" . 'counsel-switch-buffer)
319            :map minibuffer-local-map
320            ("C-r" . 'counsel-minibuffer-history))
321     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
322     :config (counsel-mode))
323 #+end_src
324 ** Remember frequent commands
325 #+begin_src emacs-lisp
326   (use-package ivy-prescient
327     :after counsel
328     :custom
329     (ivy-prescient-enable-filtering nil)
330     :config
331     (prescient-persist-mode)
332     (ivy-prescient-mode))
333 #+end_src
334 ** Swiper
335 Better search utility.
336 #+begin_src emacs-lisp
337   (use-package swiper)
338 #+end_src
339 * EmacsOS
340 ** RSS
341 Use elfeed for RSS. I have another file with all the feeds in it.
342 #+begin_src emacs-lisp
343   (use-package elfeed
344     :bind (("C-c e" . elfeed))
345     :config
346     (load "~/.emacs.d/feeds.el")
347     (add-hook 'elfeed-new-entry-hook
348               (elfeed-make-tagger :feed-url "youtube\\.com"
349                                   :add '(youtube)))
350     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
351
352   (use-package elfeed-goodies
353     :after elfeed
354     :config (elfeed-goodies/setup))
355 #+end_src
356 ** Email
357 Use mu4e for reading emails.
358
359 I use `offlineimap` to sync my maildirs. It is slower than mbsync, but is fast enough for me, especially when ran with the =-q= option.
360
361 Contexts are a not very well known feature of mu4e that makes it super easy to manage multiple accounts. Much better than some of the hacky methods and external packages that I've seen.
362 #+begin_src emacs-lisp
363   (use-package smtpmail
364     :straight (:type built-in))
365   (use-package mu4e
366     :load-path "/usr/share/emacs/site-lisp/mu4e"
367     :bind (("C-c m" . mu4e))
368     :config
369     (setq user-full-name "Armaan Bhojwani"
370           smtpmail-local-domain "armaanb.net"
371           smtpmail-stream-type 'ssl
372           smtpmail-smtp-service '465
373           mu4e-change-filenames-when-moving t
374           message-kill-buffer-on-exit t
375           mu4e-get-mail-command "offlineimap -q"
376           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
377           message-citation-line-function 'message-insert-formatted-citation-line
378           mu4e-context-policy "pick-first"
379           mu4e-contexts
380           `( ,(make-mu4e-context
381                :name "school"
382                :enter-func (lambda () (mu4e-message "Entering school context"))
383                :leave-func (lambda () (mu4e-message "Leaving school context"))
384                :match-func (lambda (msg)
385                              (when msg
386                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
387                :vars '( (user-mail-address . "abhojwani22@nobles.edu")
388                         (mu4e-sent-folder . "/school/Sent")
389                         (mu4e-drafts-folder . "/school/Drafts")
390                         (mu4e-trash-folder . "/school/Trash")
391                         (mu4e-refile-folder . "/school/Archive")
392                         (user-mail-address . "abhojwani22@nobles.edu")
393                         (smtpmail-smtp-user . "abhojwani22@nobles.edu")
394                         (smtpmail-smtp-server . "smtp.gmail.com")))
395              ,(make-mu4e-context
396                :name "personal"
397                :enter-func (lambda () (mu4e-message "Entering personal context"))
398                :leave-func (lambda () (mu4e-message "Leaving personal context"))
399                :match-func (lambda (msg)
400                              (when msg
401                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
402                :vars '(
403                        (mu4e-sent-folder . "/personal/Sent")
404                        (mu4e-drafts-folder . "/personal/Drafts")
405                        (mu4e-trash-folder . "/personal/Trash")
406                        (mu4e-refile-folder . "/personal/Archive")
407                        (user-mail-address . "me@armaanb.net")
408                        (smtpmail-smtp-user . "me@armaanb.net")
409                        (smtpmail-smtp-server "smtp.mailbox.org")
410                        (mu4e-drafts-folder . "/school/Drafts")
411                        (mu4e-trash-folder . "/school/Trash")))))
412     (add-to-list 'mu4e-bookmarks
413                  '(:name "Unified inbox"
414                          :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
415                          :key ?b)))
416 #+end_src
417 ** Calendar
418 #+begin_src emacs-lisp
419   (use-package calfw)
420   (use-package calfw-org)
421   (use-package calfw-ical)
422
423   (defun acheam-calendar ()
424     "Open a calendar."
425     (interactive)
426     (shell-command "vdirsyncer sync")
427     (let ((default-directory "~/.local/share/vdirsyncer/"))
428       (cfw:open-calendar-buffer
429        :contents-sources
430        (list
431         (cfw:ical-create-source "School" (expand-file-name "school/abhojwani22@nobles.edu.ics") "Green")
432         (cfw:ical-create-source "Personal" (expand-file-name "mailbox/Y2FsOi8vMC8zMQ.ics") "Blue")
433         (cfw:ical-create-source "Birthdays" (expand-file-name "mailbox/Y2FsOi8vMS8w.ics") "Gray")
434         ))))
435 #+end_src
436 ** IRC
437 Another file has more specific network configuration.
438 #+begin_src emacs-lisp
439   (use-package circe
440     :config (load-file "~/.emacs.d/irc.el"))
441
442   (use-package circe-chanop
443     :straight (:type built-in)
444     :after circe)
445
446   (use-package circe-color-nicks
447     :straight (:type built-in)
448     :after circe)
449 #+end_src
450 ** Default browser
451 Set EWW as default browser except for videos.
452 #+begin_src emacs-lisp
453   (defun browse-url-mpv (url &optional new-window)
454     "Open URL in MPV."
455     (start-process "mpv" "*mpv*" "mpv" url))
456
457   (setq browse-url-handlers
458         (quote
459          (("youtu\\.?be" . browse-url-mpv)
460           ("." . eww-browse-url)
461           )))
462 #+end_src
463 ** Emacs Anywhere
464 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
465 "emacsclient --eval "(emacs-everywhere)".
466 #+begin_src emacs-lisp
467   (use-package emacs-everywhere)
468 #+end_src
469 * Emacs IDE
470 ** LSP
471 *** General
472 #+begin_src emacs-lisp
473   (use-package lsp-mode
474     :commands (lsp lsp-deferred)
475     :custom (lsp-keymap-prefix "C-c l")
476     :hook ((lsp-mode . lsp-enable-which-key-integration)))
477
478   (use-package lsp-ivy)
479
480   (use-package lsp-ui
481     :commands lsp-ui-mode
482     :custom (lsp-ui-doc-position 'bottom))
483   (use-package lsp-ui-flycheck
484     :after lsp-ui
485     :straight (:type built-in))
486 #+end_src
487 *** Company
488 Company-box adds icons.
489 #+begin_src emacs-lisp
490   (use-package company
491     :after lsp-mode
492     :hook (lsp-mode . company-mode)
493     :bind (:map company-active-map
494                 ("<tab>" . company-complete-selection))
495     (:map lsp-mode-map
496           ("<tab>" . company-indent-or-complete-common))
497     :custom
498     (company-minimum-prefix-length 1)
499     (setq company-dabbrev-downcase 0)
500     (company-idle-delay 0.0))
501
502   (use-package company-box
503     :hook (company-mode . company-box-mode))
504 #+end_src
505 *** Language servers
506 **** Python
507 #+begin_src emacs-lisp
508   (use-package lsp-pyright
509     :hook (python-mode . (lambda ()
510                            (use-package lsp-pyright
511                              :straight (:type built-in))
512                            (lsp-deferred))))
513 #+end_src
514 ** Code cleanup
515 #+begin_src emacs-lisp
516   (use-package blacken
517     :hook (python-mode . blacken-mode)
518     :config
519     (setq blacken-line-length 79))
520
521   ;; Purge whitespace
522   (use-package ws-butler
523     :config
524     (ws-butler-global-mode))
525 #+end_src
526 ** Flycheck
527 #+begin_src emacs-lisp
528   (use-package flycheck
529     :config
530     (global-flycheck-mode))
531 #+end_src
532 ** Project management
533 #+begin_src emacs-lisp
534   (use-package projectile
535     :config (projectile-mode)
536     :custom ((projectile-completion-system 'ivy))
537     :bind-keymap
538     ("C-c p" . projectile-command-map)
539     :init
540     (when (file-directory-p "~/Code")
541       (setq projectile-project-search-path '("~/Code")))
542     (setq projectile-switch-project-action #'projectile-dired))
543
544   (use-package counsel-projectile
545     :after projectile
546     :config (counsel-projectile-mode))
547 #+end_src
548 ** Dired
549 #+begin_src emacs-lisp
550   (use-package dired
551     :straight (:type built-in)
552     :commands (dired dired-jump)
553     :custom ((dired-listing-switches "-agho --group-directories-first"))
554     :config
555     (evil-collection-define-key 'normal 'dired-mode-map
556       "h" 'dired-single-up-directory
557       "l" 'dired-single-buffer))
558
559   (use-package dired-single
560     :commands (dired dired-jump))
561
562   (use-package dired-open
563     :commands (dired dired-jump)
564     :custom
565     (dired-open-extensions '(("png" . "feh")
566                              ("mkv" . "mpv"))))
567
568   (use-package dired-hide-dotfiles
569     :hook (dired-mode . dired-hide-dotfiles-mode)
570     :config
571     (evil-collection-define-key 'normal 'dired-mode-map
572       "H" 'dired-hide-dotfiles-mode))
573 #+end_src
574 ** Git
575 *** Magit
576 # TODO: Write a command that commits hunk, skipping staging step.
577 #+begin_src emacs-lisp
578   (use-package magit
579     :hook (magit-mode-hook. pinentry-start))
580 #+end_src
581 *** Colored diff in line number area
582 #+begin_src emacs-lisp
583   (use-package diff-hl
584     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
585     :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
586            (magit-post-refresh-hook . diff-hl-magit-post-refresh))
587     :config (global-diff-hl-mode))
588 #+end_src
589 * General text editing
590 ** Indentation
591 Indent after every change.
592 #+begin_src emacs-lisp
593   (use-package aggressive-indent
594     :config (global-aggressive-indent-mode))
595 #+end_src
596 ** Spell checking
597 Spell check in text mode, and in prog-mode comments.
598 #+begin_src emacs-lisp
599   (dolist (hook '(text-mode-hook))
600     (add-hook hook (lambda () (flyspell-mode))))
601   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
602     (add-hook hook (lambda () (flyspell-mode -1))))
603   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
604 #+end_src
605 ** Expand tabs to spaces
606 #+begin_src emacs-lisp
607   (setq-default tab-width 2)
608 #+end_src
609 ** Copy kill ring to clipboard
610 #+begin_src emacs-lisp
611   (setq x-select-enable-clipboard t)
612   (defun copy-kill-ring-to-xorg ()
613     "Copy the current kill ring to the xorg clipboard."
614     (interactive)
615     (x-select-text (current-kill 0)))
616 #+end_src
617 ** Browse kill ring
618 #+begin_src emacs-lisp
619   (use-package browse-kill-ring)
620 #+end_src
621 ** Save place
622 Opens file where you left it.
623 #+begin_src emacs-lisp
624   (save-place-mode)
625 #+end_src
626 ** Writing mode
627 Distraction free writing a la junegunn/goyo.
628 #+begin_src emacs-lisp
629   (use-package olivetti
630     :config
631     (evil-leader/set-key "o" 'olivetti-mode))
632 #+end_src
633 ** Abbreviations
634 Abbreviate things!
635 #+begin_src emacs-lisp
636   (setq abbrev-file-name "~/.emacs.d/abbrevs")
637   (setq save-abbrevs 'silent)
638   (setq-default abbrev-mode t)
639 #+end_src
640 * Functions
641 ** Easily convert splits
642 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
643 #+begin_src emacs-lisp
644   (defun toggle-window-split ()
645     (interactive)
646     (if (= (count-windows) 2)
647         (let* ((this-win-buffer (window-buffer))
648                (next-win-buffer (window-buffer (next-window)))
649                (this-win-edges (window-edges (selected-window)))
650                (next-win-edges (window-edges (next-window)))
651                (this-win-2nd (not (and (<= (car this-win-edges)
652                                            (car next-win-edges))
653                                        (<= (cadr this-win-edges)
654                                            (cadr next-win-edges)))))
655                (splitter
656                 (if (= (car this-win-edges)
657                        (car (window-edges (next-window))))
658                     'split-window-horizontally
659                   'split-window-vertically)))
660           (delete-other-windows)
661           (let ((first-win (selected-window)))
662             (funcall splitter)
663             (if this-win-2nd (other-window 1))
664             (set-window-buffer (selected-window) this-win-buffer)
665             (set-window-buffer (next-window) next-win-buffer)
666             (select-window first-win)
667             (if this-win-2nd (other-window 1))))))
668
669   (define-key ctl-x-4-map "t" 'toggle-window-split)
670 #+end_src
671 ** Insert date
672 #+begin_src emacs-lisp
673   (defun insert-date ()
674     (interactive)
675     (insert (format-time-string "%Y-%m-%d")))
676 #+end_src
677 * Keybindings
678 ** Switch windows
679 #+begin_src emacs-lisp
680   (use-package ace-window
681     :bind ("M-o" . ace-window))
682 #+end_src
683 ** Kill current buffer
684 Makes "C-x k" binding faster.
685 #+begin_src emacs-lisp
686   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
687 #+end_src
688 * Other settings
689 ** OpenSCAD
690 Render OpenSCAD files, and add a preview window.
691
692 Personal fork just merges a PR.
693 #+begin_src emacs-lisp
694   (use-package scad-mode)
695   (use-package scad-preview
696     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
697 #+end_src
698 ** Control backup files
699 Stop backup files from spewing everywhere.
700 #+begin_src emacs-lisp
701   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
702 #+end_src
703 ** Make yes/no easier
704 #+begin_src emacs-lisp
705   (defalias 'yes-or-no-p 'y-or-n-p)
706 #+end_src
707 ** Move customize file
708 No more clogging up init.el.
709 #+begin_src emacs-lisp
710   (setq custom-file "~/.emacs.d/custom.el")
711   (load custom-file)
712 #+end_src
713 ** Better help
714 #+begin_src emacs-lisp
715   (use-package helpful
716     :commands (helpful-callable helpful-variable helpful-command helpful-key)
717     :custom
718     (counsel-describe-function-function #'helpful-callable)
719     (counsel-describe-variable-function #'helpful-variable)
720     :bind
721     ([remap describe-function] . counsel-describe-function)
722     ([remap describe-command] . helpful-command)
723     ([remap describe-variable] . counsel-describe-variable)
724     ([remap describe-key] . helpful-key))
725 #+end_src
726 ** GPG
727 #+begin_src emacs-lisp
728   (use-package epa-file
729     :straight (:type built-in))
730   (setq epa-file-select-keys nil
731         epa-file-encrypt-to '("me@armaanb.net")
732         password-cache-expiry (* 60 15))
733
734   (use-package pinentry)
735 #+end_src
736 ** Pastebin
737 #+begin_src emacs-lisp
738   (use-package 0x0
739     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
740     :custom (0x0-default-service 'envs)
741     :config (evil-leader/set-key
742               "00" '0x0-upload
743               "0f" '0x0-upload-file
744               "0s" '0x0-upload-string
745               "0c" '0x0-upload-kill-ring
746               "0p" '0x0-upload-popup))
747 #+end_src
748 * Tangles
749 ** Spectrwm
750 *** General settings
751 #+begin_src conf :tangle ~/.spectrwm.conf
752   workspace_limit = 5
753   warp_pointer = 1
754   modkey = Mod4
755   border_width = 4
756   tile_gap = 10
757   autorun = ws[1]:/home/armaa/Code/scripts/autostart
758 #+end_src
759 *** Apprearance
760 Gruvbox colors
761 #+begin_src conf :tangle ~/.spectrwm.conf
762   color_focus = rgb:83/a5/98
763   color_focus_maximized = rgb:d6/5d/0e
764   color_unfocus = rgb:58/58/58
765 #+end_src
766 *** Bar
767 #+begin_src conf :tangle ~/.spectrwm.conf
768   bar_enabled = 0
769   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
770 #+end_src
771 *** Keybindings
772 **** WM actions
773 #+begin_src conf :tangle ~/.spectrwm.conf
774   program[lock] = i3lock -c 000000 -ef
775   program[term] = alacritty
776   program[screenshot_all] = flameshot gui
777   program[menu] = rofi -show run # `rofi-dmenu` handles the rest
778   program[switcher] = rofi -show window
779   program[notif] = /home/armaa/Code/scripts/setter status
780
781   bind[notif] = MOD+n
782   bind[switcher] = MOD+Tab
783 #+end_src
784 **** Media keys
785 #+begin_src conf :tangle ~/.spectrwm.conf
786   program[paup] = /home/armaa/Code/scripts/setter audio +5
787   program[padown] = /home/armaa/Code/scripts/setter audio -5
788   program[pamute] = /home/armaa/Code/scripts/setter audio
789   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
790   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
791   program[next] = playerctl next
792   program[prev] = playerctl previous
793   program[pause] = playerctl play-pause
794
795   bind[padown] = XF86AudioLowerVolume
796   bind[paup] = XF86AudioRaiseVolume
797   bind[pamute] = XF86AudioMute
798   bind[brigdown] = XF86MonBrightnessDown
799   bind[brigup] = XF86MonBrightnessUp
800   bind[pause] = XF86AudioPlay
801   bind[next] = XF86AudioNext
802   bind[prev] = XF86AudioPrev
803 #+end_src
804 **** HJKL
805 #+begin_src conf :tangle ~/.spectrwm.conf
806   program[h] = xdotool keyup h key --clearmodifiers Left
807   program[j] = xdotool keyup j key --clearmodifiers Down
808   program[k] = xdotool keyup k key --clearmodifiers Up
809   program[l] = xdotool keyup l key --clearmodifiers Right
810
811   bind[h] = MOD + Control + h
812   bind[j] = MOD + Control + j
813   bind[k] = MOD + Control + k
814   bind[l] = MOD + Control + l
815 #+end_src
816 **** Programs
817 #+begin_src conf :tangle ~/.spectrwm.conf
818   program[aerc] = alacritty -e aerc
819   program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
820   program[emacs] = emacsclient -c
821   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
822   program[firefox] = firefox
823   program[thunderbird] = thunderbird
824   program[slack] = slack
825
826   bind[aerc] = MOD+Control+s
827   bind[weechat] = MOD+Control+d
828   bind[emacs] = MOD+Control+f
829   bind[emacs-anywhere] = MOD+f
830   bind[firefox] = MOD+Control+u
831   bind[thunderbird] = MOD+Control+i
832   bind[slack] = MOD+Control+o
833 #+end_src
834 ** Zsh
835 *** Settings
836 **** Completions
837 #+begin_src shell :tangle ~/.config/zsh/zshrc
838   autoload -Uz compinit
839   compinit
840
841   setopt no_case_glob
842   unsetopt glob_complete
843 #+end_src
844 **** Vim bindings
845 #+begin_src shell :tangle ~/.config/zsh/zshrc
846   bindkey -v
847   KEYTIMEOUT=1
848
849   bindkey -M vicmd "^[[3~" delete-char
850   bindkey "^[[3~" delete-char
851
852   autoload edit-command-line
853   zle -N edit-command-line
854   bindkey -M vicmd ^e edit-command-line
855   bindkey ^e edit-command-line
856 #+end_src
857 **** History
858 #+begin_src shell :tangle ~/.config/zsh/zshrc
859   setopt extended_history
860   setopt share_history
861   setopt inc_append_history
862   setopt hist_ignore_dups
863   setopt hist_reduce_blanks
864
865   HISTSIZE=10000
866   SAVEHIST=10000
867   HISTFILE=~/.local/share/zsh/history
868 #+end_src
869 *** Plugins
870 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
871 **** ZPE
872 #+begin_src plain :tangle ~/.config/zpe/repositories
873     https://github.com/Aloxaf/fzf-tab
874     https://github.com/zdharma/fast-syntax-highlighting
875     https://github.com/rupa/z
876 #+end_src
877 **** Zshrc
878 #+begin_src shell :tangle ~/.config/zsh/zshrc
879   source ~/Code/zpe/zpe.sh
880   source ~/Code/admone/admone.zsh
881   source ~/.config/zsh/fzf-bindings.zsh
882
883   zpe-source fzf-tab/fzf-tab.zsh
884   zstyle ':completion:*:descriptions' format '[%d]'
885   zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
886   zstyle ':completion:*' completer _complete
887   zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
888          'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
889   enable-fzf-tab
890   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
891   export _Z_DATA="/home/armaa/.local/share/z"
892   zpe-source z/z.sh
893 #+end_src
894 *** Functions
895 **** Alert after long command
896 #+begin_src shell :tangle ~/.config/zsh/zshrc
897   alert() {
898       notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
899                   ${history[$HISTCMD]%[;&|][[:space:]]##alert}
900   }
901 #+end_src
902 **** Time Zsh startup
903 #+begin_src shell :tangle ~/.config/zsh/zshrc
904   timezsh() {
905       for i in $(seq 1 10); do
906           time "zsh" -i -c exit;
907       done
908   }
909 #+end_src
910 **** Update all packages
911 #+begin_src shell :tangle ~/.config/zsh/zshrc
912   color=$(tput setaf 5)
913   reset=$(tput sgr0)
914
915   apu() {
916       sudo echo "${color}== upgrading with yay ==${reset}"
917       yay
918       echo ""
919       echo "${color}== checking for pacnew files ==${reset}"
920       sudo pacdiff
921       echo
922       echo "${color}== upgrading flatpaks ==${reset}"
923       flatpak update
924       echo ""
925       echo "${color}== upgrading zsh plugins ==${reset}"
926       zpe-pull
927       echo ""
928       echo "${color}== updating nvim plugins ==${reset}"
929       nvim +PlugUpdate +PlugUpgrade +qall
930       echo "Updated nvim plugins"
931       echo ""
932       echo "${color}You are entirely up to date!${reset}"
933   }
934 #+end_src
935 **** Clean all packages
936 #+begin_src shell :tangle ~/.config/zsh/zshrc
937   apap() {
938       sudo echo "${color}== cleaning pacman orphans ==${reset}"
939       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
940       echo ""
941       echo "${color}== cleaning flatpaks ==${reset}"
942       flatpak remove --unused
943       echo ""
944       echo "${color}== cleaning zsh plugins ==${reset}"
945       zpe-clean
946       echo ""
947       echo "${color}== cleaning nvim plugins ==${reset}"
948       nvim +PlugClean +qall
949       echo "Cleaned nvim plugins"
950       echo ""
951       echo "${color}All orphans cleaned!${reset}"
952   }
953 #+end_src
954 **** ls every cd
955 #+begin_src shell :tangle ~/.config/zsh/zshrc
956   chpwd() {
957       emulate -L zsh
958       exa -lh --icons --git --group-directories-first
959   }
960 #+end_src
961 **** Setup anaconda
962 #+begin_src shell :tangle ~/.config/zsh/zshrc
963   zconda() {
964       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
965       if [ $? -eq 0 ]; then
966           eval "$__conda_setup"
967       else
968           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
969               . "/opt/anaconda/etc/profile.d/conda.sh"
970           else
971               export PATH="/opt/anaconda/bin:$PATH"
972           fi
973       fi
974       unset __conda_setup
975   }
976 #+end_src
977 **** Interact with 0x0
978 #+begin_src shell :tangle ~/.config/zsh/zshrc
979   zxz="https://envs.sh"
980   0file() { curl -F"file=@$1" "$zxz" ; }
981   0pb() { curl -F"file=@-;" "$zxz" ; }
982   0url() { curl -F"url=$1" "$zxz" ; }
983   0short() { curl -F"shorten=$1" "$zxz" ; }
984   0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
985 #+end_src
986 **** Swap two files
987 #+begin_src shell :tangle ~/.config/zsh/zshrc
988   sw() {
989       mv $1 $1.tmp
990       mv $2 $1
991       mv $1.tmp $2
992   }
993 #+end_src
994 *** Aliases
995 **** SSH
996 #+begin_src shell :tangle ~/.config/zsh/zshrc
997   alias bhoji-drop='ssh -p 23 root@armaanb.net'
998   alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
999   alias tcf='ssh root@204.48.23.68'
1000   alias ngmun='ssh root@157.245.89.25'
1001   alias prox='ssh root@192.168.1.224'
1002   alias dock='ssh root@192.168.1.225'
1003   alias jenkins='ssh root@192.168.1.226'
1004   alias envs='ssh acheam@envs.net'
1005 #+end_src
1006 **** File management
1007 #+begin_src shell :tangle ~/.config/zsh/zshrc
1008   alias ls='exa -lh --icons --git --group-directories-first'
1009   alias la='exa -lha --icons --git --group-directories-first'
1010   alias df='df -h / /boot'
1011   alias du='du -h'
1012   alias free='free -h'
1013   alias cp='cp -riv'
1014   alias rm='rm -Iv'
1015   alias mv='mv -iv'
1016   alias ln='ln -iv'
1017   alias grep='grep -in --exclude-dir=.git --color=auto'
1018   alias mkdir='mkdir -pv'
1019   alias unar='atool -x'
1020   alias wget='wget -e robots=off'
1021   alias lanex='~/.local/share/lxc/lxc'
1022 #+end_src
1023 **** Dotfiles
1024 #+begin_src shell :tangle ~/.config/zsh/zshrc
1025   alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1026   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1027     yadm push'
1028   alias padu='padm add -u && padm commit && padm push && yadu'
1029 #+end_src
1030 **** Editing
1031 #+begin_src shell :tangle ~/.config/zsh/zshrc
1032   alias v='nvim'
1033   alias vim='nvim'
1034   alias vw="nvim ~/Documents/vimwiki/index.md"
1035 #+end_src
1036 **** System management
1037 #+begin_src shell :tangle ~/.config/zsh/zshrc
1038   alias jctl='journalctl -p 3 -xb'
1039   alias pkill='pkill -i'
1040   alias cx='chmod +x'
1041   alias please='sudo $(fc -ln -1)'
1042   alias sudo='sudo ' # allows aliases to be run with sudo
1043 #+end_src
1044 **** Networking
1045 #+begin_src shell :tangle ~/.config/zsh/zshrc
1046   alias ping='ping -c 10'
1047   alias speed='speedtest-cli'
1048   alias ip='ip --color=auto'
1049   alias cip='curl https://armaanb.net/ip'
1050   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1051   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1052 #+end_src
1053 **** Docker
1054 #+begin_src shell :tangle ~/.config/zsh/zshrc
1055   alias dc='docker-compose'
1056   alias dcdu='docker-compose down && docker-compose up -d'
1057 #+end_src
1058 **** Other
1059 #+begin_src shell :tangle ~/.config/zsh/zshrc
1060   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1061     iflag=fullblock status=progress'
1062   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1063     iflag=fullblock status=progress'
1064   alias ts='gen-shell -c task'
1065   alias ts='gen-shell -c task'
1066   alias tetris='autoload -Uz tetriscurses && tetriscurses'
1067   alias news='newsboat'
1068   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1069   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1070     --restrict-filenames -o '%(title)s.%(ext)s'"
1071   alias cal="cal -3 --color=auto"
1072 #+end_src
1073 **** Virtual machines, chroots
1074 #+begin_src shell :tangle ~/.config/zsh/zshrc
1075   alias ckiss="sudo chrooter ~/Virtual/kiss"
1076   alias cdebian="sudo chrooter ~/Virtual/debian bash"
1077   alias cwindows='devour qemu-system-x86_64 \
1078     -smp 3 \
1079     -cpu host \
1080     -enable-kvm \
1081     -m 3G \
1082     -device VGA,vgamem_mb=64 \
1083     -device intel-hda \
1084     -device hda-duplex \
1085     -net nic \
1086     -net user,smb=/home/armaa/Public \
1087     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1088 #+end_src
1089 **** Python
1090 #+begin_src shell :tangle ~/.config/zsh/zshrc
1091   alias ipy="ipython"
1092   alias zpy="zconda && ipython"
1093   alias math="ipython --profile=math"
1094   alias pypi="python setup.py sdist && twine upload dist/*"
1095   alias pip="python -m pip"
1096   alias black="black -l 79"
1097 #+end_src
1098 **** Latin
1099 #+begin_src shell :tangle ~/.config/zsh/zshrc
1100   alias words='gen-shell -c "words"'
1101   alias words-e='gen-shell -c "words ~E"'
1102 #+end_src
1103 **** Devour
1104 #+begin_src shell :tangle ~/.config/zsh/zshrc
1105   alias zathura='devour zathura'
1106   alias mpv='devour mpv'
1107   alias sql='devour sqlitebrowser'
1108   alias cad='devour openscad'
1109   alias feh='devour feh'
1110 #+end_src
1111 **** Package management (Pacman)
1112 #+begin_src shell :tangle ~/.config/zsh/zshrc
1113   alias aps='yay -Ss'
1114   alias api='yay -Syu'
1115   alias app='yay -Rns'
1116   alias apc='yay -Sc'
1117   alias apo='yay -Qttd'
1118   alias azf='pacman -Q | fzf'
1119   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1120   alias ufetch='ufetch-arch'
1121   alias reflect='reflector --verbose --sort rate --save \
1122     ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1123 #+end_src
1124 *** Exports
1125 #+begin_src shell :tangle ~/.config/zsh/zshrc
1126   export EDITOR="emacsclient -c"                  # $EDITOR opens in terminal
1127   export VISUAL="emacsclient -c -a emacs"         # $VISUAL opens in GUI mode
1128   export TERM=xterm-256color # for compatability
1129
1130   export GPG_TTY="$(tty)"
1131   export MANPAGER='nvim +Man!'
1132   export PAGER='less'
1133
1134   # generated with "vivid generate gruvbox"
1135   export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1136
1137   export GTK_USE_PORTAL=1
1138
1139   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1140   export PATH="$PATH:/home/armaa/Code/scripts"
1141   export PATH="$PATH:/home/armaa/.cargo/bin"
1142   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1143   export PATH="$PATH:/usr/sbin"
1144   export PATH="$PATH:/opt/FreeTube/freetube"
1145
1146   export LC_ALL="en_US.UTF-8"
1147   export LC_CTYPE="en_US.UTF-8"
1148   export LANGUAGE="en_US.UTF-8"
1149
1150   export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1151   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1152   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1153   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1154   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1155   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1156 #+end_src
1157 ** Alacritty
1158 *** Appearance
1159 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1160 font:
1161   normal:
1162     family: JetBrains Mono Nerd Font
1163     style: Medium
1164   italic:
1165     style: Italic
1166   Bold:
1167     style: Bold
1168   size: 7
1169   ligatures: true # Requires ligature patch
1170
1171 window:
1172   padding:
1173     x: 5
1174     y: 5
1175
1176 background_opacity: 0.6
1177 #+end_src
1178 *** Keybindings
1179 Send <RET> + modifier through
1180 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1181 key_bindings:
1182   - {
1183     key: Return,
1184     mods: Shift,
1185     chars: "\x1b[13;2u"
1186   }
1187   - {
1188     key: Return,
1189     mods: Control,
1190     chars: "\x1b[13;5u"
1191   }
1192 #+end_src
1193 *** Color scheme
1194 Gruvbox
1195 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1196 colors:
1197   # Default colors
1198   primary:
1199     background: '#000000'
1200     foreground: '#ebdbb2'
1201
1202   # Normal colors
1203   normal:
1204     black:   '#282828'
1205     red:     '#cc241d'
1206     green:   '#98971a'
1207     yellow:  '#d79921'
1208     blue:    '#458588'
1209     magenta: '#b16286'
1210     cyan:    '#689d6a'
1211     white:   '#a89984'
1212
1213   # Bright colors
1214   bright:
1215     black:   '#928374'
1216     red:     '#fb4934'
1217     green:   '#b8bb26'
1218     yellow:  '#fabd2f'
1219     blue:    '#83a598'
1220     magenta: '#d3869b'
1221     cyan:    '#8ec07c'
1222     white:   '#ebdbb2'
1223 #+end_src
1224 ** IPython
1225 *** General
1226 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1227 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1228   c.TerminalInteractiveShell.editing_mode = 'vi'
1229   c.InteractiveShell.colors = 'linux'
1230   c.TerminalInteractiveShell.confirm_exit = False
1231 #+end_src
1232 *** Math
1233 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1234   from math import *
1235
1236   def deg(x):
1237       return x * (180 /  pi)
1238
1239   def rad(x):
1240       return x * (pi / 180)
1241
1242   def rad(x, unit):
1243       return (x * (pi / 180)) / unit
1244
1245   def csc(x):
1246       return 1 / sin(x)
1247
1248   def sec(x):
1249       return 1 / cos(x)
1250
1251   def cot(x):
1252       return 1 / tan(x)
1253 #+end_src
1254 ** MPV
1255 Make MPV play a little bit smoother.
1256 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1257   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1258   hwdec=auto-copy
1259 #+end_src
1260 ** Picom
1261 *** Shadows
1262 #+begin_src conf :tangle ~/.config/picom/picom.conf
1263   shadow = true;
1264   shadow-radius = 10;
1265   shadow-offset-x = -5;
1266   shadow-offset-y = -5;
1267 #+end_src
1268 *** Fading
1269 #+begin_src conf :tangle ~/.config/picom/picom.conf
1270   fading = true
1271   fade-delta = 5
1272 #+end_src
1273 *** Blur
1274 #+begin_src conf :tangle ~/.config/picom/picom.conf
1275   blur:
1276   {
1277   method = "gaussian";
1278   size = 5;
1279   deviation = 5;
1280   };
1281 #+end_src
1282 *** Backend
1283 Needs picom to be run with "--experimental-backends"
1284 #+begin_src conf :tangle ~/.config/picom/picom.conf
1285   backend = "glx";
1286 #+end_src
1287 ** Inputrc
1288 For any GNU Readline programs
1289 #+begin_src plain :tangle ~/.inputrc
1290   set editing-mode vi
1291 #+end_src
1292 ** Vivid
1293 https://github.com/sharkdp/vivid
1294 *** Colors
1295 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1296   colors:
1297     background_color: '282A36'
1298     black: '21222C'
1299     orange: 'd65d0e'
1300     purple: 'b16286'
1301     red: 'cc241d'
1302     blue: '458588'
1303     pink: 'd3869b'
1304     lime: '689d6a'
1305
1306     gray: '928374'
1307 #+end_src
1308 *** Core
1309 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1310   core:
1311     regular_file: {}
1312
1313     directory:
1314       foreground: blue
1315
1316     executable_file:
1317       foreground: red
1318       font-style: bold
1319
1320     symlink:
1321       foreground: pink
1322
1323     broken_symlink:
1324       foreground: black
1325       background: red
1326     missing_symlink_target:
1327       foreground: black
1328       background: red
1329
1330     fifo:
1331       foreground: black
1332       background: blue
1333
1334     socket:
1335       foreground: black
1336       background: pink
1337
1338     character_device:
1339       foreground: black
1340       background: lime
1341
1342     block_device:
1343       foreground: black
1344       background: red
1345
1346     normal_text:
1347       {}
1348
1349     sticky:
1350       {}
1351
1352     sticky_other_writable:
1353       {}
1354
1355     other_writable:
1356       {}
1357
1358   text:
1359     special:
1360       foreground: black
1361       background: orange
1362
1363     todo:
1364       font-style: bold
1365
1366     licenses:
1367       foreground: gray
1368
1369     configuration:
1370       foreground: orange
1371
1372     other:
1373       foreground: orange
1374
1375   markup:
1376     foreground: orange
1377
1378   programming:
1379     source:
1380       foreground: purple
1381
1382     tooling:
1383       foreground: purple
1384
1385       continuous-integration:
1386         foreground: purple
1387
1388   media:
1389     foreground: pink
1390
1391   office:
1392     foreground: red
1393
1394   archives:
1395     foreground: lime
1396     font-style: underline
1397
1398   executable:
1399     foreground: red
1400     font-style: bold
1401
1402   unimportant:
1403     foreground: gray
1404 #+end_src
1405 ** Git
1406 *** User
1407 #+begin_src plain :tangle ~/.gitconfig
1408 [user]
1409   name = Armaan Bhojwani
1410   email = me@armaanb.net
1411   signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1412 #+end_src
1413 *** Init
1414 #+begin_src plain :tangle ~/.gitconfig
1415 [init]
1416   defaultBranch = main
1417 #+end_src
1418 *** GPG
1419 #+begin_src plain :tangle ~/.gitconfig
1420 [gpg]
1421   program = gpg
1422 #+end_src
1423 *** Sendemail
1424 #+begin_src plain :tangle ~/.gitconfig
1425 [sendemail]
1426   smtpserver = smtp.mailbox.org
1427   smtpuser = me@armaanb.net
1428   smtpencryption = ssl
1429   smtpserverport = 465
1430   confirm = auto
1431 #+end_src
1432 *** Submodules
1433 #+begin_src plain :tangle ~/.gitconfig
1434 [submodule]
1435   recurse = true
1436 #+end_src
1437 *** Aliases
1438 #+begin_src plain :tangle ~/.gitconfig
1439 [alias]
1440   stat = diff --stat
1441   sclone = clone --depth 1
1442   sclean = clean -dfX
1443   a = add
1444   aa = add .
1445   c = commit
1446   p = push
1447   subup = submodule update --remote
1448   loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1449   mirror = git config --global alias.mirrormirror
1450 #+end_src
1451 *** Commits
1452 #+begin_src plain :tangle ~/.gitconfig
1453 [commit]
1454   gpgsign = true
1455 #+end_src
1456 ** Dunst
1457 Lightweight notification daemon. Gruvbox colors, based on https://github.com/a-schaefers/i3-wm-gruvbox-theme/
1458 *** General
1459 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1460   [global]
1461   font = "JetBrains Mono Medium Nerd Font 11"
1462   allow_markup = yes
1463   format = "<b>%s</b>\n%b"
1464   sort = no
1465   indicate_hidden = yes
1466   alignment = center
1467   bounce_freq = 0
1468   show_age_threshold = 60
1469   word_wrap = yes
1470   ignore_newline = no
1471   geometry = "400x5-20+20"
1472   transparency = 0
1473   idle_threshold = 120
1474   monitor = 0
1475   sticky_history = yes
1476   line_height = 0
1477   separator_height = 4
1478   padding = 8
1479   horizontal_padding = 8
1480   max_icon_size = 32
1481   separator_color = "#585858"
1482   startup_notification = false
1483 #+end_src
1484 *** Modes
1485 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1486   [frame]
1487   width = 4
1488   color = "#585858"
1489
1490   [shortcuts]
1491   close = mod4+c
1492   close_all = mod4+shift+c
1493   history = mod4+ctrl+c
1494
1495   [urgency_low]
1496   background = "#282828"
1497   foreground = "#ebdbb2"
1498   highlight = "#ebdbb2"
1499   timeout = 5
1500
1501   [urgency_normal]
1502   background = "#282828"
1503   foreground = "#ebdbb2"
1504   highlight = "#ebdbb2"
1505   timeout = 15
1506
1507   [urgency_critical]
1508   background = "#282828"
1509   foreground = "#cc241d"
1510   highlight = "#ebdbb2"
1511   timeout = 0
1512 #+end_src