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 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.
19 ** Bootstrap straight.el
20 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
21 #+begin_src emacs-lisp
22 (defvar native-comp-deferred-compilation-deny-list ())
23 (defvar bootstrap-version)
25 (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
26 (bootstrap-version 5))
27 (unless (file-exists-p bootstrap-file)
29 (url-retrieve-synchronously
30 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
31 'silent 'inhibit-cookies)
32 (goto-char (point-max))
33 (eval-print-last-sexp)))
34 (load bootstrap-file nil 'nomessage))
36 ** Replace package.el with straight
37 #+begin_src emacs-lisp
38 (straight-use-package 'use-package)
39 (setq straight-use-package-by-default t)
43 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.
44 #+begin_src emacs-lisp
45 (use-package modus-themes
47 (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 :config (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
92 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
94 ** Highlight matching parenthesis
95 #+begin_src emacs-lisp
97 :config (show-paren-mode)
98 :custom (show-paren-style 'parenthesis))
101 *** Show current function
102 #+begin_src emacs-lisp
103 (which-function-mode)
105 *** Make position in file more descriptive
106 Show current column and file size.
107 #+begin_src emacs-lisp
109 (size-indication-mode)
112 #+begin_src emacs-lisp
114 :config (minions-mode))
117 Highlight whitespace and other bad text practices.
118 #+begin_src emacs-lisp
119 (use-package whitespace
120 :custom (whitespace-style '(face lines-tail)))
121 (dolist (hook '(prog-mode-hook))
122 (add-hook hook (lambda () (whitespace-mode 1))))
124 ** Highlight todo items in comments
125 +begin_src emacs-lisp
127 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
128 :config (global-hl-todo-mode 1))
131 #+begin_src emacs-lisp
135 Soft wrap words and do operations by visual lines in some modes.
136 #+begin_src emacs-lisp
137 (dolist (hook '(text-mode-hook
140 mu4e-view-mode-hook))
141 (add-hook hook (lambda () (visual-line-mode 1))))
144 #+begin_src emacs-lisp
145 (dolist (hook '(scdoc-mode-hook
146 mu4e-compose-mode-hook))
147 (add-hook hook (lambda () (auto-fill-mode 1))))
149 ** Display number of matches in search
150 #+begin_src emacs-lisp
152 :config (global-anzu-mode)
154 ([remap query-replace] . anzu-query-replace)
155 ([remap query-replace-regexp] . anzu-query-replace-regexp))
157 *** TODO This config doesn't work right
159 Invert modeline color instead of audible bell or the standard visual bell.
160 #+begin_src emacs-lisp
161 (setq visible-bell nil
163 (lambda () (invert-face 'mode-line)
164 (run-with-timer 0.1 nil #'invert-face 'mode-line)))
168 #+begin_src emacs-lisp
170 :custom (select-enable-clipboard nil)
173 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
174 ;; Use visual line motions even outside of visual-line-mode buffers
175 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
176 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
177 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
180 Evil bindings for tons of packages.
181 #+begin_src emacs-lisp
182 (use-package evil-collection
184 :init (evil-collection-init)
185 :custom (evil-collection-setup-minibuffer t))
189 #+begin_src emacs-lisp
190 (use-package evil-surround
191 :config (global-evil-surround-mode))
194 Makes commenting super easy
195 #+begin_src emacs-lisp
196 (use-package evil-nerd-commenter
197 :bind (:map evil-normal-state-map
198 ("gc" . evilnc-comment-or-uncomment-lines))
199 :custom (evilnc-invert-comment-line-by-line nil))
203 #+begin_src emacs-lisp
204 (evil-set-undo-system 'undo-redo)
206 ** Number incrementing
207 Add back C-a/C-x bindings.
208 #+begin_src emacs-lisp
209 (use-package evil-numbers
210 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
211 :bind (:map evil-normal-state-map
212 ("C-M-a" . evil-numbers/inc-at-pt)
213 ("C-M-x" . evil-numbers/dec-at-pt)))
216 #+begin_src emacs-lisp
217 (use-package evil-org
219 :hook (org-mode . evil-org-mode)
221 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
223 (use-package evil-org-agenda
224 :straight (:type built-in)
226 :config (evil-org-agenda-set-keys))
230 #+begin_src emacs-lisp
232 :straight (:type built-in)
233 :commands (org-capture org-agenda)
235 (org-ellipsis " â–¾")
236 (org-agenda-start-with-log-mode t)
237 (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
239 (org-log-into-drawer t)
240 (org-src-tab-acts-natively t)
241 (org-src-fontify-natively t)
242 (org-startup-indented t)
243 (org-hide-emphasis-markers t)
244 (org-fontify-whole-block-delimiter-line nil)
245 (org-archive-default-command 'org-archive-to-archive-sibling)
247 ("C-c a" . org-agenda)
248 (:map evil-normal-state-map ("ga" . org-archive-subtree-default)))
251 Define templates for lots of common structure elements. Mostly just used within this file.
252 #+begin_src emacs-lisp
253 (use-package org-tempo
255 :straight (:type built-in)
257 (dolist (addition '(("el" . "src emacs-lisp")
258 ("el" . "src emacs-lisp")
259 ("sp" . "src conf :tangle ~/.spectrwm.conf")
260 ("ash" . "src shell :tangle ~/.config/ash/ashrc")
261 ("pi" . "src conf :tangle ~/.config/picom/picom.conf")
262 ("git" . "src conf :tangle ~/.gitconfig")
263 ("du" . "src conf :tangle ~/.config/dunst/dunstrc")
264 ("za" . "src conf :tangle ~/.config/zathura/zathurarc")
265 ("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css")
266 ("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css")
267 ("xr" . "src conf :tangle ~/.Xresources")
268 ("tm" . "src conf :tangle ~/.tmux.conf")
269 ("gp" . "src conf :tangle ~/.gnupg/gpg.conf")
270 ("ag" . "src conf :tangle ~/.gnupg/gpg-agent.conf")
271 ("xm" . "src conf :tangle ~/.config/xmodmap")))
272 (add-to-list 'org-structure-template-alist addition)))
276 A well balanced completion framework.
277 #+begin_src emacs-lisp
279 :bind (:map ivy-minibuffer-map
280 ("TAB" . ivy-alt-done))
281 (:map ivy-switch-buffer-map
282 ("M-d" . ivy-switch-buffer-kill))
286 #+begin_src emacs-lisp
287 (use-package ivy-rich
289 :config (ivy-rich-mode))
293 #+begin_src emacs-lisp
295 :bind ("C-M-j" . 'counsel-switch-buffer)
296 :config (counsel-mode))
298 ** Remember frequent commands
299 #+begin_src emacs-lisp
300 (use-package ivy-prescient
303 (prescient-persist-mode)
304 (ivy-prescient-mode))
308 Use elfeed for reading RSS. I have another file with all the feeds in it that I'd rather keep private.
309 #+begin_src emacs-lisp
311 :bind (("C-c e" . elfeed))
312 :config (load "~/.emacs.d/feeds.el")
313 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
316 Use mu4e for reading emails.
317 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.
318 *** TODO Switch to mbsync
319 =offlineimap= really crappy (slow and requires python2), and I need to replace it with =mbsync=.
320 *** TODO Include mbsync/offlineimap config
321 *** TODO Split up and document this config a bit
323 #+begin_src emacs-lisp
324 (use-package smtpmail
325 :straight (:type built-in))
327 :load-path "/usr/share/emacs/site-lisp/mu4e"
328 :straight (:build nil)
329 :bind (("C-c m" . mu4e))
331 (setq user-full-name "Armaan Bhojwani"
332 smtpmail-local-domain "armaanb.net"
333 smtpmail-stream-type 'ssl
334 smtpmail-smtp-service '465
335 mu4e-change-filenames-when-moving t
336 mu4e-get-mail-command "offlineimap -q"
337 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
338 message-citation-line-function 'message-insert-formatted-citation-line
339 mu4e-completing-read-function 'ivy-completing-read
340 mu4e-confirm-quit nil
342 mail-user-agent 'mu4e-user-agent
343 mu4e-context-policy 'pick-first
345 `( ,(make-mu4e-context
347 :enter-func (lambda () (mu4e-message "Entering school context"))
348 :leave-func (lambda () (mu4e-message "Leaving school context"))
349 :match-func (lambda (msg)
351 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
352 :vars '((user-mail-address . "abhojwani22@nobles.edu")
353 (mu4e-sent-folder . "/school/Sent")
354 (mu4e-drafts-folder . "/school/Drafts")
355 (mu4e-trash-folder . "/school/Trash")
356 (mu4e-refile-folder . "/school/Archive")
357 (message-cite-reply-position . above)
358 (user-mail-address . "abhojwani22@nobles.edu")
359 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
360 (smtpmail-smtp-server . "smtp.gmail.com")))
363 :enter-func (lambda () (mu4e-message "Entering personal context"))
364 :leave-func (lambda () (mu4e-message "Leaving personal context"))
365 :match-func (lambda (msg)
367 (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
368 :vars '((mu4e-sent-folder . "/personal/Sent")
369 (mu4e-drafts-folder . "/personal/Drafts")
370 (mu4e-trash-folder . "/personal/Trash")
371 (mu4e-refile-folder . "/personal/Archive")
372 (user-mail-address . "me@armaanb.net")
373 (message-cite-reply-position . below)
374 (smtpmail-smtp-user . "me@armaanb.net")
375 (smtpmail-smtp-server . "smtp.mailbox.org")))))
376 (add-to-list 'mu4e-bookmarks
377 '(:name "Unified inbox"
378 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
380 :hook ((mu4e-compose-mode . flyspell-mode)
381 (message-send-hook . (lambda () (unless (yes-or-no-p "Ya sure 'bout that?")
382 (signal 'quit nil))))))
384 *** Discourage Gnus from displaying HTML emails
385 #+begin_src emacs-lisp
386 (with-eval-after-load "mm-decode"
387 (add-to-list 'mm-discouraged-alternatives "text/html")
388 (add-to-list 'mm-discouraged-alternatives "text/richtext"))
391 Set EWW as default browser except for multimedia which should open in MPV.
392 #+begin_src emacs-lisp
393 (defun browse-url-mpv (url &optional new-window)
394 "Ask MPV to load URL."
396 (start-process "mpv" "*mpv*" "mpv" url))
398 (setq browse-url-handlers
400 (("youtu\\.?be" . browse-url-mpv)
401 ("peertube.*" . browse-url-mpv)
402 ("vid.*" . browse-url-mpv)
403 ("vid.*" . browse-url-mpv)
404 ("*.mp4" . browse-url-mpv)
405 ("*.mp3" . browse-url-mpv)
406 ("*.ogg" . browse-url-mpv)
407 ("." . eww-browse-url)
411 Some EWW enhancements.
412 *** Give buffer a useful name
413 #+begin_src emacs-lisp
414 ;; From https://protesilaos.com/dotemacs/
415 (defun prot-eww--rename-buffer ()
416 "Rename EWW buffer using page title or URL.
417 To be used by `eww-after-render-hook'."
418 (let ((name (if (eq "" (plist-get eww-data :title))
419 (plist-get eww-data :url)
420 (plist-get eww-data :title))))
421 (rename-buffer (format "*%s # eww*" name) t)))
424 :straight (:type built-in)
425 :bind (("C-c w" . eww))
426 :hook (eww-after-render-hook prot-eww--rename-buffer))
429 #+begin_src emacs-lisp
430 (global-set-key (kbd "C-c w") 'eww)
433 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.
434 #+begin_src emacs-lisp
435 (defun fetch-password (&rest params)
436 (require 'auth-source)
437 (let ((match (car (apply 'auth-source-search params))))
439 (let ((secret (plist-get match :secret)))
440 (if (functionp secret)
443 (error "Password not found for %S" params))))
448 (enable-circe-color-nicks)
449 (setq circe-network-defaults '(("libera"
450 :host "irc.armaanb.net"
455 :pass (lambda (null) (fetch-password
457 :machine "irc.armaanb.net"
460 :host "irc.armaanb.net"
465 :pass (lambda (null) (fetch-password
467 :machine "irc.armaanb.net"
470 :host "irc.armaanb.net"
475 :pass (lambda (null) (fetch-password
477 :machine "irc.armaanb.net"
479 :custom (circe-default-part-message "goodbye!")
480 :bind (:map circe-mode-map ("C-c C-r" . circe-reconnect-all)))
485 (if (get-buffer "irc.armaanb.net:6696")
486 (switch-to-buffer "irc.armaanb.net:6696")
487 (progn (switch-to-buffer "*scratch*")
492 (global-set-key (kbd "C-c i") 'acheam-irc)
495 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.
496 #+begin_src emacs-lisp
497 (defun sync-calendar ()
498 "Sync calendars with vdirsyncer"
500 (async-shell-command "vdirsyncer sync"))
503 :bind (:map cfw:calendar-mode-map ("C-S-u" . sync-calendar)))
504 (use-package calfw-ical)
505 (use-package calfw-org)
507 (defun acheam-calendar ()
510 (cfw:open-calendar-buffer
511 :contents-sources (list
512 (cfw:org-create-source "Green")
513 (cfw:ical-create-source
515 "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
517 (cfw:ical-create-source
519 "~/.local/share/vdirsyncer/mailbox/Y2FsOi8vMC8zMQ.ics"
521 (cfw:ical-create-source
523 "~/.local/share/vdirsyncer/school/abhojwani22@nobles.edu.ics"
527 (global-set-key (kbd "C-c c") 'acheam-calendar)
530 #+begin_src emacs-lisp
531 (use-package pdf-tools
532 :hook (pdf-view-mode . pdf-view-midnight-minor-mode))
536 #+begin_src emacs-lisp
538 :hook (python-mode . blacken-mode)
539 :custom (blacken-line-length 79))
542 ** Strip trailing whitespace
543 #+begin_src emacs-lisp
544 (use-package ws-butler
545 :config (ws-butler-global-mode))
548 Automatic linting. I need to look into configuring this more.
549 #+begin_src emacs-lisp
550 (use-package flycheck
551 :config (global-flycheck-mode))
553 ** Project management
554 I never use this, but apparently its very powerful. Another item on my todo list.
555 #+begin_src emacs-lisp
556 (use-package projectile
557 :config (projectile-mode)
558 :custom ((projectile-completion-system 'ivy))
560 ("C-c p" . projectile-command-map)
562 (when (file-directory-p "~/Code")
563 (setq projectile-project-search-path '("~/Code")))
564 (setq projectile-switch-project-action #'projectile-dired))
566 (use-package counsel-projectile
568 :config (counsel-projectile-mode))
571 The best file manager!
572 #+begin_src emacs-lisp
574 :straight (:type built-in)
575 :commands (dired dired-jump)
576 :custom ((dired-listing-switches "-agho --group-directories-first"))
577 :config (evil-collection-define-key 'normal 'dired-mode-map
578 "h" 'dired-single-up-directory
579 "l" 'dired-single-buffer))
581 (use-package dired-single
582 :commands (dired dired-jump))
584 (use-package dired-open
585 :commands (dired dired-jump)
586 :custom (dired-open-extensions '(("png" . "feh")
589 (use-package dired-hide-dotfiles
590 :hook (dired-mode . dired-hide-dotfiles-mode)
592 (evil-collection-define-key 'normal 'dired-mode-map
593 "H" 'dired-hide-dotfiles-mode))
597 A very good Git interface.
598 #+begin_src emacs-lisp
602 #+begin_src emacs-lisp
604 (use-package git-email
605 :straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
606 :config (git-email-piem-mode))
608 * General text editing
610 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.
611 #+begin_src emacs-lisp
612 (use-package aggressive-indent
613 :config (global-aggressive-indent-mode))
616 Spell check in text mode, and in prog-mode comments.
617 #+begin_src emacs-lisp
618 (dolist (hook '(text-mode-hook
621 (add-hook hook (lambda () (flyspell-mode))))
622 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
623 (add-hook hook (lambda () (flyspell-mode -1))))
624 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
625 (setq ispell-silently-savep t)
628 #+begin_src emacs-lisp
629 (setq-default tab-width 2)
632 Opens file where you left it.
633 #+begin_src emacs-lisp
637 Distraction free writing a la junegunn/goyo.
638 #+begin_src emacs-lisp
639 (use-package olivetti
640 :bind ("C-c o" . olivetti-mode))
643 Abbreviate things! I just use this for things like my email address and copyright notice.
644 #+begin_src emacs-lisp
645 (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
646 (setq save-abbrevs 'silent)
647 (setq-default abbrev-mode t)
650 #+begin_src emacs-lisp
651 (setq tramp-default-method "ssh")
653 ** Follow version controlled symlinks
654 #+begin_src emacs-lisp
655 (setq vc-follow-symlinks t)
658 #+begin_src emacs-lisp
659 (defun doas-edit (&optional arg)
660 "Edit currently visited file as root.
662 With a prefix ARG prompt for a file to visit.
663 Will also prompt for a file to visit if current
664 buffer is not visiting a file.
666 Modified from Emacs Redux."
668 (if (or arg (not buffer-file-name))
669 (find-file (concat "/doas:root@localhost:"
670 (ido-read-file-name "Find file(as root): ")))
671 (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name))))
673 (global-set-key (kbd "C-x C-r") #'doas-edit)
676 #+begin_src emacs-lisp
677 (use-package markdown-mode)
680 Get it for yourself at https://git.armaanb.net/scdoc
681 #+begin_src emacs-lisp
682 (add-to-list 'load-path "~/Code/scdoc-mode")
683 (autoload 'scdoc-mode "scdoc-mode" "Major mode for editing scdoc files" t)
684 (add-to-list 'auto-mode-alist '("\\.scd\\'" . scdoc-mode))
688 #+begin_src emacs-lisp
689 (use-package ace-window
690 :bind ("M-o" . ace-window))
692 ** Kill current buffer
693 Makes "C-x k" binding faster.
694 #+begin_src emacs-lisp
695 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
699 #+begin_src emacs-lisp
700 (use-package scad-mode)
702 ** Control backup and lock files
703 Stop backup files from spewing everywhere.
704 #+begin_src emacs-lisp
705 (setq backup-directory-alist `(("." . "~/.emacs.d/backups"))
706 create-lockfiles nil)
708 ** Make yes/no easier
709 #+begin_src emacs-lisp
710 (defalias 'yes-or-no-p 'y-or-n-p)
712 ** Move customize file
713 No more clogging up init.el.
714 #+begin_src emacs-lisp
715 (setq custom-file "~/.emacs.d/custom.el")
719 #+begin_src emacs-lisp
721 :commands (helpful-callable helpful-variable helpful-command helpful-key)
723 (counsel-describe-function-function #'helpful-callable)
724 (counsel-describe-variable-function #'helpful-variable)
726 ([remap describe-function] . counsel-describe-function)
727 ([remap describe-command] . helpful-command)
728 ([remap describe-variable] . counsel-describe-variable)
729 ([remap describe-key] . helpful-key))
732 #+begin_src emacs-lisp
733 (use-package epa-file
734 :straight (:type built-in)
736 (epa-file-select-keys nil)
737 (epa-file-encrypt-to '("me@armaanb.net"))
738 (password-cache-expiry (* 60 15)))
740 (use-package pinentry
741 :config (pinentry-start))
744 #+begin_src emacs-lisp
746 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
747 :custom (0x0-default-service 'envs))
749 *** TODO Replace this with uploading to my own server
750 Similar to the ufile alias in my ashrc
751 ** Automatically clean buffers
752 Automatically close unused buffers (except those of Circe) at midnight.
753 #+begin_src emacs-lisp
755 (add-to-list 'clean-buffer-list-kill-never-regexps (lambda (buffer-name)
756 (with-current-buffer buffer-name
757 (derived-mode-p 'lui-mode))))
761 Spectrwm is a really awesome window manager! Would highly recommend.
763 #+begin_src conf :tangle ~/.spectrwm.conf
767 autorun = ws[1]:/home/armaa/Code/scripts/autostart
770 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.
771 #+begin_src conf :tangle ~/.spectrwm.conf
773 bar_font = xos4 JetBrains Mono:pixelsize=14:antialias=true # any installed font
776 I'm not a huge fan of how spectrwm handles keybindings, probably my biggest gripe with it.
778 #+begin_src conf :tangle ~/.spectrwm.conf
779 program[term] = st -e tmux
780 program[screenshot_all] = flameshot gui
781 program[notif] = /home/armaa/Code/scripts/setter status
782 program[pass] = /home/armaa/Code/scripts/passmenu
785 bind[pass] = MOD+Shift+p
788 #+begin_src conf :tangle ~/.spectrwm.conf
789 program[paup] = /home/armaa/Code/scripts/setter audio +5
790 program[padown] = /home/armaa/Code/scripts/setter audio -5
791 program[pamute] = /home/armaa/Code/scripts/setter audio
792 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
793 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
794 program[next] = playerctl next
795 program[prev] = playerctl previous
796 program[pause] = playerctl play-pause
798 bind[padown] = XF86AudioLowerVolume
799 bind[paup] = XF86AudioRaiseVolume
800 bind[pamute] = XF86AudioMute
801 bind[brigdown] = XF86MonBrightnessDown
802 bind[brigup] = XF86MonBrightnessUp
803 bind[pause] = XF86AudioPlay
804 bind[next] = XF86AudioNext
805 bind[prev] = XF86AudioPrev
808 #+begin_src conf :tangle ~/.spectrwm.conf
809 program[h] = xdotool keyup h key --clearmodifiers Left
810 program[j] = xdotool keyup j key --clearmodifiers Down
811 program[k] = xdotool keyup k key --clearmodifiers Up
812 program[l] = xdotool keyup l key --clearmodifiers Right
814 bind[h] = MOD + Control + h
815 bind[j] = MOD + Control + j
816 bind[k] = MOD + Control + k
817 bind[l] = MOD + Control + l
820 #+begin_src conf :tangle ~/.spectrwm.conf
821 program[email] = emacsclient -ce '(progn (switch-to-buffer "*scratch*") (mu4e))'
822 program[irc] = emacsclient -ce '(acheam-irc)'
823 program[rss] = emacsclient -ce '(elfeed)'
824 program[calendar] = emacsclient -ce '(acheam-calendar)'
825 program[calc] = emacsclient -ce '(progn (calc) (windmove-up) (delete-window))'
826 program[firefox] = firefox
827 program[emacs] = emacsclient -c
829 bind[email] = MOD+Control+1
830 bind[irc] = MOD+Control+2
831 bind[rss] = MOD+Control+3
832 bind[calendar] = MOD+Control+4
833 bind[calc] = MOD+Control+5
834 bind[firefox] = MOD+Control+0
835 bind[emacs] = MOD+Control+Return
838 Float some specific programs by default.
839 #+begin_src conf :tangle ~/.spectrwm.conf
840 quirk[Castle Menu] = FLOAT
845 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.
846 #+begin_src conf :tangle ~/.config/ash/ashrc
851 #+begin_src shell :tangle ~/.config/ash/ashrc
853 user=$(echo "$1" | cut -f 1 -d '@')
854 host=$(echo "$1" | cut -f 2 -d '@')
855 echo $user | nc "$host" 79
858 **** Upload to ftp.armaanb.net
859 #+begin_src shell :tangle ~/.config/ash/ashrc
861 echo "https://l.armaanb.net/$(basename "$1")" | tee /dev/tty | xclip -sel c
865 rsync "$1" "root@armaanb.net:/var/ftp/pub/$2" --chmod 644
875 xclip -o -sel c >> "$tmp"
876 basetmp=$(echo "$tmp" | tail -c +5)
877 _uup "$tmp" "$basetmp"
883 #+begin_src shell :tangle ~/.config/ash/ashrc
884 export EDITOR="emacsclient -c"
885 export VISUAL="$EDITOR"
886 export TERM=xterm-256color # for compatability
888 export GPG_TTY="$(tty)"
889 export MANPAGER='nvim +Man!'
892 export GTK_USE_PORTAL=1
894 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
895 export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
896 export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
897 export PATH="$PATH:/home/armaa/.cargo/bin"
898 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
899 export PATH="$PATH:/usr/sbin"
900 export PATH="$PATH:/opt/FreeTube/freetube"
902 export LC_ALL="en_US.UTF-8"
903 export LC_CTYPE="en_US.UTF-8"
904 export LANGUAGE="en_US.UTF-8"
908 export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
909 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
910 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
911 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
912 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
913 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
914 export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
918 #+begin_src shell :tangle ~/.config/ash/ashrc
919 alias bhoji-drop='ssh -p 23 root@armaanb.net'
920 alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
921 alias union='ssh 192.168.1.18'
922 alias mine='ssh -p 23 root@pickupserver.cc'
923 alias tcf='ssh root@204.48.23.68'
924 alias ngmun='ssh root@157.245.89.25'
925 alias prox='ssh root@192.168.1.224'
926 alias ncq='ssh root@143.198.123.17'
927 alias envs='ssh acheam@envs.net'
930 #+begin_src shell :tangle ~/.config/ash/ashrc
931 alias ls='LC_COLLATE=C ls -lh --group-directories-first'
933 alias df='df -h / /boot'
940 alias grep='grep -in'
941 alias mkdir='mkdir -pv'
942 alias lanex='java -jar ~/.local/share/lxc/lanxchange.jar'
943 emacs() { $EDITOR "$@" & }
946 **** System management
947 #+begin_src shell :tangle ~/.config/ash/ashrc
948 alias crontab='crontab-argh'
950 alias pasu='git -C ~/.password-store push'
951 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
955 #+begin_src shell :tangle ~/.config/ash/ashrc
956 alias ping='ping -c 10'
957 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
958 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
959 alias plan='T=$(mktemp) && \
960 rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
962 head -n -2 $T > $TT && \
965 echo "Last updated: $(date -R)" >> "$TT" && \
966 fold -sw 72 "$TT" > "$T"| \
967 rsync "$T" root@armaanb.net:/etc/finger/plan.txt && \
970 **** Virtual machines, chroots
971 #+begin_src shell :tangle ~/.config/ash/ashrc
972 alias ckiss="doas chrooter ~/Virtual/kiss"
973 alias cdebian="doas chrooter ~/Virtual/debian bash"
974 alias cwindows='devour qemu-system-x86_64 \
979 -device VGA,vgamem_mb=64 \
983 -net user,smb=/home/armaa/Public \
984 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
987 #+begin_src shell :tangle ~/.config/ash/ashrc
988 alias words='gen-shell -c "words"'
989 alias words-e='gen-shell -c "words ~E"'
992 #+begin_src shell :tangle ~/.config/ash/ashrc
993 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
995 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
997 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
998 --restrict-filenames -o '%(title)s.%(ext)s'"
1002 Make MPV play a little bit smoother.
1003 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1004 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1008 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!.
1009 #+begin_src conf :tangle ~/.inputrc
1010 set editing-mode emacs
1014 #+begin_src conf :tangle ~/.gitconfig
1016 name = Armaan Bhojwani
1017 email = me@armaanb.net
1018 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1021 #+begin_src conf :tangle ~/.gitconfig
1023 defaultBranch = main
1026 #+begin_src conf :tangle ~/.gitconfig
1031 #+begin_src conf :tangle ~/.gitconfig
1033 smtpserver = smtp.mailbox.org
1034 smtpuser = me@armaanb.net
1035 smtpencryption = ssl
1036 smtpserverport = 465
1040 #+begin_src conf :tangle ~/.gitconfig
1045 #+begin_src conf :tangle ~/.gitconfig
1048 sclone = clone --depth 1
1053 quickfix = commit . --amend --no-edit
1055 subup = submodule update --remote
1056 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1057 pushnc = push -o skip-ci
1060 #+begin_src conf :tangle ~/.gitconfig
1066 Lightweight notification daemon. Eventually I'd like to replace this with something dbus-less.
1068 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1070 font = "JetBrains Mono Medium Nerd Font 11"
1072 format = "<b>%s</b>\n%b"
1074 indicate_hidden = yes
1077 show_age_threshold = 60
1080 geometry = "400x5-10+10"
1082 idle_threshold = 120
1084 sticky_history = yes
1086 separator_height = 1
1088 horizontal_padding = 8
1090 separator_color = "#ffffff"
1091 startup_notification = false
1094 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1101 close_all = mod4+shift+c
1102 history = mod4+ctrl+c
1105 background = "#222222"
1106 foreground = "#ffffff"
1107 highlight = "#ffffff"
1111 background = "#222222"
1112 foreground = "#ffffff"
1113 highlight = "#ffffff"
1117 background = "#222222"
1118 foreground = "#a60000"
1119 highlight = "#ffffff"
1123 The best document reader!
1125 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1127 map <A-b> toggle_statusbar
1128 set selection-clipboard clipboard
1131 set window-title-basename "true"
1132 set selection-clipboard "clipboard"
1135 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1136 set default-bg "#000000"
1137 set default-fg "#ffffff"
1138 set render-loading true
1139 set render-loading-bg "#000000"
1140 set render-loading-fg "#ffffff"
1142 set recolor-lightcolor "#000000" # bg
1143 set recolor-darkcolor "#ffffff" # fg
1147 Just some basic Firefox CSS. Will probably have to rewrite for the Proton redesign.
1148 *** Swap tab and URL bars
1149 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1151 -moz-box-ordinal-group: 1 !important;
1155 -moz-box-ordinal-group: 2 !important;
1159 -moz-box-ordinal-group: 3 !important;
1162 *** Hide URL bar when not focused.
1163 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1164 #navigator-toolbox:not(:focus-within):not(:hover) {
1168 #navigator-toolbox {
1169 transition: 0.1s margin-top ease-out;
1172 *** Black screen by default
1174 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1177 #browser vbox#appcontent tabbrowser,
1179 #tabbrowser-tabpanels,
1181 browser[type="content-primary"],
1182 browser[type="content"] > html,
1184 background: black !important;
1185 color: #fff !important;
1190 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1191 @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1193 background: black !important;
1198 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.
1199 #+begin_src conf :tangle ~/.Xresources
1201 ,*.foreground: #ffffff
1202 ,*.background: #000000
1203 ,*.cursorColor: #ffffff
1238 I use tmux in order to keep my st build light. Still learning how it works.
1239 #+begin_src conf :tangle ~/.tmux.conf
1242 set-option -g history-limit 50000
1243 set-window-option -g mode-keys vi
1244 bind-key -T copy-mode-vi 'v' send -X begin-selection
1245 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
1249 #+begin_src conf :tangle ~/.gnupg/gpg.conf
1250 default-key 3C9ED82FFE788E4A
1254 #+begin_src conf :tangle ~/.gnupg/gpg-agent.conf
1255 pinentry-program /sbin/pinentry-fltk
1257 default-cache-ttl 600
1258 allow-emacs-pinentry
1261 #+begin_src conf :tangle ~/.config/xmodmap
1268 ! Turn right alt into super
1274 ! Swap caps and control
1276 remove Lock = Caps_Lock
1277 remove Control = Control_L
1278 remove Lock = Control_L
1279 remove Control = Caps_Lock
1280 keysym Control_L = Caps_Lock
1281 keysym Caps_Lock = Control_L
1282 add Lock = Caps_Lock
1283 add Control = Control_L