]> git.armaanb.net Git - config.org.git/blob - config.org
3dfe4e5576234eb8cb4cf24925924891347b6fe3
[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 'rainbow
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 "TODO" 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))
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 ** Automatically tangle
281 #+begin_src emacs-lisp
282   (add-hook 'org-mode-hook
283             (lambda () (add-hook 'after-save-hook #'org-babel-tangle
284                                  :append :local)))
285 #+end_src
286 ** Tempo
287 #+begin_src emacs-lisp
288   (use-package org-tempo
289     :after org
290     :straight (:type built-in)
291     :config
292     ;; TODO: There's gotta be a more efficient way to write this
293     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
294     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
295     (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
296     (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
297     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
298     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
299     (add-to-list 'org-structure-template-alist '("git" . "src plain :tangle ~/.gitconfig")))
300 #+end_src
301 * Autocompletion
302 ** Ivy
303 Simple, but not too simple autocompletion.
304 #+begin_src emacs-lisp
305   (use-package ivy
306     :bind (("C-s" . swiper)
307            :map ivy-minibuffer-map
308            ("TAB" . ivy-alt-done)
309            :map ivy-switch-buffer-map
310            ("C-d" . ivy-switch-buffer-kill))
311     :config (ivy-mode))
312 #+end_src
313 ** Ivy-rich
314 #+begin_src emacs-lisp
315   (use-package ivy-rich
316     :after ivy
317     :config (ivy-rich-mode))
318 #+end_src
319 ** Counsel
320 Ivy everywhere.
321 #+begin_src emacs-lisp
322   (use-package counsel
323     :bind (("C-M-j" . 'counsel-switch-buffer)
324            :map minibuffer-local-map
325            ("C-r" . 'counsel-minibuffer-history))
326     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
327     :config (counsel-mode))
328 #+end_src
329 ** Remember frequent commands
330 #+begin_src emacs-lisp
331   (use-package ivy-prescient
332     :after counsel
333     :custom
334     (ivy-prescient-enable-filtering nil)
335     :config
336     (prescient-persist-mode)
337     (ivy-prescient-mode))
338 #+end_src
339 ** Swiper
340 Better search utility.
341 #+begin_src emacs-lisp
342   (use-package swiper)
343 #+end_src
344 * EmacsOS
345 ** RSS
346 Use elfeed for RSS. I have another file with all the feeds in it.
347 #+begin_src emacs-lisp
348   (use-package elfeed
349     :bind (("C-c e" . elfeed))
350     :config
351     (load "~/.emacs.d/feeds.el")
352     (add-hook 'elfeed-new-entry-hook
353               (elfeed-make-tagger :feed-url "youtube\\.com"
354                                   :add '(youtube)))
355     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
356
357   (use-package elfeed-goodies
358     :after elfeed
359     :config (elfeed-goodies/setup))
360 #+end_src
361 ** Email
362 Use mu4e for reading emails.
363
364 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.
365
366 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.
367 #+begin_src emacs-lisp
368   (use-package smtpmail
369     :straight (:type built-in))
370   (use-package mu4e
371     :load-path "/usr/share/emacs/site-lisp/mu4e"
372     :bind (("C-c m" . mu4e))
373     :config
374
375     (setq user-full-name "Armaan Bhojwani"
376           smtpmail-local-domain "armaanb.net"
377           smtpmail-stream-type 'ssl
378           smtpmail-smtp-service '465
379           mu4e-change-filenames-when-moving t
380           message-kill-buffer-on-exit t
381           mu4e-get-mail-command "offlineimap -q"
382           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
383           message-citation-line-function 'message-insert-formatted-citation-line
384           mu4e-context-policy "pick-first"
385           mu4e-contexts
386           `( ,(make-mu4e-context
387                :name "school"
388                :enter-func (lambda () (mu4e-message "Entering school context"))
389                :leave-func (lambda () (mu4e-message "Leaving school context"))
390                :match-func (lambda (msg)
391                              (when msg
392                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
393                :vars '( (user-mail-address . "abhojwani22@nobles.edu")
394                         (mu4e-sent-folder . "/school/Sent")
395                         (mu4e-drafts-folder . "/school/Drafts")
396                         (mu4e-trash-folder . "/school/Trash")
397                         (mu4e-refile-folder . "/school/Archive")
398                         (user-mail-address . "abhojwani22@nobles.edu")
399                         (smtpmail-smtp-user . "abhojwani22@nobles.edu")
400                         (smtpmail-smtp-server . "smtp.gmail.com")))
401              ,(make-mu4e-context
402                :name "personal"
403                :enter-func (lambda () (mu4e-message "Entering personal context"))
404                :leave-func (lambda () (mu4e-message "Leaving personal context"))
405                :match-func (lambda (msg)
406                              (when msg
407                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
408                :vars '(
409                        (mu4e-sent-folder . "/personal/Sent")
410                        (mu4e-drafts-folder . "/personal/Drafts")
411                        (mu4e-trash-folder . "/personal/Trash")
412                        (mu4e-refile-folder . "/personal/Archive")
413                        (user-mail-address . "me@armaanb.net")
414                        (smtpmail-smtp-user . "me@armaanb.net")
415                        (smtpmail-smtp-server "smtp.mailbox.org")
416                        (mu4e-drafts-folder . "/school/Drafts")
417                        (mu4e-trash-folder . "/school/Trash")))))
418
419     (add-to-list 'mu4e-bookmarks
420                  '(
421                    :name  "Unified inbox"
422                    :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
423                    :key   ?b)))
424 #+end_src
425 ** Calendar
426 #+begin_src emacs-lisp
427   (use-package calfw)
428   (use-package calfw-org)
429   (use-package calfw-ical)
430
431   (defun acheam-calendar ()
432     "Open a calendar."
433     (interactive)
434     (shell-command "vdirsyncer sync")
435     (let ((default-directory "~/.local/share/vdirsyncer/"))
436       (cfw:open-calendar-buffer
437        :contents-sources
438        (list
439         (cfw:ical-create-source "School" (expand-file-name "school/abhojwani22@nobles.edu.ics") "Green")
440         (cfw:ical-create-source "Personal" (expand-file-name "mailbox/Y2FsOi8vMC8zMQ.ics") "Blue")
441         (cfw:ical-create-source "Birthdays" (expand-file-name "mailbox/Y2FsOi8vMS8w.ics") "Gray")
442         ))))
443 #+end_src
444 ** IRC
445 Another file has more specific network configuration.
446 #+begin_src emacs-lisp
447   (use-package circe
448     :config
449     (load "~/.emacs.d/irc.el"))
450   (use-package circe-color-nicks
451     :after circe
452     :straight (:type built-in))
453   (use-package circe-chanop
454     :after circe
455     :straight (:type built-in))
456 #+end_src
457 ** Default browser
458 Set EWW as default browser except for videos
459 #+begin_src emacs-lisp
460   (defun browse-url-mpv (url &optional new-window)
461     "Open URL in MPV."
462     (start-process "mpv" "*mpv*" "mpv" url))
463
464   (setq browse-url-browser-function
465         (quote
466          (("youtu\\.?be" . browse-url-mpv)
467           ("." . eww-browse-url))))
468 #+end_src
469 ** Emacs Anywhere
470 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
471 "emacsclient --eval "(emacs-everywhere)".
472 #+begin_src emacs-lisp
473   (use-package emacs-everywhere)
474 #+end_src
475 * Emacs IDE
476 ** LSP
477 *** General
478 #+begin_src emacs-lisp
479   (use-package lsp-mode
480     :commands (lsp lsp-deferred)
481     :custom (lsp-keymap-prefix "C-c l")
482     :hook ((lsp-mode . lsp-enable-which-key-integration)))
483
484   (use-package lsp-ivy)
485
486   (use-package lsp-ui
487     :commands lsp-ui-mode
488     :custom (lsp-ui-doc-position 'bottom))
489   (use-package lsp-ui-flycheck
490     :after lsp-ui
491     :straight (:type built-in))
492 #+end_src
493 *** Company
494 Company-box adds icons.
495 #+begin_src emacs-lisp
496   (use-package company
497     :after lsp-mode
498     :hook (lsp-mode . company-mode)
499     :bind (:map company-active-map
500                 ("<tab>" . company-complete-selection))
501     (:map lsp-mode-map
502           ("<tab>" . company-indent-or-complete-common))
503     :custom
504     (company-minimum-prefix-length 1)
505     (setq company-dabbrev-downcase 0)
506     (company-idle-delay 0.0))
507
508   (use-package company-box
509     :hook (company-mode . company-box-mode))
510 #+end_src
511 *** Language servers
512 **** Python
513 #+begin_src emacs-lisp
514   (use-package lsp-pyright
515     :hook (python-mode . (lambda ()
516                            (use-package lsp-pyright
517                              :straight (:type built-in))
518                            (lsp-deferred))))
519 #+end_src
520 ** Code cleanup
521 #+begin_src emacs-lisp
522   (use-package blacken
523     :hook (python-mode . blacken-mode)
524     :config
525     (setq blacken-line-length 79))
526
527   ;; Purge whitespace
528   (use-package ws-butler
529     :config
530     (ws-butler-global-mode))
531 #+end_src
532 ** Flycheck
533 #+begin_src emacs-lisp
534   (use-package flycheck
535     :config
536     (global-flycheck-mode))
537 #+end_src
538 ** Project management
539 #+begin_src emacs-lisp
540   (use-package projectile
541     :config (projectile-mode)
542     :custom ((projectile-completion-system 'ivy))
543     :bind-keymap
544     ("C-c p" . projectile-command-map)
545     :init
546     (when (file-directory-p "~/Code")
547       (setq projectile-project-search-path '("~/Code")))
548     (setq projectile-switch-project-action #'projectile-dired))
549
550   (use-package counsel-projectile
551     :after projectile
552     :config (counsel-projectile-mode))
553 #+end_src
554 ** Dired
555 #+begin_src emacs-lisp
556   (use-package dired
557     :straight (:type built-in)
558     :commands (dired dired-jump)
559     :custom ((dired-listing-switches "-agho --group-directories-first"))
560     :config
561     (evil-collection-define-key 'normal 'dired-mode-map
562       "h" 'dired-single-up-directory
563       "l" 'dired-single-buffer))
564
565   (use-package dired-single
566     :commands (dired dired-jump))
567
568   (use-package dired-open
569     :commands (dired dired-jump)
570     :custom
571     (dired-open-extensions '(("png" . "feh")
572                              ("mkv" . "mpv"))))
573
574   (use-package dired-hide-dotfiles
575     :hook (dired-mode . dired-hide-dotfiles-mode)
576     :config
577     (evil-collection-define-key 'normal 'dired-mode-map
578       "H" 'dired-hide-dotfiles-mode))
579 #+end_src
580 ** Git
581 *** Magit
582 #+begin_src emacs-lisp
583   (use-package magit
584     :hook (git-commit-setup-hook . pinentry-start))
585 #+end_src
586 *** Colored diff in line number area
587 #+begin_src emacs-lisp
588   (use-package diff-hl
589     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
590     :config (global-diff-hl-mode))
591 #+end_src
592 ** Indentation
593 Indent after every change.
594 #+begin_src emacs-lisp
595   (use-package aggressive-indent
596     :config (global-aggressive-indent-mode))
597 #+end_src
598 * Functions
599 ** Easily convert splits
600 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
601 #+begin_src emacs-lisp
602   (defun toggle-window-split ()
603     (interactive)
604     (if (= (count-windows) 2)
605         (let* ((this-win-buffer (window-buffer))
606                (next-win-buffer (window-buffer (next-window)))
607                (this-win-edges (window-edges (selected-window)))
608                (next-win-edges (window-edges (next-window)))
609                (this-win-2nd (not (and (<= (car this-win-edges)
610                                            (car next-win-edges))
611                                        (<= (cadr this-win-edges)
612                                            (cadr next-win-edges)))))
613                (splitter
614                 (if (= (car this-win-edges)
615                        (car (window-edges (next-window))))
616                     'split-window-horizontally
617                   'split-window-vertically)))
618           (delete-other-windows)
619           (let ((first-win (selected-window)))
620             (funcall splitter)
621             (if this-win-2nd (other-window 1))
622             (set-window-buffer (selected-window) this-win-buffer)
623             (set-window-buffer (next-window) next-win-buffer)
624             (select-window first-win)
625             (if this-win-2nd (other-window 1))))))
626
627   (define-key ctl-x-4-map "t" 'toggle-window-split)
628 #+end_src
629 ** Insert date
630 #+begin_src emacs-lisp
631   (defun insert-date ()
632     (interactive)
633     (insert (format-time-string "%Y-%m-%d")))
634 #+end_src
635 * Keybindings
636 ** Switch windows
637 #+begin_src emacs-lisp
638   (use-package ace-window
639     :bind ("M-o" . ace-window))
640 #+end_src
641 ** Kill current buffer
642 Makes "C-x k" binding faster.
643 #+begin_src emacs-lisp
644   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
645 #+end_src
646 * Other settings
647 ** Save place
648 Opens file where you left it.
649 #+begin_src emacs-lisp
650   (save-place-mode)
651 #+end_src
652 ** OpenSCAD
653 Render OpenSCAD files, and add a preview window.
654
655 Personal fork just merges a PR.
656 #+begin_src emacs-lisp
657   (use-package scad-mode)
658   (use-package scad-preview
659     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
660 #+end_src
661 ** Writing mode
662 Distraction free writing a la junegunn/goyo.
663 #+begin_src emacs-lisp
664   (use-package olivetti
665     :config
666     (evil-leader/set-key "o" 'olivetti-mode))
667 #+end_src
668 ** Control backup files
669 Stop backup files from spewing everywhere.
670 #+begin_src emacs-lisp
671   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
672 #+end_src
673 ** Abbreviations
674 Abbreviate things!
675 #+begin_src emacs-lisp
676   (setq abbrev-file-name "~/.emacs.d/abbrevs")
677   (setq save-abbrevs 'silent)
678   (setq-default abbrev-mode t)
679 #+end_src
680 ** Expand tabs to spaces
681 #+begin_src emacs-lisp
682   (setq-default tab-width 2)
683 #+end_src
684 ** Make yes/no easier
685 #+begin_src emacs-lisp
686   (defalias 'yes-or-no-p 'y-or-n-p)
687 #+end_src
688 ** Move customize file
689 No more clogging up init.el.
690 #+begin_src emacs-lisp
691   (setq custom-file "~/.emacs.d/custom.el")
692   (load custom-file)
693 #+end_src
694 ** Better help
695 #+begin_src emacs-lisp
696   (use-package helpful
697     :commands (helpful-callable helpful-variable helpful-command helpful-key)
698     :custom
699     (counsel-describe-function-function #'helpful-callable)
700     (counsel-describe-variable-function #'helpful-variable)
701     :bind
702     ([remap describe-function] . counsel-describe-function)
703     ([remap describe-command] . helpful-command)
704     ([remap describe-variable] . counsel-describe-variable)
705     ([remap describe-key] . helpful-key))
706 #+end_src
707 ** GPG
708 #+begin_src emacs-lisp
709   (use-package epa-file
710     :straight (:type built-in))
711   (setq epa-file-select-keys nil
712         epa-file-encrypt-to '("me@armaanb.net")
713         password-cache-expiry (* 60 15))
714
715   (use-package pinentry)
716 #+end_src
717 ** Pastebin
718 #+begin_src emacs-lisp
719   (use-package 0x0
720     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
721     :custom (0x0-default-service 'envs)
722     :config (evil-leader/set-key
723               "00" '0x0-upload
724               "0f" '0x0-upload-file
725               "0s" '0x0-upload-string
726               "0c" '0x0-upload-kill-ring
727               "0p" '0x0-upload-popup))
728 #+end_src
729 ** Copy kill ring to clipboard
730 #+begin_src emacs-lisp
731   (setq x-select-enable-clipboard t)
732   (defun copy-kill-ring-to-xorg ()
733     "Copy the current kill ring to the xorg clipboard."
734     (interactive)
735     (x-select-text (current-kill 0)))
736 #+end_src
737 ** Browse kill ring
738 #+begin_src emacs-lisp
739   (use-package browse-kill-ring)
740 #+end_src
741 * Tangles
742 ** Spectrwm
743 *** General settings
744 #+begin_src conf :tangle ~/.spectrwm.conf
745   workspace_limit = 5
746   warp_pointer = 1
747   modkey = Mod4
748   border_width = 4
749   tile_gap = 10
750   autorun = ws[1]:/home/armaa/Code/scripts/autostart
751 #+end_src
752 *** Apprearance
753 Gruvbox colors
754 #+begin_src conf :tangle ~/.spectrwm.conf
755   color_focus = rgb:83/a5/98
756   color_focus_maximized = rgb:d6/5d/0e
757   color_unfocus = rgb:58/58/58
758
759   bar_enabled = 0
760   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
761 #+end_src
762 *** Keybindings
763 **** WM actions
764 #+begin_src conf :tangle ~/.spectrwm.conf
765   program[lock] = i3lock -c 000000 -ef
766   program[term] = alacritty
767   program[screenshot_all] = flameshot gui
768   program[menu] = rofi -show run # `rofi-dmenu` handles the rest
769   program[switcher] = rofi -show window
770   program[notif] = /home/armaa/Code/scripts/setter status
771
772   bind[notif] = MOD+n
773   bind[switcher] = MOD+Tab
774 #+end_src
775 **** Media keys
776 #+begin_src conf :tangle ~/.spectrwm.conf
777   program[paup] = /home/armaa/Code/scripts/setter audio +5
778   program[padown] = /home/armaa/Code/scripts/setter audio -5
779   program[pamute] = /home/armaa/Code/scripts/setter audio
780   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
781   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
782   program[next] = playerctl next
783   program[prev] = playerctl previous
784   program[pause] = playerctl play-pause
785
786   bind[padown] = XF86AudioLowerVolume
787   bind[paup] = XF86AudioRaiseVolume
788   bind[pamute] = XF86AudioMute
789   bind[brigdown] = XF86MonBrightnessDown
790   bind[brigup] = XF86MonBrightnessUp
791   bind[pause] = XF86AudioPlay
792   bind[next] = XF86AudioNext
793   bind[prev] = XF86AudioPrev
794 #+end_src
795 **** HJKL
796 #+begin_src conf :tangle ~/.spectrwm.conf
797   program[h] = xdotool keyup h key --clearmodifiers Left
798   program[j] = xdotool keyup j key --clearmodifiers Down
799   program[k] = xdotool keyup k key --clearmodifiers Up
800   program[l] = xdotool keyup l key --clearmodifiers Right
801
802   bind[h] = MOD + Control + h
803   bind[j] = MOD + Control + j
804   bind[k] = MOD + Control + k
805   bind[l] = MOD + Control + l
806 #+end_src
807 **** Programs
808 #+begin_src conf :tangle ~/.spectrwm.conf
809   program[aerc] = alacritty -e aerc
810   program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
811   program[emacs] = emacsclient -c
812   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
813   program[firefox] = firefox
814   program[thunderbird] = thunderbird
815   program[slack] = slack
816
817   bind[aerc] = MOD+Control+s
818   bind[weechat] = MOD+Control+d
819   bind[emacs] = MOD+Control+f
820   bind[emacs-anywhere] = MOD+f
821   bind[firefox] = MOD+Control+u
822   bind[thunderbird] = MOD+Control+i
823   bind[slack] = MOD+Control+o
824 #+end_src
825 ** Zsh
826 *** Settings
827 **** Completions
828 #+begin_src shell :tangle ~/.config/zsh/zshrc
829   autoload -Uz compinit
830   compinit
831
832   setopt no_case_glob
833   unsetopt glob_complete
834 #+end_src
835 **** Vim bindings
836 #+begin_src shell :tangle ~/.config/zsh/zshrc
837   bindkey -v
838   KEYTIMEOUT=1
839
840   bindkey -M vicmd "^[[3~" delete-char
841   bindkey "^[[3~" delete-char
842
843   autoload edit-command-line
844   zle -N edit-command-line
845   bindkey -M vicmd ^e edit-command-line
846   bindkey ^e edit-command-line
847 #+end_src
848 **** History
849 #+begin_src shell :tangle ~/.config/zsh/zshrc
850   setopt extended_history
851   setopt share_history
852   setopt inc_append_history
853   setopt hist_ignore_dups
854   setopt hist_reduce_blanks
855
856   HISTSIZE=10000
857   SAVEHIST=10000
858   HISTFILE=~/.local/share/zsh/history
859 #+end_src
860 *** Plugins
861 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
862 **** ZPE
863 #+begin_src plain :tangle ~/.config/zpe/repositories
864     https://github.com/Aloxaf/fzf-tab
865     https://github.com/zdharma/fast-syntax-highlighting
866     https://github.com/rupa/z
867 #+end_src
868 **** Zshrc
869 #+begin_src shell :tangle ~/.config/zsh/zshrc
870   source ~/Code/zpe/zpe.sh
871   source ~/Code/admone/admone.zsh
872   source ~/.config/zsh/fzf-bindings.zsh
873
874   zpe-source fzf-tab/fzf-tab.zsh
875   zstyle ':completion:*:descriptions' format '[%d]'
876   zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
877   zstyle ':completion:*' completer _complete
878   zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
879          'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
880   enable-fzf-tab
881   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
882   export _Z_DATA="/home/armaa/.local/share/z"
883   zpe-source z/z.sh
884 #+end_src
885 *** Functions
886 **** Alert after long command
887 #+begin_src shell :tangle ~/.config/zsh/zshrc
888   alert() {
889       notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
890                   ${history[$HISTCMD]%[;&|][[:space:]]##alert}
891   }
892 #+end_src
893 **** Time Zsh startup
894 #+begin_src shell :tangle ~/.config/zsh/zshrc
895   timezsh() {
896       for i in $(seq 1 10); do
897           time "zsh" -i -c exit;
898       done
899   }
900 #+end_src
901 **** Update all packages
902 #+begin_src shell :tangle ~/.config/zsh/zshrc
903   color=$(tput setaf 5)
904   reset=$(tput sgr0)
905
906   apu() {
907       sudo echo "${color}== upgrading with yay ==${reset}"
908       yay
909       echo ""
910       echo "${color}== checking for pacnew files ==${reset}"
911       sudo pacdiff
912       echo
913       echo "${color}== upgrading flatpaks ==${reset}"
914       flatpak update
915       echo ""
916       echo "${color}== upgrading zsh plugins ==${reset}"
917       zpe-pull
918       echo ""
919       echo "${color}== updating nvim plugins ==${reset}"
920       nvim +PlugUpdate +PlugUpgrade +qall
921       echo "Updated nvim plugins"
922       echo ""
923       echo "${color}You are entirely up to date!${reset}"
924   }
925 #+end_src
926 **** Clean all packages
927 #+begin_src shell :tangle ~/.config/zsh/zshrc
928   apap() {
929       sudo echo "${color}== cleaning pacman orphans ==${reset}"
930       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
931       echo ""
932       echo "${color}== cleaning flatpaks ==${reset}"
933       flatpak remove --unused
934       echo ""
935       echo "${color}== cleaning zsh plugins ==${reset}"
936       zpe-clean
937       echo ""
938       echo "${color}== cleaning nvim plugins ==${reset}"
939       nvim +PlugClean +qall
940       echo "Cleaned nvim plugins"
941       echo ""
942       echo "${color}All orphans cleaned!${reset}"
943   }
944 #+end_src
945 **** ls every cd
946 #+begin_src shell :tangle ~/.config/zsh/zshrc
947   chpwd() {
948       emulate -L zsh
949       exa -lh --icons --git --group-directories-first
950   }
951 #+end_src
952 **** Setup anaconda
953 #+begin_src shell :tangle ~/.config/zsh/zshrc
954   zconda() {
955       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
956       if [ $? -eq 0 ]; then
957           eval "$__conda_setup"
958       else
959           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
960               . "/opt/anaconda/etc/profile.d/conda.sh"
961           else
962               export PATH="/opt/anaconda/bin:$PATH"
963           fi
964       fi
965       unset __conda_setup
966   }
967 #+end_src
968 **** Interact with 0x0
969 #+begin_src shell :tangle ~/.config/zsh/zshrc
970   zxz="https://envs.sh"
971   0file() { curl -F"file=@$1" "$zxz" ; }
972   0pb() { curl -F"file=@-;" "$zxz" ; }
973   0url() { curl -F"url=$1" "$zxz" ; }
974   0short() { curl -F"shorten=$1" "$zxz" ; }
975   0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
976 #+end_src
977 **** Swap two files
978 #+begin_src shell :tangle ~/.config/zsh/zshrc
979   sw() {
980       mv $1 $1.tmp
981       mv $2 $1
982       mv $1.tmp $2
983   }
984 #+end_src
985 *** Aliases
986 **** SSH
987 #+begin_src shell :tangle ~/.config/zsh/zshrc
988   alias bhoji-drop='ssh -p 23 root@armaanb.net'
989   alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
990   alias tcf='ssh root@204.48.23.68'
991   alias ngmun='ssh root@157.245.89.25'
992   alias prox='ssh root@192.168.1.224'
993   alias dock='ssh root@192.168.1.225'
994   alias jenkins='ssh root@192.168.1.226'
995   alias envs='ssh acheam@envs.net'
996 #+end_src
997 **** File management
998 #+begin_src shell :tangle ~/.config/zsh/zshrc
999   alias ls='exa -lh --icons --git --group-directories-first'
1000   alias la='exa -lha --icons --git --group-directories-first'
1001   alias df='df -h / /boot'
1002   alias du='du -h'
1003   alias free='free -h'
1004   alias cp='cp -riv'
1005   alias rm='rm -Iv'
1006   alias mv='mv -iv'
1007   alias ln='ln -iv'
1008   alias grep='grep -in --exclude-dir=.git --color=auto'
1009   alias mkdir='mkdir -pv'
1010   alias unar='atool -x'
1011   alias wget='wget -e robots=off'
1012   alias lanex='~/.local/share/lxc/lxc'
1013 #+end_src
1014 **** Dotfiles
1015 #+begin_src shell :tangle ~/.config/zsh/zshrc
1016   alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1017   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1018     yadm push'
1019   alias padu='padm add -u && padm commit && padm push && yadu'
1020 #+end_src
1021 **** Editing
1022 #+begin_src shell :tangle ~/.config/zsh/zshrc
1023   alias v='nvim'
1024   alias vim='nvim'
1025   alias vw="nvim ~/Documents/vimwiki/index.md"
1026 #+end_src
1027 **** System management
1028 #+begin_src shell :tangle ~/.config/zsh/zshrc
1029   alias jctl='journalctl -p 3 -xb'
1030   alias pkill='pkill -i'
1031   alias cx='chmod +x'
1032   alias please='sudo $(fc -ln -1)'
1033   alias sudo='sudo ' # allows aliases to be run with sudo
1034 #+end_src
1035 **** Networking
1036 #+begin_src shell :tangle ~/.config/zsh/zshrc
1037   alias ping='ping -c 10'
1038   alias speed='speedtest-cli'
1039   alias ip='ip --color=auto'
1040   alias cip='curl https://armaanb.net/ip'
1041   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1042   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1043 #+end_src
1044 **** Docker
1045 #+begin_src shell :tangle ~/.config/zsh/zshrc
1046   alias dc='docker-compose'
1047   alias dcdu='docker-compose down && docker-compose up -d'
1048 #+end_src
1049 **** Other
1050 #+begin_src shell :tangle ~/.config/zsh/zshrc
1051   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1052     iflag=fullblock status=progress'
1053   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1054     iflag=fullblock status=progress'
1055   alias ts='gen-shell -c task'
1056   alias ts='gen-shell -c task'
1057   alias tetris='autoload -Uz tetriscurses && tetriscurses'
1058   alias news='newsboat'
1059   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1060   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1061     --restrict-filenames -o '%(title)s.%(ext)s'"
1062   alias cal="cal -3 --color=auto"
1063 #+end_src
1064 **** Virtual machines, chroots
1065 #+begin_src shell :tangle ~/.config/zsh/zshrc
1066   alias ckiss="sudo chrooter ~/Virtual/kiss"
1067   alias cdebian="sudo chrooter ~/Virtual/debian bash"
1068   alias cwindows='devour qemu-system-x86_64 \
1069     -smp 3 \
1070     -cpu host \
1071     -enable-kvm \
1072     -m 3G \
1073     -device VGA,vgamem_mb=64 \
1074     -device intel-hda \
1075     -device hda-duplex \
1076     -net nic \
1077     -net user,smb=/home/armaa/Public \
1078     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1079 #+end_src
1080 **** Python
1081 #+begin_src shell :tangle ~/.config/zsh/zshrc
1082   alias ipy="ipython"
1083   alias zpy="zconda && ipython"
1084   alias math="ipython --profile=math"
1085   alias pypi="python setup.py sdist && twine upload dist/*"
1086   alias pip="python -m pip"
1087   alias black="black -l 79"
1088 #+end_src
1089 **** Latin
1090 #+begin_src shell :tangle ~/.config/zsh/zshrc
1091   alias words='gen-shell -c "words"'
1092   alias words-e='gen-shell -c "words ~E"'
1093 #+end_src
1094 **** Devour
1095 #+begin_src shell :tangle ~/.config/zsh/zshrc
1096   alias zathura='devour zathura'
1097   alias mpv='devour mpv'
1098   alias sql='devour sqlitebrowser'
1099   alias cad='devour openscad'
1100   alias feh='devour feh'
1101 #+end_src
1102 **** Package management (Pacman)
1103 #+begin_src shell :tangle ~/.config/zsh/zshrc
1104   alias aps='yay -Ss'
1105   alias api='yay -Syu'
1106   alias app='yay -Rns'
1107   alias apc='yay -Sc'
1108   alias apo='yay -Qttd'
1109   alias azf='pacman -Q | fzf'
1110   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1111   alias ufetch='ufetch-arch'
1112   alias reflect='reflector --verbose --sort rate --save \
1113     ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1114 #+end_src
1115 *** Exports
1116 #+begin_src shell :tangle ~/.config/zsh/zshrc
1117   export EDITOR="emacsclient -c"                  # $EDITOR opens in terminal
1118   export VISUAL="emacsclient -c -a emacs"         # $VISUAL opens in GUI mode
1119   export TERM=xterm-256color # for compatability
1120
1121   export GPG_TTY="$(tty)"
1122   export MANPAGER='nvim +Man!'
1123   export PAGER='less'
1124
1125   # generated with "vivid generate gruvbox"
1126   export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1127
1128   export GTK_USE_PORTAL=1
1129
1130   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1131   export PATH="$PATH:/home/armaa/Code/scripts"
1132   export PATH="$PATH:/home/armaa/.cargo/bin"
1133   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1134   export PATH="$PATH:/usr/sbin"
1135   export PATH="$PATH:/opt/FreeTube/freetube"
1136
1137   export LC_ALL="en_US.UTF-8"
1138   export LC_CTYPE="en_US.UTF-8"
1139   export LANGUAGE="en_US.UTF-8"
1140
1141   export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1142   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1143   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1144   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1145   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1146   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1147 #+end_src
1148 ** Alacritty
1149 *** Appearance
1150 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1151 font:
1152   normal:
1153     family: JetBrains Mono Nerd Font
1154     style: Medium
1155   italic:
1156     style: Italic
1157   Bold:
1158     style: Bold
1159   size: 7
1160   ligatures: true # Requires ligature patch
1161
1162 window:
1163   padding:
1164     x: 5
1165     y: 5
1166
1167 background_opacity: 0.6
1168 #+end_src
1169 *** Keybindings
1170 Send <RET> + modifier through
1171 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1172 key_bindings:
1173   - {
1174     key: Return,
1175     mods: Shift,
1176     chars: "\x1b[13;2u"
1177   }
1178   - {
1179     key: Return,
1180     mods: Control,
1181     chars: "\x1b[13;5u"
1182   }
1183 #+end_src
1184 *** Color scheme
1185 Gruvbox
1186 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1187 colors:
1188   # Default colors
1189   primary:
1190     background: '#000000'
1191     foreground: '#ebdbb2'
1192
1193   # Normal colors
1194   normal:
1195     black:   '#282828'
1196     red:     '#cc241d'
1197     green:   '#98971a'
1198     yellow:  '#d79921'
1199     blue:    '#458588'
1200     magenta: '#b16286'
1201     cyan:    '#689d6a'
1202     white:   '#a89984'
1203
1204   # Bright colors
1205   bright:
1206     black:   '#928374'
1207     red:     '#fb4934'
1208     green:   '#b8bb26'
1209     yellow:  '#fabd2f'
1210     blue:    '#83a598'
1211     magenta: '#d3869b'
1212     cyan:    '#8ec07c'
1213     white:   '#ebdbb2'
1214 #+end_src
1215 ** IPython
1216 *** General
1217 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1218 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1219   c.TerminalInteractiveShell.editing_mode = 'vi'
1220   c.InteractiveShell.colors = 'linux'
1221   c.TerminalInteractiveShell.confirm_exit = False
1222 #+end_src
1223 *** Math
1224 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1225   from math import *
1226
1227   def deg(x):
1228       return x * (180 /  pi)
1229
1230   def rad(x):
1231       return x * (pi / 180)
1232
1233   def rad(x, unit):
1234       return (x * (pi / 180)) / unit
1235
1236   def csc(x):
1237       return 1 / sin(x)
1238
1239   def sec(x):
1240       return 1 / cos(x)
1241
1242   def cot(x):
1243       return 1 / tan(x)
1244 #+end_src
1245 ** MPV
1246 Make MPV play a little bit smoother.
1247 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1248   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1249   hwdec=auto-copy
1250 #+end_src
1251 ** Picom
1252 *** Shadows
1253 #+begin_src conf :tangle ~/.config/picom/picom.conf
1254   shadow = true;
1255   shadow-radius = 10;
1256   shadow-offset-x = -5;
1257   shadow-offset-y = -5;
1258 #+end_src
1259 *** Fading
1260 #+begin_src conf :tangle ~/.config/picom/picom.conf
1261   fading = true
1262   fade-delta = 5
1263 #+end_src
1264 *** Blur
1265 #+begin_src conf :tangle ~/.config/picom/picom.conf
1266   blur:
1267   {
1268   method = "gaussian";
1269   size = 5;
1270   deviation = 5;
1271   };
1272 #+end_src
1273 *** Backend
1274 Needs picom to be run with "--experimental-backends"
1275 #+begin_src conf :tangle ~/.config/picom/picom.conf
1276   backend = "glx";
1277 #+end_src
1278 ** Inputrc
1279 For any GNU Readline programs
1280 #+begin_src plain :tangle ~/.inputrc
1281   set editing-mode vi
1282 #+end_src
1283 ** Vivid
1284 https://github.com/sharkdp/vivid
1285 *** Colors
1286 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1287   colors:
1288     background_color: '282A36'
1289     black: '21222C'
1290     orange: 'd65d0e'
1291     purple: 'b16286'
1292     red: 'cc241d'
1293     blue: '458588'
1294     pink: 'd3869b'
1295     lime: '689d6a'
1296
1297     gray: '928374'
1298 #+end_src
1299 *** Core
1300 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1301   core:
1302     regular_file: {}
1303
1304     directory:
1305       foreground: blue
1306
1307     executable_file:
1308       foreground: red
1309       font-style: bold
1310
1311     symlink:
1312       foreground: pink
1313
1314     broken_symlink:
1315       foreground: black
1316       background: red
1317     missing_symlink_target:
1318       foreground: black
1319       background: red
1320
1321     fifo:
1322       foreground: black
1323       background: blue
1324
1325     socket:
1326       foreground: black
1327       background: pink
1328
1329     character_device:
1330       foreground: black
1331       background: lime
1332
1333     block_device:
1334       foreground: black
1335       background: red
1336
1337     normal_text:
1338       {}
1339
1340     sticky:
1341       {}
1342
1343     sticky_other_writable:
1344       {}
1345
1346     other_writable:
1347       {}
1348
1349   text:
1350     special:
1351       foreground: black
1352       background: orange
1353
1354     todo:
1355       font-style: bold
1356
1357     licenses:
1358       foreground: gray
1359
1360     configuration:
1361       foreground: orange
1362
1363     other:
1364       foreground: orange
1365
1366   markup:
1367     foreground: orange
1368
1369   programming:
1370     source:
1371       foreground: purple
1372
1373     tooling:
1374       foreground: purple
1375
1376       continuous-integration:
1377         foreground: purple
1378
1379   media:
1380     foreground: pink
1381
1382   office:
1383     foreground: red
1384
1385   archives:
1386     foreground: lime
1387     font-style: underline
1388
1389   executable:
1390     foreground: red
1391     font-style: bold
1392
1393   unimportant:
1394     foreground: gray
1395 #+end_src
1396 ** Git
1397 *** User
1398 #+begin_src plain :tangle ~/.gitconfig
1399 [user]
1400         name = Armaan Bhojwani
1401         email = me@armaanb.net
1402         signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1403 #+end_src
1404 *** Init
1405 #+begin_src plain :tangle ~/.gitconfig
1406 [init]
1407         defaultBranch = main
1408 #+end_src
1409 *** GPG
1410 #+begin_src plain :tangle ~/.gitconfig
1411 [gpg]
1412         program = gpg
1413 #+end_src
1414 *** Sendemail
1415 #+begin_src plain :tangle ~/.gitconfig
1416 [sendemail]
1417         smtpserver = smtp.mailbox.org
1418         smtpuser = me@armaanb.net
1419         smtpencryption = ssl
1420         smtpserverport = 465
1421         confirm = auto
1422 #+end_src
1423 *** Submodules
1424 #+begin_src plain :tangle ~/.gitconfig
1425 [submodule]
1426         recurse = true
1427 #+end_src
1428 *** Aliases
1429 #+begin_src plain :tangle ~/.gitconfig
1430 [alias]
1431         stat = diff --stat
1432         sclone = clone --depth 1
1433         sclean = clean -dfX
1434         a = add
1435         aa = add .
1436         c = commit
1437         p = push
1438         subup = submodule update --remote
1439         loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1440         mirror = git config --global alias.mirrormirror
1441 #+end_src
1442 *** Commits
1443 #+begin_src plain :tangle ~/.gitconfig
1444 [commit]
1445         gpgsign = true
1446 #+end_src