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