]> git.armaanb.net Git - config.org.git/blob - config.org
Revamp commentary
[config.org.git] / config.org
1 #+TITLE: System Configuration
2 #+DESCRIPTION: Personal system configuration in org-mode format.
3 #+AUTHOR: Armaan Bhojwani
4 #+EMAIL: me@armaanb.net
5
6 * Welcome
7 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!
8 ** Compatability
9 I am currently using Emacs 28 with native compilation, so some settings and packages may not be available for older versions of Emacs. This is a purely personal configuration, so while I can guarantee that it works on my setup, it might not work for you.
10 ** Choices
11 I chose to create a powerful, yet not overly heavy Emacs configuration. Things like a fancy modeline, icons, or LSP mode do not increase my productivity, and create visual clutter, and thus have been excluded.
12
13 Another important choice has been to integrate Emacs into a large part of my computing environment (see [[*Emacs OS]]). I use email, IRC, RSS, et cetera, all through Emacs which simplifies my workflow and creates an amazingly integrated environment.
14
15 Lastly, I use Evil mode. Modal keybindings are simpler and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
16 ** TODOs
17 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
18 *** TODO Include offlineimap config
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 near their contributions.
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 package.el 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 Use the Modus Operandi theme by Protesilaos Stavrou. Its the best theme for Emacs by far, because how clear and readable it is. It is highly customizable, but I just set a few options here.
46 #+begin_src emacs-lisp
47   (setq modus-themes-slanted-constructs t
48         modus-themes-bold-constructs t
49         modus-themes-mode-line '3d
50         modus-themes-scale-headings t
51         modus-themes-diffs 'desaturated)
52   (load-theme 'modus-vivendi t)
53 #+end_src
54 ** Typography
55 *** Font
56 JetBrains Mono is a great programming font with ligatures. The "NF" means that it has been patched with the [[https://www.nerdfonts.com/][Nerd Fonts]].
57 #+begin_src emacs-lisp
58   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
59 #+end_src
60 *** Ligatures
61 #+begin_src emacs-lisp
62   (use-package ligature
63     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
64     :config
65     (ligature-set-ligatures
66      '(prog-mode text-mode)
67      '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
68        "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
69        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
70        "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
71        "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
72        ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
73        "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
74        "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
75        "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
76        "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
77        "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
78        "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
79     (global-ligature-mode t))
80 #+end_src
81 ** Line numbers
82 Display relative line numbers except in certain modes.
83 #+begin_src emacs-lisp
84   (global-display-line-numbers-mode)
85   (setq display-line-numbers-type 'relative)
86   (dolist (no-line-num '(term-mode-hook
87                          pdf-view-mode-hook
88                          shell-mode-hook
89                          org-mode-hook
90                          eshell-mode-hook))
91     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
92 #+end_src
93 ** Highlight matching parenthesis
94 #+begin_src emacs-lisp
95   (use-package paren
96     :config (show-paren-mode)
97     :custom (show-paren-style 'parenthesis))
98 #+end_src
99 ** Modeline
100 *** Show current function
101 #+begin_src emacs-lisp
102   (which-function-mode)
103 #+end_src
104 *** Make position in file more descriptive
105 Show current column and file size.
106 #+begin_src emacs-lisp
107   (column-number-mode)
108   (size-indication-mode)
109 #+end_src
110 *** Hide minor modes
111 #+begin_src emacs-lisp
112   (use-package minions
113     :config (minions-mode))
114 #+end_src
115 ** Ruler
116 Show a ruler at a certain number of chars depending on mode.
117 #+begin_src emacs-lisp
118   (setq display-fill-column-indicator-column 80)
119   (global-display-fill-column-indicator-mode)
120 #+end_src
121 ** Keybinding hints
122 When starting a key chord, show possible future steps after 0.3 seconds.
123 #+begin_src emacs-lisp
124   (use-package which-key
125     :config (which-key-mode)
126     :custom (which-key-idle-delay 0.3))
127 #+end_src
128 ** Highlight todo items in comments
129 #+begin_src emacs-lisp
130   (use-package hl-todo
131     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
132     :config (global-hl-todo-mode 1))
133 #+end_src
134 ** Blink cursor
135 #+begin_src emacs-lisp
136   (blink-cursor-mode)
137 #+end_src
138 ** Visual line mode
139 Soft wrap words and do operations by visual lines except in programming modes.
140 #+begin_src emacs-lisp
141   (visual-line-mode 1)
142   (add-hook 'prog-mode-hook 'visual-line-mode 0)
143 #+end_src
144 ** Display number of matches in search
145 #+begin_src emacs-lisp
146   (use-package anzu
147     :config (global-anzu-mode))
148 #+end_src
149 ** Visual bell
150 Invert modeline color instead of audible bell or the standard visual bell.
151 #+begin_src emacs-lisp
152   (setq visible-bell nil
153         ring-bell-function
154         (lambda () (invert-face 'mode-line)
155           (run-with-timer 0.1 nil #'invert-face 'mode-line)))
156 #+end_src
157 * Evil mode
158 ** General
159 #+begin_src emacs-lisp
160   (use-package evil
161     :custom (select-enable-clipboard nil)
162     :config
163     (evil-mode)
164     (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
165     ;; Use visual line motions even outside of visual-line-mode buffers
166     (evil-global-set-key 'motion "j" 'evil-next-visual-line)
167     (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
168     (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
169 #+end_src
170 ** Evil collection
171 Evil bindings for tons of packages.
172 #+begin_src emacs-lisp
173   (use-package evil-collection
174     :after evil
175     :init (evil-collection-init)
176     :custom (evil-collection-setup-minibuffer t))
177 #+end_src
178 ** Surround
179 tpope prevails!
180 #+begin_src emacs-lisp
181   (use-package evil-surround
182     :config (global-evil-surround-mode))
183 #+end_src
184 ** Nerd commenter
185 Makes commenting super easy
186 #+begin_src emacs-lisp
187   (use-package evil-nerd-commenter
188     :bind (:map evil-normal-state-map
189                 ("gc" . evilnc-comment-or-uncomment-lines))
190     :custom (evilnc-invert-comment-line-by-line nil))
191 #+end_src
192 ** Undo redo
193 Fix the oopsies!
194 #+begin_src emacs-lisp
195   (evil-set-undo-system 'undo-redo)
196 #+end_src
197 ** Number incrementing
198 Add back C-a/C-x bindings.
199 #+begin_src emacs-lisp
200   (use-package evil-numbers
201     :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
202     :bind (:map evil-normal-state-map
203                 ("C-M-a" . evil-numbers/inc-at-pt)
204                 ("C-M-x" . evil-numbers/dec-at-pt)))
205 #+end_src
206 ** Evil org
207 #+begin_src emacs-lisp
208   (use-package evil-org
209     :after org
210     :hook (org-mode . evil-org-mode)
211     :config
212     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
213
214   (use-package evil-org-agenda
215     :straight (:type built-in)
216     :after evil-org
217     :config (evil-org-agenda-set-keys))
218 #+end_src
219 * Org mode
220 ** General
221 #+begin_src emacs-lisp
222   (use-package org
223     :straight (:type built-in)
224     :commands (org-capture org-agenda)
225     :custom
226     (org-ellipsis " ▾")
227     (org-agenda-start-with-log-mode t)
228     (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
229     (org-log-done 'time)
230     (org-log-into-drawer t)
231     (org-src-tab-acts-natively t)
232     (org-src-fontify-natively t)
233     (org-startup-indented t)
234     (org-hide-emphasis-markers t)
235     (org-fontify-whole-block-delimiter-line nil)
236     :bind ("C-c a" . org-agenda))
237 #+end_src
238 ** Tempo
239 Define templates for lots of common structure elements. Mostly just used within this file.
240 #+begin_src emacs-lisp
241   (use-package org-tempo
242     :after org
243     :straight (:type built-in)
244     :config
245     ;; TODO: There's gotta be a more efficient way to write this
246     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
247     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
248     (add-to-list 'org-structure-template-alist '("ash" . "src shell :tangle ~/.config/ash/ashrc"))
249     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
250     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
251     (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
252     (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
253     (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
254     (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
255     (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
256     (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources"))
257     (add-to-list 'org-structure-template-alist '("tm" . "src conf :tangle ~/.tmux.conf"))
258     (add-to-list 'org-structure-template-alist '("gp" . "src conf :tangle ~/.gnupg/gpg.conf"))
259     (add-to-list 'org-structure-template-alist '("ag" . "src conf :tangle ~/.gnupg/gpg-agent.conf")))
260 #+end_src
261 * Autocompletion
262 ** Ivy
263 A well balanced completion framework.
264 #+begin_src emacs-lisp
265   (use-package ivy
266     :bind (("C-s" . swiper)
267            :map ivy-minibuffer-map
268            ("TAB" . ivy-alt-done)
269            :map ivy-switch-buffer-map
270            ("M-d" . ivy-switch-buffer-kill))
271     :config (ivy-mode))
272 #+end_src
273 ** Ivy-rich
274 #+begin_src emacs-lisp
275   (use-package ivy-rich
276     :after (ivy counsel)
277     :config (ivy-rich-mode))
278 #+end_src
279 ** Counsel
280 Ivy everywhere.
281 #+begin_src emacs-lisp
282   (use-package counsel
283     :bind (("C-M-j" . 'counsel-switch-buffer)
284            :map minibuffer-local-map
285            ("C-r" . 'counsel-minibuffer-history))
286     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
287     :config (counsel-mode))
288 #+end_src
289 ** Remember frequent commands
290 #+begin_src emacs-lisp
291   (use-package ivy-prescient
292     :after counsel
293     :custom (ivy-prescient-enable-filtering nil)
294     :config
295     (prescient-persist-mode)
296     (ivy-prescient-mode))
297 #+end_src
298 ** Swiper
299 Better search utility.
300 #+begin_src emacs-lisp
301   (use-package swiper)
302 #+end_src
303 * Emacs OS
304 ** RSS
305 Use elfeed for reading RSS. I have another file with all the feeds in it that I'd rather keep private.
306 #+begin_src emacs-lisp
307   (use-package elfeed
308     :bind (("C-c e" . elfeed))
309     :config
310     (load "~/.emacs.d/feeds.el")
311     (add-hook 'elfeed-new-entry-hook
312               (elfeed-make-tagger :feed-url "youtube\\.com"
313                                   :add '(youtube)))
314     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
315
316   (use-package elfeed-goodies
317     :after elfeed
318     :config (elfeed-goodies/setup))
319 #+end_src
320 ** Email
321 Use mu4e for reading emails.
322
323 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.
324
325 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.
326 #+begin_src emacs-lisp
327   (use-package smtpmail
328     :straight (:type built-in))
329   (use-package mu4e
330     :load-path "/usr/share/emacs/site-lisp/mu4e"
331     :straight (:build nil)
332     :bind (("C-c m" . mu4e))
333     :config
334     (setq user-full-name "Armaan Bhojwani"
335           smtpmail-local-domain "armaanb.net"
336           smtpmail-stream-type 'ssl
337           smtpmail-smtp-service '465
338           mu4e-change-filenames-when-moving t
339           mu4e-get-mail-command "offlineimap -q"
340           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
341           message-citation-line-function 'message-insert-formatted-citation-line
342           mu4e-completing-read-function 'ivy-completing-read
343           mu4e-confirm-quit nil
344           mu4e-view-use-gnus t
345           mail-user-agent 'mu4e-user-agent
346           mail-context-policy 'pick-first
347           mu4e-contexts
348           `( ,(make-mu4e-context
349                :name "school"
350                :enter-func (lambda () (mu4e-message "Entering school context"))
351                :leave-func (lambda () (mu4e-message "Leaving school context"))
352                :match-func (lambda (msg)
353                              (when msg
354                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
355                :vars '((user-mail-address . "abhojwani22@nobles.edu")
356                        (mu4e-sent-folder . "/school/Sent")
357                        (mu4e-drafts-folder . "/school/Drafts")
358                        (mu4e-trash-folder . "/school/Trash")
359                        (mu4e-refile-folder . "/school/Archive")
360                        (message-cite-reply-position . above)
361                        (user-mail-address . "abhojwani22@nobles.edu")
362                        (smtpmail-smtp-user . "abhojwani22@nobles.edu")
363                        (smtpmail-smtp-server . "smtp.gmail.com")))
364              ,(make-mu4e-context
365                :name "personal"
366                :enter-func (lambda () (mu4e-message "Entering personal context"))
367                :leave-func (lambda () (mu4e-message "Leaving personal context"))
368                :match-func (lambda (msg)
369                              (when msg
370                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
371                :vars '((mu4e-sent-folder . "/personal/Sent")
372                        (mu4e-drafts-folder . "/personal/Drafts")
373                        (mu4e-trash-folder . "/personal/Trash")
374                        (mu4e-refile-folder . "/personal/Archive")
375                        (user-mail-address . "me@armaanb.net")
376                        (message-cite-reply-position . below)
377                        (smtpmail-smtp-user . "me@armaanb.net")
378                        (smtpmail-smtp-server . "smtp.mailbox.org")))))
379     (add-to-list 'mu4e-bookmarks
380                  '(:name "Unified inbox"
381                          :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
382                          :key ?b))
383     :hook ((mu4e-compose-mode . flyspell-mode)
384            (mu4e-compose-mode . auto-fill-mode)
385            (mu4e-view-mode-hook . turn-on-visual-line-mode)
386            (message-send-hook . (lambda () (unless (yes-or-no-p "Ya sure 'bout that?")
387                                              (signal 'quit nil))))))
388 #+end_src
389 Discourage Gnus from displaying HTML emails
390 #+begin_src emacs-lisp
391   (with-eval-after-load "mm-decode"
392     (add-to-list 'mm-discouraged-alternatives "text/html")
393     (add-to-list 'mm-discouraged-alternatives "text/richtext"))
394 #+end_src
395 ** Default browser
396 Set EWW as default browser except for videos which should open in MPV.
397 #+begin_src emacs-lisp
398   (defun browse-url-mpv (url &optional new-window)
399     "Open URL in MPV."
400     (start-process "mpv" "*mpv*" "mpv" url))
401
402   (setq browse-url-handlers
403         (quote
404          (("youtu\\.?be" . browse-url-mpv)
405           ("peertube.*" . browse-url-mpv)
406           ("vid.*" . browse-url-mpv)
407           ("vid.*" . browse-url-mpv)
408           ("." . eww-browse-url)
409           )))
410 #+end_src
411 ** EWW
412 Some EWW enhancements.
413 *** Give buffer a useful name
414 #+begin_src emacs-lisp
415   ;; From https://protesilaos.com/dotemacs/
416   (defun prot-eww--rename-buffer ()
417     "Rename EWW buffer using page title or URL.
418         To be used by `eww-after-render-hook'."
419     (let ((name (if (eq "" (plist-get eww-data :title))
420                     (plist-get eww-data :url)
421                   (plist-get eww-data :title))))
422       (rename-buffer (format "*%s # eww*" name) t)))
423
424   (use-package eww
425     :straight (:type built-in)
426     :bind (("C-c w" . eww))
427     :hook (eww-after-render-hook prot-eww--rename-buffer))
428 #+end_src
429 *** Keybinding
430 #+begin_src emacs-lisp
431   (global-set-key (kbd "C-c w") 'eww)
432 #+end_src
433 ** IRC
434 Circe is a really nice IRC client that claims to be above RCIRC and below ERC in terms of features. ERC felt a bit messy and finicky to me, and Circe has all the features that I need. This setup gets the password for my bouncer (Pounce) instances via my =~/.authinfo.gpg= file.
435 #+begin_src emacs-lisp
436   (defun fetch-password (&rest params)
437     (require 'auth-source)
438     (let ((match (car (apply 'auth-source-search params))))
439       (if match
440           (let ((secret (plist-get match :secret)))
441             (if (functionp secret)
442                 (funcall secret)
443               secret))
444         (error "Password not found for %S" params))))
445
446   (use-package circe
447     :config
448     (enable-lui-track)
449     (enable-circe-color-nicks)
450     (circe "libera")
451     (circe "oftc")
452     (circe "tilde")
453     (setq circe-networks '(("libera"
454                             :host "irc.armaanb.net"
455                             :nick "emacs"
456                             :user "emacs"
457                             :use-tls t
458                             :port "6698"
459                             :pass (lambda (null) (fetch-password
460                                                   :login "emacs"
461                                                   :machine "irc.armaanb.net"
462                                                   :port 6698)))
463                            ("oftc"
464                             :host "irc.armaanb.net"
465                             :nick "emacs"
466                             :user "emacs"
467                             :use-tls t
468                             :port "6699"
469                             :pass (lambda (null) (fetch-password
470                                                   :login "emacs"
471                                                   :machine "irc.armaanb.net"
472                                                   :port 6699)))
473                            ("tilde"
474                             :host "irc.armaanb.net"
475                             :nick "emacs"
476                             :user "emacs"
477                             :use-tls t
478                             :port "6696"
479                             :pass (lambda (null) (fetch-password
480                                                   :login "emacs"
481                                                   :machine "irc.armaanb.net"
482                                                   :port 6696)))
483                            ))
484     :custom (circe-default-part-message "goodbye!")
485     :bind (:map circe-mode-map ("C-c C-r" . circe-reconnect-all)))
486 #+end_src
487 ** Calendar
488 Still experimenting with this setup. Not sure if I will keep it, but it works well for seeing my calendar events. I use =vdirsyncer= to sync my calendar events which I'm really not happy with.
489 #+begin_src emacs-lisp
490   (defun sync-calendar ()
491     "Sync calendars with vdirsyncer"
492     (interactive)
493     (shell-command "vdirsyncer -vcritical sync"))
494
495   (use-package calfw
496     :bind (:map cfw:calendar-mode-map ("C-S-u" . sync-calendar)))
497   (use-package calfw-ical)
498   (use-package calfw-org)
499
500   (defun acheam-calendar ()
501     "Open calendars"
502     (interactive)
503     (cfw:open-calendar-buffer
504      :contents-sources (list
505                         (cfw:org-create-source "Green")
506                         (cfw:ical-create-source
507                          "Personal"
508                          "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
509                          "Gray")
510                         (cfw:ical-create-source
511                          "Personal"
512                          "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
513                          "Red")
514                         (cfw:ical-create-source
515                          "School"
516                          "~/.local/share/vdirsyncer/school/abhojwani22@nobles.edu.ics"
517                          "Cyan"))
518      :view 'week))
519
520   (global-set-key (kbd "C-c c") 'acheam-calendar)
521 #+end_src
522 * Emacs IDE
523 ** Python formatting
524 #+begin_src emacs-lisp
525   (use-package blacken
526     :hook (python-mode . blacken-mode)
527     :custom (blacken-line-length 79))
528
529 #+end_src
530 ** Strip trailing whitespace
531 #+begin_src emacs-lisp
532   (use-package ws-butler
533     :config (ws-butler-global-mode))
534 #+end_src
535 ** Flycheck
536 Automatic linting. I need to look into configuring this more.
537 #+begin_src emacs-lisp
538   (use-package flycheck
539     :config (global-flycheck-mode))
540 #+end_src
541 ** Project management
542 I never use this, but apparently its very powerful. Another item on my todo list.
543 #+begin_src emacs-lisp
544   (use-package projectile
545     :config (projectile-mode)
546     :custom ((projectile-completion-system 'ivy))
547     :bind-keymap
548     ("C-c p" . projectile-command-map)
549     :init
550     (when (file-directory-p "~/Code")
551       (setq projectile-project-search-path '("~/Code")))
552     (setq projectile-switch-project-action #'projectile-dired))
553
554   (use-package counsel-projectile
555     :after projectile
556     :config (counsel-projectile-mode))
557 #+end_src
558 ** Dired
559 The best file manager!
560 #+begin_src emacs-lisp
561   (use-package dired
562     :straight (:type built-in)
563     :commands (dired dired-jump)
564     :custom ((dired-listing-switches "-agho --group-directories-first"))
565     :config (evil-collection-define-key 'normal 'dired-mode-map
566               "h" 'dired-single-up-directory
567               "l" 'dired-single-buffer))
568
569   (use-package dired-single
570     :commands (dired dired-jump))
571
572   (use-package dired-open
573     :commands (dired dired-jump)
574     :custom (dired-open-extensions '(("png" . "feh")
575                                      ("mkv" . "mpv"))))
576
577   (use-package dired-hide-dotfiles
578     :hook (dired-mode . dired-hide-dotfiles-mode)
579     :config
580     (evil-collection-define-key 'normal 'dired-mode-map
581       "H" 'dired-hide-dotfiles-mode))
582 #+end_src
583 ** Git
584 *** Magit
585 **** TODO Write a command that commits hunk, skipping staging step.
586 A very good Git interface.
587 #+begin_src emacs-lisp
588   (use-package magit)
589 #+end_src
590 *** Email
591 #+begin_src emacs-lisp
592   (use-package piem)
593   (use-package git-email
594     :straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
595     :config (git-email-piem-mode))
596 #+end_src
597 * General text editing
598 ** Indentation
599 Automatically indent after every change. I'm not sure how much I like this. It slows down the editor and code sometimes ends up in a half-indented state meaning I have to manually reformat using "==" anyways.
600 #+begin_src emacs-lisp
601   (use-package aggressive-indent
602     :config (global-aggressive-indent-mode))
603 #+end_src
604 ** Spell checking
605 Spell check in text mode, and in prog-mode comments.
606 #+begin_src emacs-lisp
607   (dolist (hook '(text-mode-hook))
608     (add-hook hook (lambda () (flyspell-mode))))
609   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
610     (add-hook hook (lambda () (flyspell-mode -1))))
611   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
612   (setq ispell-silently-savep t)
613 #+end_src
614 ** Sane tab width
615 #+begin_src emacs-lisp
616   (setq-default tab-width 2)
617 #+end_src
618 ** Save place
619 Opens file where you left it.
620 #+begin_src emacs-lisp
621   (save-place-mode)
622 #+end_src
623 ** Writing mode
624 Distraction free writing a la junegunn/goyo.
625 #+begin_src emacs-lisp
626   (use-package olivetti
627     :bind ("C-c o" . olivetti-mode))
628 #+end_src
629 ** Abbreviations
630 Abbreviate things! I just use this for things like my email address and copyright notice.
631 #+begin_src emacs-lisp
632   (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
633   (setq save-abbrevs 'silent)
634   (setq-default abbrev-mode t)
635 #+end_src
636 ** TRAMP
637 #+begin_src emacs-lisp
638   (setq tramp-default-method "ssh")
639 #+end_src
640 ** Follow version controlled symlinks
641 #+begin_src emacs-lisp
642   (setq vc-follow-symlinks t)
643 #+end_src
644 ** Open file as root
645 #+begin_src emacs-lisp
646   (defun doas-edit (&optional arg)
647     "Edit currently visited file as root.
648
649     With a prefix ARG prompt for a file to visit.
650     Will also prompt for a file to visit if current
651     buffer is not visiting a file.
652
653     Modified from Emacs Redux."
654     (interactive "P")
655     (if (or arg (not buffer-file-name))
656         (find-file (concat "/doas:root@localhost:"
657                            (ido-read-file-name "Find file(as root): ")))
658       (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name))))
659
660     (global-set-key (kbd "C-x C-r") #'doas-edit)
661 #+end_src
662 * Keybindings
663 ** Switch windows
664 #+begin_src emacs-lisp
665   (use-package ace-window
666     :bind ("M-o" . ace-window))
667 #+end_src
668 ** Kill current buffer
669 Makes "C-x k" binding faster.
670 #+begin_src emacs-lisp
671   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
672 #+end_src
673 * Other settings
674 ** OpenSCAD syntax
675 #+begin_src emacs-lisp
676   (use-package scad-mode)
677 #+end_src
678 ** Control backup and lock files
679 Stop backup files from spewing everywhere.
680 #+begin_src emacs-lisp
681   (setq backup-directory-alist `(("." . "~/.emacs.d/backups"))
682         create-lockfiles nil)
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     :custom
712     (epa-file-select-keys nil)
713     (epa-file-encrypt-to '("me@armaanb.net"))
714     (password-cache-expiry (* 60 15)))
715
716   (use-package pinentry
717     :config (pinentry-start))
718 #+end_src
719 ** Pastebin
720 #+begin_src emacs-lisp
721   (use-package 0x0
722     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
723     :custom (0x0-default-service 'envs))
724 #+end_src
725 ** Automatically clean buffers
726 Automatically close unused buffers (except those of Circe) at midnight.
727 #+begin_src emacs-lisp
728   (add-to-list 'clean-buffer-list-kill-never-regexps (lambda (buffer-name)
729                                                        (with-current-buffer buffer-name
730                                                          (derived-mode-p 'lui-mode))))
731   (midnight-mode)
732 #+end_src
733 * Tangles
734 ** Spectrwm
735 Spectrwm is a really awesome window manager! Would highly recommend.
736 *** General settings
737 #+begin_src conf :tangle ~/.spectrwm.conf
738   workspace_limit = 5
739   warp_pointer = 1
740   modkey = Mod4
741   autorun = ws[1]:/home/armaa/Code/scripts/autostart
742 #+end_src
743 *** Bar
744 Disable the bar by default (it can still be brought back up with MOD+b). The font just needs to be set to something that you have installed, otherwise spectrwm won't launch.
745 #+begin_src conf :tangle ~/.spectrwm.conf
746   bar_enabled = 0
747   bar_font = xos4 JetBrains Mono:pixelsize=14:antialias=true # any installed font
748 #+end_src
749 *** Keybindings
750 I'm not a huge fan of how spectrwm handles keybindings, probably my biggest gripe with it.
751 **** WM actions
752 #+begin_src conf :tangle ~/.spectrwm.conf
753   program[term] = st -e tmux
754   program[screenshot_all] = flameshot gui
755   program[notif] = /home/armaa/Code/scripts/setter status
756   program[pass] = /home/armaa/Code/scripts/passmenu
757
758   bind[notif] = MOD+n
759   bind[pass] = MOD+Shift+p
760 #+end_src
761 **** Media keys
762 #+begin_src conf :tangle ~/.spectrwm.conf
763   program[paup] = /home/armaa/Code/scripts/setter audio +5
764   program[padown] = /home/armaa/Code/scripts/setter audio -5
765   program[pamute] = /home/armaa/Code/scripts/setter audio
766   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
767   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
768   program[next] = playerctl next
769   program[prev] = playerctl previous
770   program[pause] = playerctl play-pause
771
772   bind[padown] = XF86AudioLowerVolume
773   bind[paup] = XF86AudioRaiseVolume
774   bind[pamute] = XF86AudioMute
775   bind[brigdown] = XF86MonBrightnessDown
776   bind[brigup] = XF86MonBrightnessUp
777   bind[pause] = XF86AudioPlay
778   bind[next] = XF86AudioNext
779   bind[prev] = XF86AudioPrev
780 #+end_src
781 **** HJKL
782 #+begin_src conf :tangle ~/.spectrwm.conf
783   program[h] = xdotool keyup h key --clearmodifiers Left
784   program[j] = xdotool keyup j key --clearmodifiers Down
785   program[k] = xdotool keyup k key --clearmodifiers Up
786   program[l] = xdotool keyup l key --clearmodifiers Right
787
788   bind[h] = MOD + Control + h
789   bind[j] = MOD + Control + j
790   bind[k] = MOD + Control + k
791   bind[l] = MOD + Control + l
792 #+end_src
793 **** Programs
794 #+begin_src conf :tangle ~/.spectrwm.conf
795   program[email] = emacsclient -c --eval "(mu4e)"
796   program[irc] = emacsclient -c --eval '(switch-to-buffer "irc.armaanb.net:6698")'
797   program[rss] = emacsclient -c --eval '(elfeed)'
798   program[calendar] = emacsclient -c --eval '(acheam-calendar)'
799   program[emacs] = emacsclient -c
800   program[firefox] = firefox
801   program[calc] = st -e bc -l
802
803   bind[email] = MOD+Control+1
804   bind[irc] = MOD+Control+2
805   bind[rss] = MOD+Control+3
806   bind[calendar] = MOD+Control+4
807   bind[calc] = MOD+Control+5
808   bind[firefox] = MOD+Control+0
809   bind[emacs] = MOD+Control+Return
810 #+end_src
811 *** Quirks
812 Float some specific programs by default.
813 #+begin_src conf :tangle ~/.spectrwm.conf
814   quirk[Castle Menu] = FLOAT
815   quirk[momen] = FLOAT
816 #+end_src
817 ** Ash
818 *** Options
819 Use the vi editing mode. I still haven't found a good way to show visual feedback of the current mode. Ideally the cursor would change to a beam when in insert mode, and a box when in normal mode.
820 #+begin_src conf :tangle ~/.config/ash/ashrc
821   set -o vi
822 #+end_src
823 *** Functions
824 **** Update all packages
825 #+begin_src shell :tangle ~/.config/ash/ashrc
826   color=$(tput setaf 5)
827   reset=$(tput sgr0)
828
829   apu() {
830       doas echo "${color}== upgrading with yay ==${reset}"
831       yay
832       echo ""
833       echo "${color}== checking for pacnew files ==${reset}"
834       doas pacdiff
835       echo
836       echo "${color}== upgrading flatpaks ==${reset}"
837       flatpak update
838       echo ""
839       echo "${color}== updating nvim plugins ==${reset}"
840       nvim +PlugUpdate +PlugUpgrade +qall
841       echo "Updated nvim plugins"
842       echo ""
843       echo "${color}You are entirely up to date!${reset}"
844   }
845 #+end_src
846 **** Clean all packages
847 #+begin_src shell :tangle ~/.config/ash/ashrc
848   apap() {
849       doas echo "${color}== cleaning pacman orphans ==${reset}"
850       (pacman -Qtdq | doas pacman -Rns - 2> /dev/null) || echo "No orphans"
851       echo ""
852       echo "${color}== cleaning flatpaks ==${reset}"
853       flatpak remove --unused
854       echo ""
855       echo "${color}== cleaning nvim plugins ==${reset}"
856       nvim +PlugClean +qall
857       echo "Cleaned nvim plugins"
858       echo ""
859       echo "${color}All orphans cleaned!${reset}"
860   }
861 #+end_src
862 **** Interact with 0x0
863 #+begin_src shell :tangle ~/.config/ash/ashrc
864   zxz="https://envs.sh"
865   ufile() { curl -F"file=@$1" "$zxz" ; }
866   upb() { curl -F"file=@-;" "$zxz" ; }
867   uurl() { curl -F"url=$1" "$zxz" ; }
868   ushort() { curl -F"shorten=$1" "$zxz" ; }
869   uclip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
870 #+end_src
871 **** Finger
872 #+begin_src shell :tangle ~/.config/ash/ashrc
873   finger() {
874       user=$(echo "$1" | cut -f 1 -d '@')
875       host=$(echo "$1" | cut -f 2 -d '@')
876       echo $user | nc "$host" 79
877   }
878 #+end_src
879 **** Upload to ftp.armaanb.net
880 #+begin_src shell :tangle ~/.config/ash/ashrc
881   pubup() {
882       rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
883       echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
884   }
885 #+end_src
886 *** Exports
887 #+begin_src shell :tangle ~/.config/ash/ashrc
888   export EDITOR="emacsclient -c"
889   export VISUAL="$EDITOR"
890   export TERM=xterm-256color # for compatability
891
892   export GPG_TTY="$(tty)"
893   export MANPAGER='nvim +Man!'
894   export PAGER='less'
895
896   export GTK_USE_PORTAL=1
897
898   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
899   export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
900   export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
901   export PATH="$PATH:/home/armaa/.cargo/bin"
902   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
903   export PATH="$PATH:/usr/sbin"
904   export PATH="$PATH:/opt/FreeTube/freetube"
905
906   export LC_ALL="en_US.UTF-8"
907   export LC_CTYPE="en_US.UTF-8"
908   export LANGUAGE="en_US.UTF-8"
909
910   export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
911   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
912   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
913   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
914   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
915   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
916 #+end_src
917 *** Aliases
918 **** SSH
919 #+begin_src shell :tangle ~/.config/ash/ashrc
920   alias bhoji-drop='ssh -p 23 root@armaanb.net'
921   alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
922   alias union='ssh 192.168.1.18'
923   alias mine='ssh -p 23 root@pickupserver.cc'
924   alias tcf='ssh root@204.48.23.68'
925   alias ngmun='ssh root@157.245.89.25'
926   alias prox='ssh root@192.168.1.224'
927   alias ncq='ssh root@143.198.123.17'
928   alias envs='ssh acheam@envs.net'
929 #+end_src
930 **** File management
931 #+begin_src shell :tangle ~/.config/ash/ashrc
932   alias ls='ls -lh --group-directories-first'
933   alias la='ls -A'
934   alias df='df -h / /boot'
935   alias du='du -h'
936   alias free='free -h'
937   alias cp='cp -riv'
938   alias rm='rm -iv'
939   alias mv='mv -iv'
940   alias ln='ln -v'
941   alias grep='grep -in --color=auto'
942   alias mkdir='mkdir -pv'
943   alias lanex='java -jar ~/.local/share/lxc/lanxchange.jar'
944   emacs() { $EDITOR "$@" & }
945   alias vim="emacs"
946 #+end_src
947 **** System management
948 #+begin_src shell :tangle ~/.config/ash/ashrc
949   alias crontab='crontab-argh'
950   alias sudo='doas'
951   alias pasu='git -C ~/.password-store push'
952   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
953     yadm push'
954 #+end_src
955 **** Networking
956 #+begin_src shell :tangle ~/.config/ash/ashrc
957   alias ping='ping -c 10'
958   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
959   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
960   alias plan='T=$(mktemp) && \
961         rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
962         TT=$(mktemp) && \
963         head -n -2 $T > $TT && \
964         vim $TT && \
965         echo "\nLast updated: $(date -R)" >> "$TT" && \
966         fold -sw 72 "$TT" > "$T"| \
967         rsync "$T" root@armaanb.net:/etc/finger/plan.txt'
968 #+end_src
969 **** Virtual machines, chroots
970 #+begin_src shell :tangle ~/.config/ash/ashrc
971   alias ckiss="doas chrooter ~/Virtual/kiss"
972   alias cdebian="doas chrooter ~/Virtual/debian bash"
973   alias cwindows='devour qemu-system-x86_64 \
974     -smp 3 \
975     -cpu host \
976     -enable-kvm \
977     -m 3G \
978     -device VGA,vgamem_mb=64 \
979     -device intel-hda \
980     -device hda-duplex \
981     -net nic \
982     -net user,smb=/home/armaa/Public \
983     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
984 #+end_src
985 **** Python
986 #+begin_src shell :tangle ~/.config/ash/ashrc
987   alias pip="python -m pip"
988   alias black="black -l 79"
989 #+end_src
990 **** Latin
991 #+begin_src shell :tangle ~/.config/ash/ashrc
992   alias words='gen-shell -c "words"'
993   alias words-e='gen-shell -c "words ~E"'
994 #+end_src
995 **** Devour
996 #+begin_src shell :tangle ~/.config/ash/ashrc
997   alias zathura='devour zathura'
998   alias cad='devour openscad'
999   alias feh='devour feh'
1000 #+end_src
1001 **** Pacman
1002 #+begin_src shell :tangle ~/.config/ash/ashrc
1003   alias aps='yay -Ss'
1004   alias api='yay -Syu'
1005   alias apii='doas pacman -S'
1006   alias app='yay -Rns'
1007   alias azf='pacman -Q | fzf'
1008   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1009 #+end_src
1010 **** Other
1011 #+begin_src shell :tangle ~/.config/ash/ashrc
1012   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1013     iflag=fullblock status=progress'
1014   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1015     iflag=fullblock status=progress'
1016   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1017     --restrict-filenames -o '%(title)s.%(ext)s'"
1018   alias cal="cal -3 --color=auto"
1019   alias bc='bc -l'
1020 #+end_src
1021 ** IPython
1022 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1023   c.TerminalInteractiveShell.editing_mode = 'vi'
1024   c.InteractiveShell.colors = 'linux'
1025   c.TerminalInteractiveShell.confirm_exit = False
1026 #+end_src
1027 ** MPV
1028 Make MPV play a little bit smoother.
1029 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1030   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1031   hwdec=auto-copy
1032 #+end_src
1033 ** Inputrc
1034 This file is used for any GNU Readline programs. I use Emacs editing mode mostly because of one annoyance which is that to clear the screen using ^L, you have to be in normal mode which is a pain. If there is a way to rebind this, I'd love to know!.
1035 #+begin_src conf :tangle ~/.inputrc
1036   set editing-mode emacs
1037 #+end_src
1038 ** Git
1039 *** User
1040 #+begin_src conf :tangle ~/.gitconfig
1041   [user]
1042   name = Armaan Bhojwani
1043   email = me@armaanb.net
1044   signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1045 #+end_src
1046 *** Init
1047 #+begin_src conf :tangle ~/.gitconfig
1048   [init]
1049   defaultBranch = main
1050 #+end_src
1051 *** GPG
1052 #+begin_src conf :tangle ~/.gitconfig
1053   [gpg]
1054   program = gpg
1055 #+end_src
1056 *** Sendemail
1057 #+begin_src conf :tangle ~/.gitconfig
1058   [sendemail]
1059   smtpserver = smtp.mailbox.org
1060   smtpuser = me@armaanb.net
1061   smtpencryption = ssl
1062   smtpserverport = 465
1063   confirm = auto
1064 #+end_src
1065 *** Submodule
1066 #+begin_src conf :tangle ~/.gitconfig
1067   [submodule]
1068   recurse = true
1069 #+end_src
1070 *** Aliases
1071 #+begin_src conf :tangle ~/.gitconfig
1072   [alias]
1073   stat = diff --stat
1074   sclone = clone --depth 1
1075   sclean = clean -dfX
1076   a = add
1077   aa = add .
1078   c = commit
1079   quickfix = commit . --amend --no-edit
1080   p = push
1081   subup = submodule update --remote
1082   loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1083   pushnc = push -o skip-ci
1084 #+end_src
1085 *** Commit
1086 #+begin_src conf :tangle ~/.gitconfig
1087   [commit]
1088   gpgsign = true
1089   verbose = true
1090 #+end_src
1091 ** Dunst
1092 Lightweight notification daemon. Eventually I'd like to replace this with something dbus-less.
1093 *** General
1094 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1095   [global]
1096   font = "JetBrains Mono Medium Nerd Font 11"
1097   allow_markup = yes
1098   format = "<b>%s</b>\n%b"
1099   sort = no
1100   indicate_hidden = yes
1101   alignment = center
1102   bounce_freq = 0
1103   show_age_threshold = 60
1104   word_wrap = yes
1105   ignore_newline = no
1106   geometry = "400x5-10+10"
1107   transparency = 0
1108   idle_threshold = 120
1109   monitor = 0
1110   sticky_history = yes
1111   line_height = 0
1112   separator_height = 1
1113   padding = 8
1114   horizontal_padding = 8
1115   max_icon_size = 32
1116   separator_color = "#ffffff"
1117   startup_notification = false
1118 #+end_src
1119 *** Modes
1120 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1121   [frame]
1122   width = 1
1123   color = "#ffffff"
1124
1125   [shortcuts]
1126   close = mod4+c
1127   close_all = mod4+shift+c
1128   history = mod4+ctrl+c
1129
1130   [urgency_low]
1131   background = "#222222"
1132   foreground = "#ffffff"
1133   highlight = "#ffffff"
1134   timeout = 5
1135
1136   [urgency_normal]
1137   background = "#222222"
1138   foreground = "#ffffff"
1139   highlight = "#ffffff"
1140   timeout = 15
1141
1142   [urgency_critical]
1143   background = "#222222"
1144   foreground = "#a60000"
1145   highlight = "#ffffff"
1146   timeout = 0
1147 #+end_src
1148 ** Zathura
1149 The best document reader!
1150 *** Options
1151 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1152   map <C-i> recolor
1153   map <A-b> toggle_statusbar
1154   set selection-clipboard clipboard
1155   set scroll-step 200
1156
1157   set window-title-basename "true"
1158   set selection-clipboard "clipboard"
1159 #+end_src
1160 *** Colors
1161 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1162   set default-bg         "#000000"
1163   set default-fg         "#ffffff"
1164   set render-loading     true
1165   set render-loading-bg  "#000000"
1166   set render-loading-fg  "#ffffff"
1167
1168   set recolor-lightcolor "#000000" # bg
1169   set recolor-darkcolor  "#ffffff" # fg
1170   set recolor            "true"
1171 #+end_src
1172 ** Firefox
1173 Just some basic Firefox CSS. Will probably have to rewrite for the Proton redesign.
1174 *** Swap tab and URL bars
1175 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1176   #nav-bar {
1177       -moz-box-ordinal-group: 1 !important;
1178   }
1179
1180   #PersonalToolbar {
1181       -moz-box-ordinal-group: 2 !important;
1182   }
1183
1184   #titlebar {
1185       -moz-box-ordinal-group: 3 !important;
1186   }
1187 #+end_src
1188 *** Hide URL bar when not focused.
1189 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1190   #navigator-toolbox:not(:focus-within):not(:hover) {
1191       margin-top: -30px;
1192   }
1193
1194   #navigator-toolbox {
1195       transition: 0.1s margin-top ease-out;
1196   }
1197 #+end_src
1198 *** Black screen by default
1199 userChrome.css:
1200 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1201   #main-window,
1202   #browser,
1203   #browser vbox#appcontent tabbrowser,
1204   #content,
1205   #tabbrowser-tabpanels,
1206   #tabbrowser-tabbox,
1207   browser[type="content-primary"],
1208   browser[type="content"] > html,
1209   .browserContainer {
1210       background: black !important;
1211       color: #fff !important;
1212   }
1213 #+end_src
1214
1215 userContent.css:
1216 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1217   @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1218       body {
1219           background: black !important;
1220       }
1221   }
1222 #+end_src
1223 ** Xresources
1224 Modus operandi theme. No program I use checks for anything beyond foreground and background, but hey, it can't hurt to have all the colors in there.
1225 #+begin_src conf :tangle ~/.Xresources
1226   ! special
1227   ,*.foreground:   #ffffff
1228   ,*.background:   #000000
1229   ,*.cursorColor:  #ffffff
1230
1231   ! black
1232   ,*.color0:       #000000
1233   ,*.color8:       #555555
1234
1235   ! red
1236   ,*.color1:       #ff8059
1237   ,*.color9:       #ffa0a0
1238
1239   ! green
1240   ,*.color2:       #00fc50
1241   ,*.color10:      #88cf88
1242
1243   ! yellow
1244   ,*.color3:       #eecc00
1245   ,*.color11:      #d2b580
1246
1247   ! blue
1248   ,*.color4:       #29aeff
1249   ,*.color12:      #92baff
1250
1251   ! magenta
1252   ,*.color5:       #feacd0
1253   ,*.color13:      #e0b2d6
1254
1255   ! cyan
1256   ,*.color6:       #00d3d0
1257   ,*.color14:      #a0bfdf
1258
1259   ! white
1260   ,*.color7:       #eeeeee
1261   ,*.color15:      #dddddd
1262 #+end_src
1263 ** Tmux
1264 I use tmux in order to keep my st build light. Still learning how it works.
1265 #+begin_src conf :tangle ~/.tmux.conf
1266   set -g status off
1267   set -g mouse on
1268   set-window-option -g mode-keys vi
1269   bind-key -T copy-mode-vi 'v' send -X begin-selection
1270   bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
1271 #+end_src
1272 ** GPG
1273 *** Config
1274 #+begin_src conf :tangle ~/.gnupg/gpg.conf
1275   default-key 3C9ED82FFE788E4A
1276   use-agent
1277 #+end_src
1278 *** Agent
1279 #+begin_src conf :tangle ~/.gnupg/gpg-agent.conf
1280   pinentry-program /sbin/pinentry-gnome3
1281   max-cache-ttl 600
1282   default-cache-ttl 600
1283   allow-emacs-pinentry
1284 #+end_src