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