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 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.
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.
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.
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.
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
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.
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)
29 (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
30 (bootstrap-version 5))
31 (unless (file-exists-p bootstrap-file)
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))
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)
47 Very nice high contrast theme.
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-mode-line '3d
54 modus-themes-scale-headings t
55 modus-themes-diffs 'desaturated)
56 (load-theme 'modus-vivendi t)
60 Great programming font with ligatures.
61 #+begin_src emacs-lisp
62 (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
65 #+begin_src emacs-lisp
67 :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
69 (ligature-set-ligatures
70 '(prog-mode text-mode)
71 '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
72 "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
73 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
74 "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
75 "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
76 ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
77 "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
78 "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
79 "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
80 "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
81 "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
82 "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
83 (global-ligature-mode t))
86 Display relative line numbers except in some modes
87 #+begin_src emacs-lisp
88 (global-display-line-numbers-mode)
89 (setq display-line-numbers-type 'relative)
90 (dolist (no-line-num '(term-mode-hook
95 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
97 ** Highlight matching parenthesis
98 #+begin_src emacs-lisp
100 :config (show-paren-mode)
101 :custom (show-paren-style 'parenthesis))
104 *** Show current function
105 #+begin_src emacs-lisp
106 (which-function-mode)
108 *** Make position in file more descriptive
109 Show current column and file size.
110 #+begin_src emacs-lisp
112 (size-indication-mode)
115 #+begin_src emacs-lisp
117 :config (minions-mode))
120 Show a ruler at a certain number of chars depending on mode.
121 #+begin_src emacs-lisp
122 (setq display-fill-column-indicator-column 80)
123 (global-display-fill-column-indicator-mode)
126 Whenever starting a key chord, show possible future steps.
127 #+begin_src emacs-lisp
128 (use-package which-key
129 :config (which-key-mode)
130 :custom (which-key-idle-delay 0.3))
132 ** Highlight TODOs in comments
133 #+begin_src emacs-lisp
135 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
136 :config (global-hl-todo-mode 1))
139 #+begin_src emacs-lisp
143 Soft wrap words and do operations by visual lines.
144 #+begin_src emacs-lisp
145 (add-hook 'text-mode-hook 'visual-line-mode 1)
147 ** Display number of matches in search
148 #+begin_src emacs-lisp
150 :config (global-anzu-mode))
153 Inverts modeline instead of audible bell or the standard visual bell.
154 #+begin_src emacs-lisp
155 (setq visible-bell nil
157 (lambda () (invert-face 'mode-line)
158 (run-with-timer 0.1 nil #'invert-face 'mode-line)))
162 #+begin_src emacs-lisp
164 :custom (select-enable-clipboard nil)
167 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
168 ;; Use visual line motions even outside of visual-line-mode buffers
169 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
170 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
171 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
174 #+begin_src emacs-lisp
175 (use-package evil-collection
177 :init (evil-collection-init)
178 :custom (evil-collection-setup-minibuffer t))
182 #+begin_src emacs-lisp
183 (use-package evil-surround
184 :config (global-evil-surround-mode))
187 #+begin_src emacs-lisp
188 (use-package evil-leader
189 :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
191 (evil-leader/set-leader "<SPC>")
192 (global-evil-leader-mode))
195 #+begin_src emacs-lisp
197 (use-package evil-nerd-commenter
198 :bind (:map evil-normal-state-map
199 ("gc" . evilnc-comment-or-uncomment-lines))
200 :custom (evilnc-invert-comment-line-by-line nil))
204 #+begin_src emacs-lisp
205 (evil-set-undo-system 'undo-redo)
207 ** Number incrementing
209 #+begin_src emacs-lisp
210 (use-package evil-numbers
211 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
212 :bind (:map evil-normal-state-map
213 ("C-M-a" . evil-numbers/inc-at-pt)
214 ("C-M-x" . evil-numbers/dec-at-pt)))
218 #+begin_src emacs-lisp
219 (use-package evil-org
221 :hook (org-mode . evil-org-mode)
223 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
224 (use-package evil-org-agenda
225 :straight (:type built-in)
227 :config (evil-org-agenda-set-keys))
230 #+begin_src emacs-lisp
231 (evil-leader/set-key-for-mode 'org-mode
232 "T" 'org-show-todo-tree
234 "c" 'org-archive-subtree)
238 #+begin_src emacs-lisp
240 :straight (:type built-in)
241 :commands (org-capture org-agenda)
243 (org-ellipsis " â–¾")
244 (org-agenda-start-with-log-mode t)
245 (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
247 (org-log-into-drawer t)
248 (org-src-tab-acts-natively t)
249 (org-src-fontify-natively t)
250 (org-startup-indented t)
251 (org-hide-emphasis-markers t)
252 (org-fontify-whole-block-delimiter-line nil)
253 :bind ("C-c a" . org-agenda))
256 #+begin_src emacs-lisp
257 (use-package org-tempo
259 :straight (:type built-in)
261 ;; TODO: There's gotta be a more efficient way to write this
262 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
263 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
264 (add-to-list 'org-structure-template-alist '("ash" . "src shell :tangle ~/.config/ash/ashrc"))
265 (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
266 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
267 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
268 (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
269 (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
270 (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
271 (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
272 (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
273 (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")
274 (add-to-list 'org-structure-template-alist '("tm" . "src conf :tangle ~/.tmux.conf")))
278 Simple, but not too simple autocompletion.
279 #+begin_src emacs-lisp
281 :bind (("C-s" . swiper)
282 :map ivy-minibuffer-map
283 ("TAB" . ivy-alt-done)
284 :map ivy-switch-buffer-map
285 ("M-d" . ivy-switch-buffer-kill))
289 #+begin_src emacs-lisp
290 (use-package ivy-rich
292 :config (ivy-rich-mode))
296 #+begin_src emacs-lisp
298 :bind (("C-M-j" . 'counsel-switch-buffer)
299 :map minibuffer-local-map
300 ("C-r" . 'counsel-minibuffer-history))
301 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
302 :config (counsel-mode))
304 ** Remember frequent commands
305 #+begin_src emacs-lisp
306 (use-package ivy-prescient
308 :custom (ivy-prescient-enable-filtering nil)
310 (prescient-persist-mode)
311 (ivy-prescient-mode))
314 Better search utility.
315 #+begin_src emacs-lisp
320 Use elfeed for RSS. I have another file with all the feeds in it.
321 #+begin_src emacs-lisp
323 :bind (("C-c e" . elfeed))
325 (load "~/.emacs.d/feeds.el")
326 (add-hook 'elfeed-new-entry-hook
327 (elfeed-make-tagger :feed-url "youtube\\.com"
329 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
331 (use-package elfeed-goodies
333 :config (elfeed-goodies/setup))
336 Use mu4e for reading emails.
338 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.
340 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.
341 #+begin_src emacs-lisp
342 (use-package smtpmail
343 :straight (:type built-in))
345 :load-path "/usr/share/emacs/site-lisp/mu4e"
346 :straight (:build nil)
347 :bind (("C-c m" . mu4e))
349 (setq user-full-name "Armaan Bhojwani"
350 smtpmail-local-domain "armaanb.net"
351 smtpmail-stream-type 'ssl
352 smtpmail-smtp-service '465
353 mu4e-change-filenames-when-moving t
354 mu4e-get-mail-command "offlineimap -q"
355 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
356 message-citation-line-function 'message-insert-formatted-citation-line
357 mu4e-completing-read-function 'ivy-completing-read
358 mu4e-confirm-quit nil
360 mail-user-agent 'mu4e-user-agent
362 `( ,(make-mu4e-context
364 :enter-func (lambda () (mu4e-message "Entering school context"))
365 :leave-func (lambda () (mu4e-message "Leaving school context"))
366 :match-func (lambda (msg)
368 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
369 :vars '((user-mail-address . "abhojwani22@nobles.edu")
370 (mu4e-sent-folder . "/school/Sent")
371 (mu4e-drafts-folder . "/school/Drafts")
372 (mu4e-trash-folder . "/school/Trash")
373 (mu4e-refile-folder . "/school/Archive")
374 (message-cite-reply-position . above)
375 (user-mail-address . "abhojwani22@nobles.edu")
376 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
377 (smtpmail-smtp-server . "smtp.gmail.com")))
380 :enter-func (lambda () (mu4e-message "Entering personal context"))
381 :leave-func (lambda () (mu4e-message "Leaving personal context"))
382 :match-func (lambda (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 (message-cite-reply-position . below)
391 (smtpmail-smtp-user . "me@armaanb.net")
392 (smtpmail-smtp-server . "smtp.mailbox.org")))))
393 (add-to-list 'mu4e-bookmarks
394 '(:name "Unified inbox"
395 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
397 :hook ((mu4e-compose-mode . flyspell-mode)
398 (mu4e-compose-mode . auto-fill-mode)
399 (mu4e-view-mode-hook . turn-on-visual-line-mode)))
402 Discourage Gnus from displaying HTML emails
403 #+begin_src emacs-lisp
404 (with-eval-after-load "mm-decode"
405 (add-to-list 'mm-discouraged-alternatives "text/html")
406 (add-to-list 'mm-discouraged-alternatives "text/richtext"))
409 Set EWW as default browser except for videos.
410 #+begin_src emacs-lisp
411 (defun browse-url-mpv (url &optional new-window)
413 (start-process "mpv" "*mpv*" "mpv" url))
415 (setq browse-url-handlers
417 (("youtu\\.?be" . browse-url-mpv)
418 ("peertube.*" . browse-url-mpv)
419 ("vid.*" . browse-url-mpv)
420 ("vid.*" . browse-url-mpv)
421 ("." . eww-browse-url)
425 Some EWW enhancements.
426 *** Give buffer a useful name
427 #+begin_src emacs-lisp
428 ;; From https://protesilaos.com/dotemacs/
429 (defun prot-eww--rename-buffer ()
430 "Rename EWW buffer using page title or URL.
431 To be used by `eww-after-render-hook'."
432 (let ((name (if (eq "" (plist-get eww-data :title))
433 (plist-get eww-data :url)
434 (plist-get eww-data :title))))
435 (rename-buffer (format "*%s # eww*" name) t)))
438 :straight (:type built-in)
439 :bind (("C-c w" . eww))
440 :hook (eww-after-render-hook prot-eww--rename-buffer))
442 *** Better entrypoint
443 #+begin_src emacs-lisp
444 ;; From https://protesilaos.com/dotemacs/
445 (defun prot-eww-browse-dwim (url &optional arg)
446 "Visit a URL, maybe from `eww-prompt-history', with completion.
448 With optional prefix ARG (\\[universal-argument]) open URL in a
451 If URL does not look like a valid link, run a web query using
454 When called from an eww buffer, provide the current link as
458 (completing-read "Query:" eww-prompt-history
459 nil nil (plist-get eww-data :url) 'eww-prompt-history)
461 (eww url (if arg 4 nil)))
463 (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
466 #+begin_src emacs-lisp
468 :straight (:type built-in)
470 (load "~/.emacs.d/irc.el")
471 (erc-notifications-mode 1)
473 :custom (erc-prompt-for-password . nil))
475 (use-package erc-hl-nicks
476 :config (erc-hl-nicks-mode 1))
481 (erc-tls :server "irc.armaanb.net" :nick "emacs"))
486 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to =emacsclient --eval "(emacs-everywhere)"=.
487 #+begin_src emacs-lisp
488 (use-package emacs-everywhere)
492 #+begin_src emacs-lisp
494 :hook (python-mode . blacken-mode)
495 :config (setq blacken-line-length 79))
498 (use-package ws-butler
499 :config (ws-butler-global-mode))
502 #+begin_src emacs-lisp
503 (use-package flycheck
504 :config (global-flycheck-mode))
506 ** Project management
507 #+begin_src emacs-lisp
508 (use-package projectile
509 :config (projectile-mode)
510 :custom ((projectile-completion-system 'ivy))
512 ("C-c p" . projectile-command-map)
514 (when (file-directory-p "~/Code")
515 (setq projectile-project-search-path '("~/Code")))
516 (setq projectile-switch-project-action #'projectile-dired))
518 (use-package counsel-projectile
520 :config (counsel-projectile-mode))
523 #+begin_src emacs-lisp
525 :straight (:type built-in)
526 :commands (dired dired-jump)
527 :custom ((dired-listing-switches "-agho --group-directories-first"))
528 :config (evil-collection-define-key 'normal 'dired-mode-map
529 "h" 'dired-single-up-directory
530 "l" 'dired-single-buffer))
532 (use-package dired-single
533 :commands (dired dired-jump))
535 (use-package dired-open
536 :commands (dired dired-jump)
537 :custom (dired-open-extensions '(("png" . "feh")
540 (use-package dired-hide-dotfiles
541 :hook (dired-mode . dired-hide-dotfiles-mode)
543 (evil-collection-define-key 'normal 'dired-mode-map
544 "H" 'dired-hide-dotfiles-mode))
548 # TODO: Write a command that commits hunk, skipping staging step.
549 #+begin_src emacs-lisp
552 *** Colored diff in line number area
553 #+begin_src emacs-lisp
555 :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
556 :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
557 (magit-post-refresh-hook . diff-hl-magit-post-refresh))
558 :config (global-diff-hl-mode))
561 #+begin_src emacs-lisp
563 (use-package git-email
564 :straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
565 :config (git-email-piem-mode))
567 * General text editing
569 Indent after every change.
570 #+begin_src emacs-lisp
571 (use-package aggressive-indent
572 :config (global-aggressive-indent-mode))
575 Spell check in text mode, and in prog-mode comments.
576 #+begin_src emacs-lisp
577 (dolist (hook '(text-mode-hook))
578 (add-hook hook (lambda () (flyspell-mode))))
579 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
580 (add-hook hook (lambda () (flyspell-mode -1))))
581 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
583 ** Expand tabs to spaces
584 #+begin_src emacs-lisp
585 (setq-default tab-width 2)
587 ** Copy kill ring to clipboard
588 #+begin_src emacs-lisp
589 (setq x-select-enable-clipboard t)
590 (defun copy-kill-ring-to-xorg ()
591 "Copy the current kill ring to the xorg clipboard."
593 (x-select-text (current-kill 0)))
596 Opens file where you left it.
597 #+begin_src emacs-lisp
601 Distraction free writing a la junegunn/goyo.
602 #+begin_src emacs-lisp
603 (use-package olivetti
605 (evil-leader/set-key "o" 'olivetti-mode))
609 #+begin_src emacs-lisp
610 (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
611 (setq save-abbrevs 'silent)
612 (setq-default abbrev-mode t)
615 #+begin_src emacs-lisp
616 (setq tramp-default-method "ssh")
618 ** Don't ask about following symlinks in vc
619 #+begin_src emacs-lisp
620 (setq vc-follow-symlinks t)
622 ** Don't ask to save custom dictionary
623 #+begin_src emacs-lisp
624 (setq ispell-silently-savep t)
627 #+begin_src emacs-lisp
628 (defun doas-edit (&optional arg)
629 "Edit currently visited file as root.
631 With a prefix ARG prompt for a file to visit.
632 Will also prompt for a file to visit if current
633 buffer is not visiting a file.
635 Modified from Emacs Redux."
637 (if (or arg (not buffer-file-name))
638 (find-file (concat "/doas:root@localhost:"
639 (ido-read-file-name "Find file(as root): ")))
640 (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name))))
642 (global-set-key (kbd "C-x C-r") #'doas-edit)
646 #+begin_src emacs-lisp
647 (use-package ace-window
648 :bind ("M-o" . ace-window))
650 ** Kill current buffer
651 Makes "C-x k" binding faster.
652 #+begin_src emacs-lisp
653 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
657 #+begin_src emacs-lisp
658 (use-package scad-mode)
660 ** Control backup files
661 Stop backup files from spewing everywhere.
662 #+begin_src emacs-lisp
663 (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
665 ** Make yes/no easier
666 #+begin_src emacs-lisp
667 (defalias 'yes-or-no-p 'y-or-n-p)
669 ** Move customize file
670 No more clogging up init.el.
671 #+begin_src emacs-lisp
672 (setq custom-file "~/.emacs.d/custom.el")
676 #+begin_src emacs-lisp
678 :commands (helpful-callable helpful-variable helpful-command helpful-key)
680 (counsel-describe-function-function #'helpful-callable)
681 (counsel-describe-variable-function #'helpful-variable)
683 ([remap describe-function] . counsel-describe-function)
684 ([remap describe-command] . helpful-command)
685 ([remap describe-variable] . counsel-describe-variable)
686 ([remap describe-key] . helpful-key))
689 #+begin_src emacs-lisp
690 (use-package epa-file
691 :straight (:type built-in)
693 (epa-file-select-keys nil)
694 (epa-file-encrypt-to '("me@armaanb.net"))
695 (password-cache-expiry (* 60 15)))
697 (use-package pinentry
698 :config (pinentry-start))
701 #+begin_src emacs-lisp
703 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
704 :custom (0x0-default-service 'envs)
705 :config (evil-leader/set-key
707 "0f" '0x0-upload-file
708 "0s" '0x0-upload-string
709 "0c" '0x0-upload-kill-ring
710 "0p" '0x0-upload-popup))
715 #+begin_src conf :tangle ~/.spectrwm.conf
719 autorun = ws[1]:/home/armaa/Code/scripts/autostart
722 #+begin_src conf :tangle ~/.spectrwm.conf
724 bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
728 #+begin_src conf :tangle ~/.spectrwm.conf
729 program[term] = st -e tmux
730 program[screenshot_all] = flameshot gui
731 program[notif] = /home/armaa/Code/scripts/setter status
732 program[pass] = /home/armaa/Code/scripts/passmenu
735 bind[pass] = MOD+Shift+p
738 #+begin_src conf :tangle ~/.spectrwm.conf
739 program[paup] = /home/armaa/Code/scripts/setter audio +5
740 program[padown] = /home/armaa/Code/scripts/setter audio -5
741 program[pamute] = /home/armaa/Code/scripts/setter audio
742 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
743 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
744 program[next] = playerctl next
745 program[prev] = playerctl previous
746 program[pause] = playerctl play-pause
748 bind[padown] = XF86AudioLowerVolume
749 bind[paup] = XF86AudioRaiseVolume
750 bind[pamute] = XF86AudioMute
751 bind[brigdown] = XF86MonBrightnessDown
752 bind[brigup] = XF86MonBrightnessUp
753 bind[pause] = XF86AudioPlay
754 bind[next] = XF86AudioNext
755 bind[prev] = XF86AudioPrev
758 #+begin_src conf :tangle ~/.spectrwm.conf
759 program[h] = xdotool keyup h key --clearmodifiers Left
760 program[j] = xdotool keyup j key --clearmodifiers Down
761 program[k] = xdotool keyup k key --clearmodifiers Up
762 program[l] = xdotool keyup l key --clearmodifiers Right
764 bind[h] = MOD + Control + h
765 bind[j] = MOD + Control + j
766 bind[k] = MOD + Control + k
767 bind[l] = MOD + Control + l
770 #+begin_src conf :tangle ~/.spectrwm.conf
771 program[email] = emacsclient -c --eval "(mu4e)"
772 program[irc] = emacsclient -c --eval '(switch-to-buffer "irc.armaanb.net:6697")'
773 program[emacs] = emacsclient -c
774 program[firefox] = firefox
775 program[calc] = st -e because -l
776 program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
778 bind[email] = MOD+Control+1
779 bind[irc] = MOD+Control+2
780 bind[firefox] = MOD+Control+3
781 bind[emacs-anywhere] = MOD+Control+4
782 bind[calc] = MOD+Control+5
783 bind[emacs] = MOD+Control+Return
786 #+begin_src conf :tangle ~/.spectrwm.conf
787 quirk[Castle Menu] = FLOAT
792 #+begin_src conf :tangle ~/.config/ash/ashrc
796 **** Update all packages
797 #+begin_src shell :tangle ~/.config/ash/ashrc
798 color=$(tput setaf 5)
802 doas echo "${color}== upgrading with yay ==${reset}"
805 echo "${color}== checking for pacnew files ==${reset}"
808 echo "${color}== upgrading flatpaks ==${reset}"
811 echo "${color}== updating nvim plugins ==${reset}"
812 nvim +PlugUpdate +PlugUpgrade +qall
813 echo "Updated nvim plugins"
815 echo "${color}You are entirely up to date!${reset}"
818 **** Clean all packages
819 #+begin_src shell :tangle ~/.config/ash/ashrc
821 doas echo "${color}== cleaning pacman orphans ==${reset}"
822 (pacman -Qtdq | doas pacman -Rns - 2> /dev/null) || echo "No orphans"
824 echo "${color}== cleaning flatpaks ==${reset}"
825 flatpak remove --unused
827 echo "${color}== cleaning nvim plugins ==${reset}"
828 nvim +PlugClean +qall
829 echo "Cleaned nvim plugins"
831 echo "${color}All orphans cleaned!${reset}"
834 **** Interact with 0x0
835 #+begin_src shell :tangle ~/.config/ash/ashrc
836 zxz="https://envs.sh"
837 ufile() { curl -F"file=@$1" "$zxz" ; }
838 upb() { curl -F"file=@-;" "$zxz" ; }
839 uurl() { curl -F"url=$1" "$zxz" ; }
840 ushort() { curl -F"shorten=$1" "$zxz" ; }
841 uclip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
844 #+begin_src shell :tangle ~/.config/ash/ashrc
846 user=$(echo "$1" | cut -f 1 -d '@')
847 host=$(echo "$1" | cut -f 2 -d '@')
848 echo $user | nc "$host" 79 -N
851 **** Upload to ftp.armaanb.net
852 #+begin_src shell :tangle ~/.config/ash/ashrc
854 rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
855 echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
859 #+begin_src shell :tangle ~/.config/ash/ashrc
860 export EDITOR="emacsclient -c"
861 export VISUAL="$EDITOR"
862 export TERM=xterm-256color # for compatability
864 export GPG_TTY="$(tty)"
865 export MANPAGER='nvim +Man!'
868 export GTK_USE_PORTAL=1
870 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
871 export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
872 export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
873 export PATH="$PATH:/home/armaa/.cargo/bin"
874 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
875 export PATH="$PATH:/usr/sbin"
876 export PATH="$PATH:/opt/FreeTube/freetube"
878 export LC_ALL="en_US.UTF-8"
879 export LC_CTYPE="en_US.UTF-8"
880 export LANGUAGE="en_US.UTF-8"
882 export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
883 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
884 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
885 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
886 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
887 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
891 #+begin_src shell :tangle ~/.config/ash/ashrc
892 alias bhoji-drop='ssh -p 23 root@armaanb.net'
893 alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
894 alias union='ssh 192.168.1.18'
895 alias mine='ssh -p 23 root@pickupserver.cc'
896 alias tcf='ssh root@204.48.23.68'
897 alias ngmun='ssh root@157.245.89.25'
898 alias prox='ssh root@192.168.1.224'
899 alias ncq='ssh root@143.198.123.17'
900 alias envs='ssh acheam@envs.net'
903 #+begin_src shell :tangle ~/.config/ash/ashrc
904 alias ls='ls -lh --group-directories-first'
906 alias df='df -h / /boot'
913 alias grep='grep -in --color=auto'
914 alias mkdir='mkdir -pv'
915 alias wget='wget -e robots=off'
916 alias lanex='java -jar ~/.local/share/lxc/lanxchange.jar'
920 **** System management
921 #+begin_src shell :tangle ~/.config/ash/ashrc
922 alias pkill='pkill -i'
923 alias crontab='crontab-argh'
925 alias pasu='git -C ~/.password-store push'
926 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
930 #+begin_src shell :tangle ~/.config/ash/ashrc
931 alias ping='ping -c 10'
932 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
933 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
934 alias plan='T=$(mktemp) && \
935 rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
937 head -n -2 $T > $TT && \
939 echo "\nLast updated: $(date -R)" >> "$TT" && \
940 fold -sw 72 "$TT" > "$T"| \
941 rsync "$T" root@armaanb.net:/etc/finger/plan.txt'
943 **** Virtual machines, chroots
944 #+begin_src shell :tangle ~/.config/ash/ashrc
945 alias ckiss="doas chrooter ~/Virtual/kiss"
946 alias cdebian="doas chrooter ~/Virtual/debian bash"
947 alias cwindows='devour qemu-system-x86_64 \
952 -device VGA,vgamem_mb=64 \
956 -net user,smb=/home/armaa/Public \
957 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
960 #+begin_src shell :tangle ~/.config/ash/ashrc
961 alias pip="python -m pip"
962 alias black="black -l 79"
965 #+begin_src shell :tangle ~/.config/ash/ashrc
966 alias words='gen-shell -c "words"'
967 alias words-e='gen-shell -c "words ~E"'
970 #+begin_src shell :tangle ~/.config/ash/ashrc
971 alias zathura='devour zathura'
972 alias cad='devour openscad'
973 alias feh='devour feh'
976 #+begin_src shell :tangle ~/.config/ash/ashrc
979 alias apii='doas pacman -S'
981 alias azf='pacman -Q | fzf'
982 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
985 #+begin_src shell :tangle ~/.config/ash/ashrc
986 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
987 iflag=fullblock status=progress'
988 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
989 iflag=fullblock status=progress'
990 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
991 --restrict-filenames -o '%(title)s.%(ext)s'"
992 alias cal="cal -3 --color=auto"
997 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
998 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
999 c.TerminalInteractiveShell.editing_mode = 'vi'
1000 c.InteractiveShell.colors = 'linux'
1001 c.TerminalInteractiveShell.confirm_exit = False
1004 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1008 return x * (180 / pi)
1011 return x * (pi / 180)
1014 return (x * (pi / 180)) / unit
1026 Make MPV play a little bit smoother.
1027 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1028 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1032 For any GNU Readline programs
1033 #+begin_src conf :tangle ~/.inputrc
1034 set editing-mode emacs
1038 #+begin_src conf :tangle ~/.gitconfig
1040 name = Armaan Bhojwani
1041 email = me@armaanb.net
1042 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1045 #+begin_src conf :tangle ~/.gitconfig
1047 defaultBranch = main
1050 #+begin_src conf :tangle ~/.gitconfig
1055 #+begin_src conf :tangle ~/.gitconfig
1057 smtpserver = smtp.mailbox.org
1058 smtpuser = me@armaanb.net
1059 smtpencryption = ssl
1060 smtpserverport = 465
1064 #+begin_src conf :tangle ~/.gitconfig
1069 #+begin_src conf :tangle ~/.gitconfig
1072 sclone = clone --depth 1
1077 quickfix = commit . --amend --no-edit
1079 subup = submodule update --remote
1080 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1081 pushnc = push -o skip-ci
1084 #+begin_src conf :tangle ~/.gitconfig
1090 Lightweight notification daemon.
1092 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1094 font = "JetBrains Mono Medium Nerd Font 11"
1096 format = "<b>%s</b>\n%b"
1098 indicate_hidden = yes
1101 show_age_threshold = 60
1104 geometry = "400x5-10+10"
1106 idle_threshold = 120
1108 sticky_history = yes
1110 separator_height = 1
1112 horizontal_padding = 8
1114 separator_color = "#ffffff"
1115 startup_notification = false
1118 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1125 close_all = mod4+shift+c
1126 history = mod4+ctrl+c
1129 background = "#222222"
1130 foreground = "#ffffff"
1131 highlight = "#ffffff"
1135 background = "#222222"
1136 foreground = "#ffffff"
1137 highlight = "#ffffff"
1141 background = "#222222"
1142 foreground = "#a60000"
1143 highlight = "#ffffff"
1148 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1150 map <A-b> toggle_statusbar
1151 set selection-clipboard clipboard
1154 set window-title-basename "true"
1155 set selection-clipboard "clipboard"
1158 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1159 set default-bg "#000000"
1160 set default-fg "#ffffff"
1161 set render-loading true
1162 set render-loading-bg "#000000"
1163 set render-loading-fg "#ffffff"
1165 set recolor-lightcolor "#000000" # bg
1166 set recolor-darkcolor "#ffffff" # fg
1170 *** Swap tab and URL bars
1171 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1173 -moz-box-ordinal-group: 1 !important;
1177 -moz-box-ordinal-group: 2 !important;
1181 -moz-box-ordinal-group: 3 !important;
1184 *** Hide URL bar when not focused.
1185 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1186 #navigator-toolbox:not(:focus-within):not(:hover) {
1190 #navigator-toolbox {
1191 transition: 0.1s margin-top ease-out;
1194 *** Black screen by default
1195 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1198 #browser vbox#appcontent tabbrowser,
1200 #tabbrowser-tabpanels,
1202 browser[type="content-primary"],
1203 browser[type="content"] > html,
1205 background: black !important;
1206 color: #fff !important;
1209 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1210 @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1212 background: black !important;
1219 #+begin_src conf :tangle ~/.Xresources
1221 ,*.foreground: #ffffff
1222 ,*.background: #000000
1223 ,*.cursorColor: #ffffff
1258 #+begin_src conf :tangle ~/.Xresources
1259 xterm*VT100.Translations: #override \
1260 Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
1261 Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
1262 Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
1263 Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
1266 #+begin_src conf :tangle ~/.Xresources
1267 xterm*cursorBlink: true
1270 #+begin_src conf :tangle ~/.Xresources
1271 XTerm*eightBitInput: false
1272 XTerm*eightBitOutput: true
1275 #+begin_src conf :tangle ~/.tmux.conf
1277 set-window-option -g mode-keys vi