1 #+TITLE: System Configuration
2 #+DESCRIPTION: Personal system configuration in org-mode format.
3 #+AUTHOR: Armaan Bhojwani
4 #+EMAIL: me@armaanb.net
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!
9 I am currently using Emacs 28 with native compilation, so some settings and packages may not be available for older versions of Emacs. This is a purely personal configuration, so while I can guarantee that it works on my setup, it might not work for you.
11 I chose to create a powerful, yet not overly heavy Emacs configuration. Things like a fancy modeline, icons, or LSP mode do not increase my productivity, and create visual clutter, and thus have been excluded.
13 Another important choice has been to integrate Emacs into a large part of my computing environment (see [[*Emacs OS]]). I use email, IRC, RSS, et cetera, all through Emacs which simplifies my workflow and creates an amazingly integrated environment.
15 Lastly, I use Evil mode. Modal keybindings are simpler and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
17 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
18 *** TODO Include offlineimap config
20 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work near their contributions.
22 ** Bootstrap straight.el
23 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
24 #+begin_src emacs-lisp
25 (defvar bootstrap-version)
27 (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
28 (bootstrap-version 5))
29 (unless (file-exists-p bootstrap-file)
31 (url-retrieve-synchronously
32 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
33 'silent 'inhibit-cookies)
34 (goto-char (point-max))
35 (eval-print-last-sexp)))
36 (load bootstrap-file nil 'nomessage))
38 ** Replace package.el with straight
39 #+begin_src emacs-lisp
40 (straight-use-package 'use-package)
41 (setq straight-use-package-by-default t)
45 Use the Modus Operandi theme by Protesilaos Stavrou. Its the best theme for Emacs by far, because how clear and readable it is. It is highly customizable, but I just set a few options here.
46 #+begin_src emacs-lisp
47 (setq modus-themes-slanted-constructs t
48 modus-themes-bold-constructs t
49 modus-themes-mode-line '3d
50 modus-themes-scale-headings t
51 modus-themes-diffs 'desaturated)
52 (load-theme 'modus-vivendi t)
56 JetBrains Mono is a great programming font with ligatures. The "NF" means that it has been patched with the [[https://www.nerdfonts.com/][Nerd Fonts]].
57 #+begin_src emacs-lisp
58 (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
61 #+begin_src emacs-lisp
63 :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
65 (ligature-set-ligatures
66 '(prog-mode text-mode)
67 '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
68 "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
69 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
70 "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
71 "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
72 ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
73 "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
74 "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
75 "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
76 "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
77 "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
78 "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
79 (global-ligature-mode t))
82 Display relative line numbers except in certain modes.
83 #+begin_src emacs-lisp
84 (global-display-line-numbers-mode)
85 (setq display-line-numbers-type 'relative)
86 (dolist (no-line-num '(term-mode-hook
91 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
93 ** Highlight matching parenthesis
94 #+begin_src emacs-lisp
96 :config (show-paren-mode)
97 :custom (show-paren-style 'parenthesis))
100 *** Show current function
101 #+begin_src emacs-lisp
102 (which-function-mode)
104 *** Make position in file more descriptive
105 Show current column and file size.
106 #+begin_src emacs-lisp
108 (size-indication-mode)
111 #+begin_src emacs-lisp
113 :config (minions-mode))
116 Show a ruler at a certain number of chars depending on mode.
117 #+begin_src emacs-lisp
118 (setq display-fill-column-indicator-column 80)
119 (global-display-fill-column-indicator-mode)
122 When starting a key chord, show possible future steps after 0.3 seconds.
123 #+begin_src emacs-lisp
124 (use-package which-key
125 :config (which-key-mode)
126 :custom (which-key-idle-delay 0.3))
128 ** Highlight todo items in comments
129 #+begin_src emacs-lisp
131 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
132 :config (global-hl-todo-mode 1))
135 #+begin_src emacs-lisp
139 Soft wrap words and do operations by visual lines except in programming modes.
140 #+begin_src emacs-lisp
142 (add-hook 'prog-mode-hook 'visual-line-mode 0)
144 ** Display number of matches in search
145 #+begin_src emacs-lisp
147 :config (global-anzu-mode))
150 Invert modeline color instead of audible bell or the standard visual bell.
151 #+begin_src emacs-lisp
152 (setq visible-bell nil
154 (lambda () (invert-face 'mode-line)
155 (run-with-timer 0.1 nil #'invert-face 'mode-line)))
159 #+begin_src emacs-lisp
161 :custom (select-enable-clipboard nil)
164 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
165 ;; Use visual line motions even outside of visual-line-mode buffers
166 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
167 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
168 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
171 Evil bindings for tons of packages.
172 #+begin_src emacs-lisp
173 (use-package evil-collection
175 :init (evil-collection-init)
176 :custom (evil-collection-setup-minibuffer t))
180 #+begin_src emacs-lisp
181 (use-package evil-surround
182 :config (global-evil-surround-mode))
185 Makes commenting super easy
186 #+begin_src emacs-lisp
187 (use-package evil-nerd-commenter
188 :bind (:map evil-normal-state-map
189 ("gc" . evilnc-comment-or-uncomment-lines))
190 :custom (evilnc-invert-comment-line-by-line nil))
194 #+begin_src emacs-lisp
195 (evil-set-undo-system 'undo-redo)
197 ** Number incrementing
198 Add back C-a/C-x bindings.
199 #+begin_src emacs-lisp
200 (use-package evil-numbers
201 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
202 :bind (:map evil-normal-state-map
203 ("C-M-a" . evil-numbers/inc-at-pt)
204 ("C-M-x" . evil-numbers/dec-at-pt)))
207 #+begin_src emacs-lisp
208 (use-package evil-org
210 :hook (org-mode . evil-org-mode)
212 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
214 (use-package evil-org-agenda
215 :straight (:type built-in)
217 :config (evil-org-agenda-set-keys))
221 #+begin_src emacs-lisp
223 :straight (:type built-in)
224 :commands (org-capture org-agenda)
227 (org-agenda-start-with-log-mode t)
228 (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
230 (org-log-into-drawer t)
231 (org-src-tab-acts-natively t)
232 (org-src-fontify-natively t)
233 (org-startup-indented t)
234 (org-hide-emphasis-markers t)
235 (org-fontify-whole-block-delimiter-line nil)
236 :bind ("C-c a" . org-agenda))
239 Define templates for lots of common structure elements. Mostly just used within this file.
240 #+begin_src emacs-lisp
241 (use-package org-tempo
243 :straight (:type built-in)
245 ;; TODO: There's gotta be a more efficient way to write this
246 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
247 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
248 (add-to-list 'org-structure-template-alist '("ash" . "src shell :tangle ~/.config/ash/ashrc"))
249 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
250 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
251 (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
252 (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
253 (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
254 (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
255 (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
256 (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources"))
257 (add-to-list 'org-structure-template-alist '("tm" . "src conf :tangle ~/.tmux.conf"))
258 (add-to-list 'org-structure-template-alist '("gp" . "src conf :tangle ~/.gnupg/gpg.conf"))
259 (add-to-list 'org-structure-template-alist '("ag" . "src conf :tangle ~/.gnupg/gpg-agent.conf")))
263 A well balanced completion framework.
264 #+begin_src emacs-lisp
266 :bind (("C-s" . swiper)
267 :map ivy-minibuffer-map
268 ("TAB" . ivy-alt-done)
269 :map ivy-switch-buffer-map
270 ("M-d" . ivy-switch-buffer-kill))
274 #+begin_src emacs-lisp
275 (use-package ivy-rich
277 :config (ivy-rich-mode))
281 #+begin_src emacs-lisp
283 :bind (("C-M-j" . 'counsel-switch-buffer)
284 :map minibuffer-local-map
285 ("C-r" . 'counsel-minibuffer-history))
286 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
287 :config (counsel-mode))
289 ** Remember frequent commands
290 #+begin_src emacs-lisp
291 (use-package ivy-prescient
293 :custom (ivy-prescient-enable-filtering nil)
295 (prescient-persist-mode)
296 (ivy-prescient-mode))
299 Better search utility.
300 #+begin_src emacs-lisp
305 Use elfeed for reading RSS. I have another file with all the feeds in it that I'd rather keep private.
306 #+begin_src emacs-lisp
308 :bind (("C-c e" . elfeed))
310 (load "~/.emacs.d/feeds.el")
311 (add-hook 'elfeed-new-entry-hook
312 (elfeed-make-tagger :feed-url "youtube\\.com"
314 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
316 (use-package elfeed-goodies
318 :config (elfeed-goodies/setup))
321 Use mu4e for reading emails.
323 I use `offlineimap` to sync my maildirs. It is slower than mbsync, but is fast enough for me, especially when ran with the =-q= option.
325 Contexts are a not very well known feature of mu4e that makes it super easy to manage multiple accounts. Much better than some of the hacky methods and external packages that I've seen.
326 #+begin_src emacs-lisp
327 (use-package smtpmail
328 :straight (:type built-in))
330 :load-path "/usr/share/emacs/site-lisp/mu4e"
331 :straight (:build nil)
332 :bind (("C-c m" . mu4e))
334 (setq user-full-name "Armaan Bhojwani"
335 smtpmail-local-domain "armaanb.net"
336 smtpmail-stream-type 'ssl
337 smtpmail-smtp-service '465
338 mu4e-change-filenames-when-moving t
339 mu4e-get-mail-command "offlineimap -q"
340 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
341 message-citation-line-function 'message-insert-formatted-citation-line
342 mu4e-completing-read-function 'ivy-completing-read
343 mu4e-confirm-quit nil
345 mail-user-agent 'mu4e-user-agent
346 mail-context-policy 'pick-first
348 `( ,(make-mu4e-context
350 :enter-func (lambda () (mu4e-message "Entering school context"))
351 :leave-func (lambda () (mu4e-message "Leaving school context"))
352 :match-func (lambda (msg)
354 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
355 :vars '((user-mail-address . "abhojwani22@nobles.edu")
356 (mu4e-sent-folder . "/school/Sent")
357 (mu4e-drafts-folder . "/school/Drafts")
358 (mu4e-trash-folder . "/school/Trash")
359 (mu4e-refile-folder . "/school/Archive")
360 (message-cite-reply-position . above)
361 (user-mail-address . "abhojwani22@nobles.edu")
362 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
363 (smtpmail-smtp-server . "smtp.gmail.com")))
366 :enter-func (lambda () (mu4e-message "Entering personal context"))
367 :leave-func (lambda () (mu4e-message "Leaving personal context"))
368 :match-func (lambda (msg)
370 (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
371 :vars '((mu4e-sent-folder . "/personal/Sent")
372 (mu4e-drafts-folder . "/personal/Drafts")
373 (mu4e-trash-folder . "/personal/Trash")
374 (mu4e-refile-folder . "/personal/Archive")
375 (user-mail-address . "me@armaanb.net")
376 (message-cite-reply-position . below)
377 (smtpmail-smtp-user . "me@armaanb.net")
378 (smtpmail-smtp-server . "smtp.mailbox.org")))))
379 (add-to-list 'mu4e-bookmarks
380 '(:name "Unified inbox"
381 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
383 :hook ((mu4e-compose-mode . flyspell-mode)
384 (mu4e-compose-mode . auto-fill-mode)
385 (mu4e-view-mode-hook . turn-on-visual-line-mode)
386 (message-send-hook . (lambda () (unless (yes-or-no-p "Ya sure 'bout that?")
387 (signal 'quit nil))))))
389 Discourage Gnus from displaying HTML emails
390 #+begin_src emacs-lisp
391 (with-eval-after-load "mm-decode"
392 (add-to-list 'mm-discouraged-alternatives "text/html")
393 (add-to-list 'mm-discouraged-alternatives "text/richtext"))
396 Set EWW as default browser except for videos which should open in MPV.
397 #+begin_src emacs-lisp
398 (defun browse-url-mpv (url &optional new-window)
400 (start-process "mpv" "*mpv*" "mpv" url))
402 (setq browse-url-handlers
404 (("youtu\\.?be" . browse-url-mpv)
405 ("peertube.*" . browse-url-mpv)
406 ("vid.*" . browse-url-mpv)
407 ("vid.*" . browse-url-mpv)
408 ("." . eww-browse-url)
412 Some EWW enhancements.
413 *** Give buffer a useful name
414 #+begin_src emacs-lisp
415 ;; From https://protesilaos.com/dotemacs/
416 (defun prot-eww--rename-buffer ()
417 "Rename EWW buffer using page title or URL.
418 To be used by `eww-after-render-hook'."
419 (let ((name (if (eq "" (plist-get eww-data :title))
420 (plist-get eww-data :url)
421 (plist-get eww-data :title))))
422 (rename-buffer (format "*%s # eww*" name) t)))
425 :straight (:type built-in)
426 :bind (("C-c w" . eww))
427 :hook (eww-after-render-hook prot-eww--rename-buffer))
430 #+begin_src emacs-lisp
431 (global-set-key (kbd "C-c w") 'eww)
434 Circe is a really nice IRC client that claims to be above RCIRC and below ERC in terms of features. ERC felt a bit messy and finicky to me, and Circe has all the features that I need. This setup gets the password for my bouncer (Pounce) instances via my =~/.authinfo.gpg= file.
435 #+begin_src emacs-lisp
436 (defun fetch-password (&rest params)
437 (require 'auth-source)
438 (let ((match (car (apply 'auth-source-search params))))
440 (let ((secret (plist-get match :secret)))
441 (if (functionp secret)
444 (error "Password not found for %S" params))))
449 (enable-circe-color-nicks)
453 (setq circe-networks '(("libera"
454 :host "irc.armaanb.net"
459 :pass (lambda (null) (fetch-password
461 :machine "irc.armaanb.net"
464 :host "irc.armaanb.net"
469 :pass (lambda (null) (fetch-password
471 :machine "irc.armaanb.net"
474 :host "irc.armaanb.net"
479 :pass (lambda (null) (fetch-password
481 :machine "irc.armaanb.net"
484 :custom (circe-default-part-message "goodbye!")
485 :bind (:map circe-mode-map ("C-c C-r" . circe-reconnect-all)))
488 Still experimenting with this setup. Not sure if I will keep it, but it works well for seeing my calendar events. I use =vdirsyncer= to sync my calendar events which I'm really not happy with.
489 #+begin_src emacs-lisp
490 (defun sync-calendar ()
491 "Sync calendars with vdirsyncer"
493 (shell-command "vdirsyncer -vcritical sync"))
496 :bind (:map cfw:calendar-mode-map ("C-S-u" . sync-calendar)))
497 (use-package calfw-ical)
498 (use-package calfw-org)
500 (defun acheam-calendar ()
503 (cfw:open-calendar-buffer
504 :contents-sources (list
505 (cfw:org-create-source "Green")
506 (cfw:ical-create-source
508 "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
510 (cfw:ical-create-source
512 "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
514 (cfw:ical-create-source
516 "~/.local/share/vdirsyncer/school/abhojwani22@nobles.edu.ics"
520 (global-set-key (kbd "C-c c") 'acheam-calendar)
524 #+begin_src emacs-lisp
526 :hook (python-mode . blacken-mode)
527 :custom (blacken-line-length 79))
530 ** Strip trailing whitespace
531 #+begin_src emacs-lisp
532 (use-package ws-butler
533 :config (ws-butler-global-mode))
536 Automatic linting. I need to look into configuring this more.
537 #+begin_src emacs-lisp
538 (use-package flycheck
539 :config (global-flycheck-mode))
541 ** Project management
542 I never use this, but apparently its very powerful. Another item on my todo list.
543 #+begin_src emacs-lisp
544 (use-package projectile
545 :config (projectile-mode)
546 :custom ((projectile-completion-system 'ivy))
548 ("C-c p" . projectile-command-map)
550 (when (file-directory-p "~/Code")
551 (setq projectile-project-search-path '("~/Code")))
552 (setq projectile-switch-project-action #'projectile-dired))
554 (use-package counsel-projectile
556 :config (counsel-projectile-mode))
559 The best file manager!
560 #+begin_src emacs-lisp
562 :straight (:type built-in)
563 :commands (dired dired-jump)
564 :custom ((dired-listing-switches "-agho --group-directories-first"))
565 :config (evil-collection-define-key 'normal 'dired-mode-map
566 "h" 'dired-single-up-directory
567 "l" 'dired-single-buffer))
569 (use-package dired-single
570 :commands (dired dired-jump))
572 (use-package dired-open
573 :commands (dired dired-jump)
574 :custom (dired-open-extensions '(("png" . "feh")
577 (use-package dired-hide-dotfiles
578 :hook (dired-mode . dired-hide-dotfiles-mode)
580 (evil-collection-define-key 'normal 'dired-mode-map
581 "H" 'dired-hide-dotfiles-mode))
585 **** TODO Write a command that commits hunk, skipping staging step.
586 A very good Git interface.
587 #+begin_src emacs-lisp
591 #+begin_src emacs-lisp
593 (use-package git-email
594 :straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
595 :config (git-email-piem-mode))
597 * General text editing
599 Automatically indent after every change. I'm not sure how much I like this. It slows down the editor and code sometimes ends up in a half-indented state meaning I have to manually reformat using "==" anyways.
600 #+begin_src emacs-lisp
601 (use-package aggressive-indent
602 :config (global-aggressive-indent-mode))
605 Spell check in text mode, and in prog-mode comments.
606 #+begin_src emacs-lisp
607 (dolist (hook '(text-mode-hook))
608 (add-hook hook (lambda () (flyspell-mode))))
609 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
610 (add-hook hook (lambda () (flyspell-mode -1))))
611 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
612 (setq ispell-silently-savep t)
615 #+begin_src emacs-lisp
616 (setq-default tab-width 2)
619 Opens file where you left it.
620 #+begin_src emacs-lisp
624 Distraction free writing a la junegunn/goyo.
625 #+begin_src emacs-lisp
626 (use-package olivetti
627 :bind ("C-c o" . olivetti-mode))
630 Abbreviate things! I just use this for things like my email address and copyright notice.
631 #+begin_src emacs-lisp
632 (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
633 (setq save-abbrevs 'silent)
634 (setq-default abbrev-mode t)
637 #+begin_src emacs-lisp
638 (setq tramp-default-method "ssh")
640 ** Follow version controlled symlinks
641 #+begin_src emacs-lisp
642 (setq vc-follow-symlinks t)
645 #+begin_src emacs-lisp
646 (defun doas-edit (&optional arg)
647 "Edit currently visited file as root.
649 With a prefix ARG prompt for a file to visit.
650 Will also prompt for a file to visit if current
651 buffer is not visiting a file.
653 Modified from Emacs Redux."
655 (if (or arg (not buffer-file-name))
656 (find-file (concat "/doas:root@localhost:"
657 (ido-read-file-name "Find file(as root): ")))
658 (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name))))
660 (global-set-key (kbd "C-x C-r") #'doas-edit)
664 #+begin_src emacs-lisp
665 (use-package ace-window
666 :bind ("M-o" . ace-window))
668 ** Kill current buffer
669 Makes "C-x k" binding faster.
670 #+begin_src emacs-lisp
671 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
675 #+begin_src emacs-lisp
676 (use-package scad-mode)
678 ** Control backup and lock files
679 Stop backup files from spewing everywhere.
680 #+begin_src emacs-lisp
681 (setq backup-directory-alist `(("." . "~/.emacs.d/backups"))
682 create-lockfiles nil)
684 ** Make yes/no easier
685 #+begin_src emacs-lisp
686 (defalias 'yes-or-no-p 'y-or-n-p)
688 ** Move customize file
689 No more clogging up init.el.
690 #+begin_src emacs-lisp
691 (setq custom-file "~/.emacs.d/custom.el")
695 #+begin_src emacs-lisp
697 :commands (helpful-callable helpful-variable helpful-command helpful-key)
699 (counsel-describe-function-function #'helpful-callable)
700 (counsel-describe-variable-function #'helpful-variable)
702 ([remap describe-function] . counsel-describe-function)
703 ([remap describe-command] . helpful-command)
704 ([remap describe-variable] . counsel-describe-variable)
705 ([remap describe-key] . helpful-key))
708 #+begin_src emacs-lisp
709 (use-package epa-file
710 :straight (:type built-in)
712 (epa-file-select-keys nil)
713 (epa-file-encrypt-to '("me@armaanb.net"))
714 (password-cache-expiry (* 60 15)))
716 (use-package pinentry
717 :config (pinentry-start))
720 #+begin_src emacs-lisp
722 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
723 :custom (0x0-default-service 'envs))
725 ** Automatically clean buffers
726 Automatically close unused buffers (except those of Circe) at midnight.
727 #+begin_src emacs-lisp
728 (add-to-list 'clean-buffer-list-kill-never-regexps (lambda (buffer-name)
729 (with-current-buffer buffer-name
730 (derived-mode-p 'lui-mode))))
735 Spectrwm is a really awesome window manager! Would highly recommend.
737 #+begin_src conf :tangle ~/.spectrwm.conf
741 autorun = ws[1]:/home/armaa/Code/scripts/autostart
744 Disable the bar by default (it can still be brought back up with MOD+b). The font just needs to be set to something that you have installed, otherwise spectrwm won't launch.
745 #+begin_src conf :tangle ~/.spectrwm.conf
747 bar_font = xos4 JetBrains Mono:pixelsize=14:antialias=true # any installed font
750 I'm not a huge fan of how spectrwm handles keybindings, probably my biggest gripe with it.
752 #+begin_src conf :tangle ~/.spectrwm.conf
753 program[term] = st -e tmux
754 program[screenshot_all] = flameshot gui
755 program[notif] = /home/armaa/Code/scripts/setter status
756 program[pass] = /home/armaa/Code/scripts/passmenu
759 bind[pass] = MOD+Shift+p
762 #+begin_src conf :tangle ~/.spectrwm.conf
763 program[paup] = /home/armaa/Code/scripts/setter audio +5
764 program[padown] = /home/armaa/Code/scripts/setter audio -5
765 program[pamute] = /home/armaa/Code/scripts/setter audio
766 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
767 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
768 program[next] = playerctl next
769 program[prev] = playerctl previous
770 program[pause] = playerctl play-pause
772 bind[padown] = XF86AudioLowerVolume
773 bind[paup] = XF86AudioRaiseVolume
774 bind[pamute] = XF86AudioMute
775 bind[brigdown] = XF86MonBrightnessDown
776 bind[brigup] = XF86MonBrightnessUp
777 bind[pause] = XF86AudioPlay
778 bind[next] = XF86AudioNext
779 bind[prev] = XF86AudioPrev
782 #+begin_src conf :tangle ~/.spectrwm.conf
783 program[h] = xdotool keyup h key --clearmodifiers Left
784 program[j] = xdotool keyup j key --clearmodifiers Down
785 program[k] = xdotool keyup k key --clearmodifiers Up
786 program[l] = xdotool keyup l key --clearmodifiers Right
788 bind[h] = MOD + Control + h
789 bind[j] = MOD + Control + j
790 bind[k] = MOD + Control + k
791 bind[l] = MOD + Control + l
794 #+begin_src conf :tangle ~/.spectrwm.conf
795 program[email] = emacsclient -c --eval "(mu4e)"
796 program[irc] = emacsclient -c --eval '(switch-to-buffer "irc.armaanb.net:6698")'
797 program[rss] = emacsclient -c --eval '(elfeed)'
798 program[calendar] = emacsclient -c --eval '(acheam-calendar)'
799 program[emacs] = emacsclient -c
800 program[firefox] = firefox
801 program[calc] = st -e bc -l
803 bind[email] = MOD+Control+1
804 bind[irc] = MOD+Control+2
805 bind[rss] = MOD+Control+3
806 bind[calendar] = MOD+Control+4
807 bind[calc] = MOD+Control+5
808 bind[firefox] = MOD+Control+0
809 bind[emacs] = MOD+Control+Return
812 Float some specific programs by default.
813 #+begin_src conf :tangle ~/.spectrwm.conf
814 quirk[Castle Menu] = FLOAT
819 Use the vi editing mode. I still haven't found a good way to show visual feedback of the current mode. Ideally the cursor would change to a beam when in insert mode, and a box when in normal mode.
820 #+begin_src conf :tangle ~/.config/ash/ashrc
824 **** Update all packages
825 #+begin_src shell :tangle ~/.config/ash/ashrc
826 color=$(tput setaf 5)
830 doas echo "${color}== upgrading with yay ==${reset}"
833 echo "${color}== checking for pacnew files ==${reset}"
836 echo "${color}== upgrading flatpaks ==${reset}"
839 echo "${color}== updating nvim plugins ==${reset}"
840 nvim +PlugUpdate +PlugUpgrade +qall
841 echo "Updated nvim plugins"
843 echo "${color}You are entirely up to date!${reset}"
846 **** Clean all packages
847 #+begin_src shell :tangle ~/.config/ash/ashrc
849 doas echo "${color}== cleaning pacman orphans ==${reset}"
850 (pacman -Qtdq | doas pacman -Rns - 2> /dev/null) || echo "No orphans"
852 echo "${color}== cleaning flatpaks ==${reset}"
853 flatpak remove --unused
855 echo "${color}== cleaning nvim plugins ==${reset}"
856 nvim +PlugClean +qall
857 echo "Cleaned nvim plugins"
859 echo "${color}All orphans cleaned!${reset}"
862 **** Interact with 0x0
863 #+begin_src shell :tangle ~/.config/ash/ashrc
864 zxz="https://envs.sh"
865 ufile() { curl -F"file=@$1" "$zxz" ; }
866 upb() { curl -F"file=@-;" "$zxz" ; }
867 uurl() { curl -F"url=$1" "$zxz" ; }
868 ushort() { curl -F"shorten=$1" "$zxz" ; }
869 uclip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
872 #+begin_src shell :tangle ~/.config/ash/ashrc
874 user=$(echo "$1" | cut -f 1 -d '@')
875 host=$(echo "$1" | cut -f 2 -d '@')
876 echo $user | nc "$host" 79
879 **** Upload to ftp.armaanb.net
880 #+begin_src shell :tangle ~/.config/ash/ashrc
882 rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
883 echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
887 #+begin_src shell :tangle ~/.config/ash/ashrc
888 export EDITOR="emacsclient -c"
889 export VISUAL="$EDITOR"
890 export TERM=xterm-256color # for compatability
892 export GPG_TTY="$(tty)"
893 export MANPAGER='nvim +Man!'
896 export GTK_USE_PORTAL=1
898 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
899 export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
900 export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
901 export PATH="$PATH:/home/armaa/.cargo/bin"
902 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
903 export PATH="$PATH:/usr/sbin"
904 export PATH="$PATH:/opt/FreeTube/freetube"
906 export LC_ALL="en_US.UTF-8"
907 export LC_CTYPE="en_US.UTF-8"
908 export LANGUAGE="en_US.UTF-8"
910 export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
911 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
912 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
913 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
914 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
915 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
919 #+begin_src shell :tangle ~/.config/ash/ashrc
920 alias bhoji-drop='ssh -p 23 root@armaanb.net'
921 alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
922 alias union='ssh 192.168.1.18'
923 alias mine='ssh -p 23 root@pickupserver.cc'
924 alias tcf='ssh root@204.48.23.68'
925 alias ngmun='ssh root@157.245.89.25'
926 alias prox='ssh root@192.168.1.224'
927 alias ncq='ssh root@143.198.123.17'
928 alias envs='ssh acheam@envs.net'
931 #+begin_src shell :tangle ~/.config/ash/ashrc
932 alias ls='ls -lh --group-directories-first'
934 alias df='df -h / /boot'
941 alias grep='grep -in --color=auto'
942 alias mkdir='mkdir -pv'
943 alias lanex='java -jar ~/.local/share/lxc/lanxchange.jar'
944 emacs() { $EDITOR "$@" & }
947 **** System management
948 #+begin_src shell :tangle ~/.config/ash/ashrc
949 alias crontab='crontab-argh'
951 alias pasu='git -C ~/.password-store push'
952 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
956 #+begin_src shell :tangle ~/.config/ash/ashrc
957 alias ping='ping -c 10'
958 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
959 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
960 alias plan='T=$(mktemp) && \
961 rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
963 head -n -2 $T > $TT && \
965 echo "\nLast updated: $(date -R)" >> "$TT" && \
966 fold -sw 72 "$TT" > "$T"| \
967 rsync "$T" root@armaanb.net:/etc/finger/plan.txt'
969 **** Virtual machines, chroots
970 #+begin_src shell :tangle ~/.config/ash/ashrc
971 alias ckiss="doas chrooter ~/Virtual/kiss"
972 alias cdebian="doas chrooter ~/Virtual/debian bash"
973 alias cwindows='devour qemu-system-x86_64 \
978 -device VGA,vgamem_mb=64 \
982 -net user,smb=/home/armaa/Public \
983 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
986 #+begin_src shell :tangle ~/.config/ash/ashrc
987 alias pip="python -m pip"
988 alias black="black -l 79"
991 #+begin_src shell :tangle ~/.config/ash/ashrc
992 alias words='gen-shell -c "words"'
993 alias words-e='gen-shell -c "words ~E"'
996 #+begin_src shell :tangle ~/.config/ash/ashrc
997 alias zathura='devour zathura'
998 alias cad='devour openscad'
999 alias feh='devour feh'
1002 #+begin_src shell :tangle ~/.config/ash/ashrc
1004 alias api='yay -Syu'
1005 alias apii='doas pacman -S'
1006 alias app='yay -Rns'
1007 alias azf='pacman -Q | fzf'
1008 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1011 #+begin_src shell :tangle ~/.config/ash/ashrc
1012 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1013 iflag=fullblock status=progress'
1014 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1015 iflag=fullblock status=progress'
1016 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
1017 --restrict-filenames -o '%(title)s.%(ext)s'"
1018 alias cal="cal -3 --color=auto"
1022 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1023 c.TerminalInteractiveShell.editing_mode = 'vi'
1024 c.InteractiveShell.colors = 'linux'
1025 c.TerminalInteractiveShell.confirm_exit = False
1028 Make MPV play a little bit smoother.
1029 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1030 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1034 This file is used for any GNU Readline programs. I use Emacs editing mode mostly because of one annoyance which is that to clear the screen using ^L, you have to be in normal mode which is a pain. If there is a way to rebind this, I'd love to know!.
1035 #+begin_src conf :tangle ~/.inputrc
1036 set editing-mode emacs
1040 #+begin_src conf :tangle ~/.gitconfig
1042 name = Armaan Bhojwani
1043 email = me@armaanb.net
1044 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1047 #+begin_src conf :tangle ~/.gitconfig
1049 defaultBranch = main
1052 #+begin_src conf :tangle ~/.gitconfig
1057 #+begin_src conf :tangle ~/.gitconfig
1059 smtpserver = smtp.mailbox.org
1060 smtpuser = me@armaanb.net
1061 smtpencryption = ssl
1062 smtpserverport = 465
1066 #+begin_src conf :tangle ~/.gitconfig
1071 #+begin_src conf :tangle ~/.gitconfig
1074 sclone = clone --depth 1
1079 quickfix = commit . --amend --no-edit
1081 subup = submodule update --remote
1082 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1083 pushnc = push -o skip-ci
1086 #+begin_src conf :tangle ~/.gitconfig
1092 Lightweight notification daemon. Eventually I'd like to replace this with something dbus-less.
1094 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1096 font = "JetBrains Mono Medium Nerd Font 11"
1098 format = "<b>%s</b>\n%b"
1100 indicate_hidden = yes
1103 show_age_threshold = 60
1106 geometry = "400x5-10+10"
1108 idle_threshold = 120
1110 sticky_history = yes
1112 separator_height = 1
1114 horizontal_padding = 8
1116 separator_color = "#ffffff"
1117 startup_notification = false
1120 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1127 close_all = mod4+shift+c
1128 history = mod4+ctrl+c
1131 background = "#222222"
1132 foreground = "#ffffff"
1133 highlight = "#ffffff"
1137 background = "#222222"
1138 foreground = "#ffffff"
1139 highlight = "#ffffff"
1143 background = "#222222"
1144 foreground = "#a60000"
1145 highlight = "#ffffff"
1149 The best document reader!
1151 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1153 map <A-b> toggle_statusbar
1154 set selection-clipboard clipboard
1157 set window-title-basename "true"
1158 set selection-clipboard "clipboard"
1161 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1162 set default-bg "#000000"
1163 set default-fg "#ffffff"
1164 set render-loading true
1165 set render-loading-bg "#000000"
1166 set render-loading-fg "#ffffff"
1168 set recolor-lightcolor "#000000" # bg
1169 set recolor-darkcolor "#ffffff" # fg
1173 Just some basic Firefox CSS. Will probably have to rewrite for the Proton redesign.
1174 *** Swap tab and URL bars
1175 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1177 -moz-box-ordinal-group: 1 !important;
1181 -moz-box-ordinal-group: 2 !important;
1185 -moz-box-ordinal-group: 3 !important;
1188 *** Hide URL bar when not focused.
1189 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1190 #navigator-toolbox:not(:focus-within):not(:hover) {
1194 #navigator-toolbox {
1195 transition: 0.1s margin-top ease-out;
1198 *** Black screen by default
1200 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1203 #browser vbox#appcontent tabbrowser,
1205 #tabbrowser-tabpanels,
1207 browser[type="content-primary"],
1208 browser[type="content"] > html,
1210 background: black !important;
1211 color: #fff !important;
1216 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1217 @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1219 background: black !important;
1224 Modus operandi theme. No program I use checks for anything beyond foreground and background, but hey, it can't hurt to have all the colors in there.
1225 #+begin_src conf :tangle ~/.Xresources
1227 ,*.foreground: #ffffff
1228 ,*.background: #000000
1229 ,*.cursorColor: #ffffff
1264 I use tmux in order to keep my st build light. Still learning how it works.
1265 #+begin_src conf :tangle ~/.tmux.conf
1268 set-window-option -g mode-keys vi
1269 bind-key -T copy-mode-vi 'v' send -X begin-selection
1270 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
1274 #+begin_src conf :tangle ~/.gnupg/gpg.conf
1275 default-key 3C9ED82FFE788E4A
1279 #+begin_src conf :tangle ~/.gnupg/gpg-agent.conf
1280 pinentry-program /sbin/pinentry-gnome3
1282 default-cache-ttl 600
1283 allow-emacs-pinentry