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-org-blocks 'grayscale
54 modus-themes-mode-line '3d
55 modus-themes-scale-headings t
56 modus-themes-region 'no-extend
57 modus-themes-diffs 'desaturated)
58 (load-theme 'modus-vivendi t)
62 Great programming font with ligatures.
63 #+begin_src emacs-lisp
64 (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
67 #+begin_src emacs-lisp
69 :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
71 (ligature-set-ligatures
72 '(prog-mode text-mode)
73 '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
74 "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
75 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
76 "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
77 "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
78 ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
79 "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
80 "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
81 "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
82 "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
83 "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
84 "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
85 (global-ligature-mode t))
88 Display relative line numbers except in some modes
89 #+begin_src emacs-lisp
90 (global-display-line-numbers-mode)
91 (setq display-line-numbers-type 'relative)
92 (dolist (no-line-num '(term-mode-hook
97 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
99 ** Highlight matching parenthesis
100 #+begin_src emacs-lisp
102 :config (show-paren-mode)
103 :custom (show-paren-style 'parenthesis))
106 *** Show current function
107 #+begin_src emacs-lisp
108 (which-function-mode)
110 *** Make position in file more descriptive
111 Show current column and file size.
112 #+begin_src emacs-lisp
114 (size-indication-mode)
117 #+begin_src emacs-lisp
119 :config (minions-mode))
122 Show a ruler at a certain number of chars depending on mode.
123 #+begin_src emacs-lisp
124 (setq display-fill-column-indicator-column 80)
125 (global-display-fill-column-indicator-mode)
128 Whenever starting a key chord, show possible future steps.
129 #+begin_src emacs-lisp
130 (use-package which-key
131 :config (which-key-mode)
132 :custom (which-key-idle-delay 0.3))
134 ** Highlight TODOs in comments
135 #+begin_src emacs-lisp
137 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
138 :config (global-hl-todo-mode 1))
141 #+begin_src emacs-lisp
145 Soft wrap words and do operations by visual lines.
146 #+begin_src emacs-lisp
147 (add-hook 'text-mode-hook 'visual-line-mode 1)
149 ** Display number of matches in search
150 #+begin_src emacs-lisp
152 :config (global-anzu-mode))
155 Inverts modeline instead of audible bell or the standard visual bell.
156 #+begin_src emacs-lisp
157 (setq visible-bell nil
159 (lambda () (invert-face 'mode-line)
160 (run-with-timer 0.1 nil #'invert-face 'mode-line)))
164 #+begin_src emacs-lisp
166 :custom (select-enable-clipboard nil)
169 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
170 ;; Use visual line motions even outside of visual-line-mode buffers
171 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
172 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
173 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
176 #+begin_src emacs-lisp
177 (use-package evil-collection
179 :init (evil-collection-init)
180 :custom (evil-collection-setup-minibuffer t))
184 #+begin_src emacs-lisp
185 (use-package evil-surround
186 :config (global-evil-surround-mode))
189 #+begin_src emacs-lisp
190 (use-package evil-leader
191 :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
193 (evil-leader/set-leader "<SPC>")
194 (global-evil-leader-mode))
197 #+begin_src emacs-lisp
199 (use-package evil-nerd-commenter
200 :bind (:map evil-normal-state-map
201 ("gc" . evilnc-comment-or-uncomment-lines))
202 :custom (evilnc-invert-comment-line-by-line nil))
206 #+begin_src emacs-lisp
207 (evil-set-undo-system 'undo-redo)
209 ** Number incrementing
211 #+begin_src emacs-lisp
212 (use-package evil-numbers
213 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
214 :bind (:map evil-normal-state-map
215 ("C-M-a" . evil-numbers/inc-at-pt)
216 ("C-M-x" . evil-numbers/dec-at-pt)))
220 #+begin_src emacs-lisp
221 (use-package evil-org
223 :hook (org-mode . evil-org-mode)
225 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
226 (use-package evil-org-agenda
227 :straight (:type built-in)
229 :config (evil-org-agenda-set-keys))
232 #+begin_src emacs-lisp
233 (evil-leader/set-key-for-mode 'org-mode
234 "T" 'org-show-todo-tree
236 "c" 'org-archive-subtree)
240 #+begin_src emacs-lisp
242 :straight (:type built-in)
243 :commands (org-capture org-agenda)
246 (org-agenda-start-with-log-mode t)
247 (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
249 (org-log-into-drawer t)
250 (org-src-tab-acts-natively t)
251 (org-src-fontify-natively t)
252 (org-startup-indented t)
253 (org-hide-emphasis-markers t)
254 (org-fontify-whole-block-delimiter-line nil)
255 :bind ("C-c a" . org-agenda))
258 #+begin_src emacs-lisp
259 (use-package org-tempo
261 :straight (:type built-in)
263 ;; TODO: There's gotta be a more efficient way to write this
264 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
265 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
266 (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
267 (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
268 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
269 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
270 (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
271 (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
272 (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
273 (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
274 (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
275 (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")))
279 Simple, but not too simple autocompletion.
280 #+begin_src emacs-lisp
282 :bind (("C-s" . swiper)
283 :map ivy-minibuffer-map
284 ("TAB" . ivy-alt-done)
285 :map ivy-switch-buffer-map
286 ("M-d" . ivy-switch-buffer-kill))
290 #+begin_src emacs-lisp
291 (use-package ivy-rich
293 :config (ivy-rich-mode))
297 #+begin_src emacs-lisp
299 :bind (("C-M-j" . 'counsel-switch-buffer)
300 :map minibuffer-local-map
301 ("C-r" . 'counsel-minibuffer-history))
302 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
303 :config (counsel-mode))
305 ** Remember frequent commands
306 #+begin_src emacs-lisp
307 (use-package ivy-prescient
310 (ivy-prescient-enable-filtering nil)
312 (prescient-persist-mode)
313 (ivy-prescient-mode))
316 Better search utility.
317 #+begin_src emacs-lisp
322 Use elfeed for RSS. I have another file with all the feeds in it.
323 #+begin_src emacs-lisp
325 :bind (("C-c e" . elfeed))
327 (load "~/.emacs.d/feeds.el")
328 (add-hook 'elfeed-new-entry-hook
329 (elfeed-make-tagger :feed-url "youtube\\.com"
331 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
333 (use-package elfeed-goodies
335 :config (elfeed-goodies/setup))
338 Use mu4e for reading emails.
340 I use `offlineimap` to sync my maildirs. It is slower than mbsync, but is fast enough for me, especially when ran with the =-q= option.
342 Contexts are a not very well known feature of mu4e that makes it super easy to manage multiple accounts. Much better than some of the hacky methods and external packages that I've seen.
343 #+begin_src emacs-lisp
344 (use-package smtpmail
345 :straight (:type built-in))
347 :load-path "/usr/share/emacs/site-lisp/mu4e"
348 :straight (:build nil)
349 :bind (("C-c m" . mu4e))
351 (setq user-full-name "Armaan Bhojwani"
352 smtpmail-local-domain "armaanb.net"
353 smtpmail-stream-type 'ssl
354 smtpmail-smtp-service '465
355 mu4e-change-filenames-when-moving t
356 mu4e-get-mail-command "offlineimap -q"
357 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
358 message-citation-line-function 'message-insert-formatted-citation-line
359 mu4e-completing-read-function 'ivy-completing-read
360 mu4e-confirm-quit nil
361 mail-user-agent 'mu4e-user-agent
363 `( ,(make-mu4e-context
365 :enter-func (lambda () (mu4e-message "Entering school context"))
366 :leave-func (lambda () (mu4e-message "Leaving school context"))
367 :match-func (lambda (msg)
369 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
370 :vars '((user-mail-address . "abhojwani22@nobles.edu")
371 (mu4e-sent-folder . "/school/Sent")
372 (mu4e-drafts-folder . "/school/Drafts")
373 (mu4e-trash-folder . "/school/Trash")
374 (mu4e-refile-folder . "/school/Archive")
375 (user-mail-address . "abhojwani22@nobles.edu")
376 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
377 (smtpmail-smtp-server . "smtp.gmail.com")))
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 (smtpmail-smtp-user . "me@armaanb.net")
391 (smtpmail-smtp-server "smtp.mailbox.org")
392 (mu4e-drafts-folder . "/school/Drafts")
393 (mu4e-trash-folder . "/school/Trash")))))
394 (add-to-list 'mu4e-bookmarks
395 '(:name "Unified inbox"
396 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
398 :hook ((mu4e-compose-mode . flyspell-mode)
399 (mu4e-view-mode-hook . turn-on-visual-line-mode)))
402 Set EWW as default browser except for videos.
403 #+begin_src emacs-lisp
404 (defun browse-url-mpv (url &optional new-window)
406 (start-process "mpv" "*mpv*" "mpv" url))
408 (setq browse-url-handlers
410 (("youtu\\.?be" . browse-url-mpv)
411 ("peertube.*" . browse-url-mpv)
412 ("vid.*" . browse-url-mpv)
413 ("vid.*" . browse-url-mpv)
414 ("." . eww-browse-url)
418 Some EWW enhancements.
419 *** Give buffer a useful name
420 #+begin_src emacs-lisp
421 ;; From https://protesilaos.com/dotemacs/
422 (defun prot-eww--rename-buffer ()
423 "Rename EWW buffer using page title or URL.
424 To be used by `eww-after-render-hook'."
425 (let ((name (if (eq "" (plist-get eww-data :title))
426 (plist-get eww-data :url)
427 (plist-get eww-data :title))))
428 (rename-buffer (format "*%s # eww*" name) t)))
431 :straight (:type built-in)
432 :bind (("C-c w" . eww))
433 :hook (eww-after-render-hook prot-eww--rename-buffer))
435 *** Better entrypoint
436 #+begin_src emacs-lisp
437 ;; From https://protesilaos.com/dotemacs/
438 (defun prot-eww-browse-dwim (url &optional arg)
439 "Visit a URL, maybe from `eww-prompt-history', with completion.
441 With optional prefix ARG (\\[universal-argument]) open URL in a
444 If URL does not look like a valid link, run a web query using
447 When called from an eww buffer, provide the current link as
451 (completing-read "Query:" eww-prompt-history
452 nil nil (plist-get eww-data :url) 'eww-prompt-history)
454 (eww url (if arg 4 nil)))
456 (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
459 #+begin_src emacs-lisp
461 :straight (:type built-in)
463 (load "~/.emacs.d/irc.el")
465 (erc-notifications-enable)
466 (erc-smiley-disable))
468 (use-package erc-hl-nicks
469 :config (erc-hl-nicks-mode 1))
472 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to =emacsclient --eval "(emacs-everywhere)"=.
473 #+begin_src emacs-lisp
474 (use-package emacs-everywhere)
478 #+begin_src emacs-lisp
480 :hook (python-mode . blacken-mode)
481 :config (setq blacken-line-length 79))
484 (use-package ws-butler
485 :config (ws-butler-global-mode))
488 #+begin_src emacs-lisp
489 (use-package flycheck
490 :config (global-flycheck-mode))
492 ** Project management
493 #+begin_src emacs-lisp
494 (use-package projectile
495 :config (projectile-mode)
496 :custom ((projectile-completion-system 'ivy))
498 ("C-c p" . projectile-command-map)
500 (when (file-directory-p "~/Code")
501 (setq projectile-project-search-path '("~/Code")))
502 (setq projectile-switch-project-action #'projectile-dired))
504 (use-package counsel-projectile
506 :config (counsel-projectile-mode))
509 #+begin_src emacs-lisp
511 :straight (:type built-in)
512 :commands (dired dired-jump)
513 :custom ((dired-listing-switches "-agho --group-directories-first"))
514 :config (evil-collection-define-key 'normal 'dired-mode-map
515 "h" 'dired-single-up-directory
516 "l" 'dired-single-buffer))
518 (use-package dired-single
519 :commands (dired dired-jump))
521 (use-package dired-open
522 :commands (dired dired-jump)
523 :custom (dired-open-extensions '(("png" . "feh")
526 (use-package dired-hide-dotfiles
527 :hook (dired-mode . dired-hide-dotfiles-mode)
529 (evil-collection-define-key 'normal 'dired-mode-map
530 "H" 'dired-hide-dotfiles-mode))
534 # TODO: Write a command that commits hunk, skipping staging step.
535 #+begin_src emacs-lisp
538 *** Colored diff in line number area
539 #+begin_src emacs-lisp
541 :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
542 :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
543 (magit-post-refresh-hook . diff-hl-magit-post-refresh))
544 :config (global-diff-hl-mode))
546 * General text editing
548 Indent after every change.
549 #+begin_src emacs-lisp
550 (use-package aggressive-indent
551 :config (global-aggressive-indent-mode))
554 Spell check in text mode, and in prog-mode comments.
555 #+begin_src emacs-lisp
556 (dolist (hook '(text-mode-hook))
557 (add-hook hook (lambda () (flyspell-mode))))
558 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
559 (add-hook hook (lambda () (flyspell-mode -1))))
560 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
562 ** Expand tabs to spaces
563 #+begin_src emacs-lisp
564 (setq-default tab-width 2)
566 ** Copy kill ring to clipboard
567 #+begin_src emacs-lisp
568 (setq x-select-enable-clipboard t)
569 (defun copy-kill-ring-to-xorg ()
570 "Copy the current kill ring to the xorg clipboard."
572 (x-select-text (current-kill 0)))
575 Opens file where you left it.
576 #+begin_src emacs-lisp
580 Distraction free writing a la junegunn/goyo.
581 #+begin_src emacs-lisp
582 (use-package olivetti
584 (evil-leader/set-key "o" 'olivetti-mode))
588 #+begin_src emacs-lisp
589 (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
590 (setq save-abbrevs 'silent)
591 (setq-default abbrev-mode t)
594 #+begin_src emacs-lisp
595 (setq tramp-default-method "ssh")
597 ** Don't ask about following symlinks in vc
598 #+begin_src emacs-lisp
599 (setq vc-follow-symlinks t)
601 ** Don't ask to save custom dictionary
602 #+begin_src emacs-lisp
603 (setq ispell-silently-savep t)
607 #+begin_src emacs-lisp
608 (use-package ace-window
609 :bind ("M-o" . ace-window))
611 ** Kill current buffer
612 Makes "C-x k" binding faster.
613 #+begin_src emacs-lisp
614 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
618 #+begin_src emacs-lisp
619 (use-package scad-mode)
621 ** Control backup files
622 Stop backup files from spewing everywhere.
623 #+begin_src emacs-lisp
624 (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
626 ** Make yes/no easier
627 #+begin_src emacs-lisp
628 (defalias 'yes-or-no-p 'y-or-n-p)
630 ** Move customize file
631 No more clogging up init.el.
632 #+begin_src emacs-lisp
633 (setq custom-file "~/.emacs.d/custom.el")
637 #+begin_src emacs-lisp
639 :commands (helpful-callable helpful-variable helpful-command helpful-key)
641 (counsel-describe-function-function #'helpful-callable)
642 (counsel-describe-variable-function #'helpful-variable)
644 ([remap describe-function] . counsel-describe-function)
645 ([remap describe-command] . helpful-command)
646 ([remap describe-variable] . counsel-describe-variable)
647 ([remap describe-key] . helpful-key))
650 #+begin_src emacs-lisp
651 (use-package epa-file
652 :straight (:type built-in)
654 (epa-file-select-keys nil)
655 (epa-file-encrypt-to '("me@armaanb.net"))
656 (password-cache-expiry (* 60 15)))
658 (use-package pinentry
659 :config (pinentry-start))
662 #+begin_src emacs-lisp
664 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
665 :custom (0x0-default-service 'envs)
666 :config (evil-leader/set-key
668 "0f" '0x0-upload-file
669 "0s" '0x0-upload-string
670 "0c" '0x0-upload-kill-ring
671 "0p" '0x0-upload-popup))
676 #+begin_src conf :tangle ~/.spectrwm.conf
680 autorun = ws[1]:/home/armaa/Code/scripts/autostart
683 #+begin_src conf :tangle ~/.spectrwm.conf
685 bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
689 #+begin_src conf :tangle ~/.spectrwm.conf
690 program[term] = alacritty
691 program[screenshot_all] = flameshot gui
692 program[notif] = /home/armaa/Code/scripts/setter status
693 program[pass] = /home/armaa/Code/scripts/passmenu
696 bind[pass] = MOD+Shift+p
699 #+begin_src conf :tangle ~/.spectrwm.conf
700 program[paup] = /home/armaa/Code/scripts/setter audio +5
701 program[padown] = /home/armaa/Code/scripts/setter audio -5
702 program[pamute] = /home/armaa/Code/scripts/setter audio
703 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
704 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
705 program[next] = playerctl next
706 program[prev] = playerctl previous
707 program[pause] = playerctl play-pause
709 bind[padown] = XF86AudioLowerVolume
710 bind[paup] = XF86AudioRaiseVolume
711 bind[pamute] = XF86AudioMute
712 bind[brigdown] = XF86MonBrightnessDown
713 bind[brigup] = XF86MonBrightnessUp
714 bind[pause] = XF86AudioPlay
715 bind[next] = XF86AudioNext
716 bind[prev] = XF86AudioPrev
719 #+begin_src conf :tangle ~/.spectrwm.conf
720 program[h] = xdotool keyup h key --clearmodifiers Left
721 program[j] = xdotool keyup j key --clearmodifiers Down
722 program[k] = xdotool keyup k key --clearmodifiers Up
723 program[l] = xdotool keyup l key --clearmodifiers Right
725 bind[h] = MOD + Control + h
726 bind[j] = MOD + Control + j
727 bind[k] = MOD + Control + k
728 bind[l] = MOD + Control + l
731 #+begin_src conf :tangle ~/.spectrwm.conf
732 program[aerc] = alacritty -e aerc
733 program[catgirl] = alacritty --hold -e sh -c "while : ; do ssh root@armaanb.net -t abduco -A irc catgirl freenode; sleep 2; done"
734 program[emacs] = emacsclient -c
735 program[firefox] = firefox
736 program[calc] = alacritty -e because -l
737 program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
739 bind[aerc] = MOD+Control+1
740 bind[catgirl] = MOD+Control+2
741 bind[firefox] = MOD+Control+3
742 bind[emacs-anywhere] = MOD+Control+4
743 bind[calc] = MOD+Control+5
744 bind[emacs] = MOD+Control+Return
747 #+begin_src conf :tangle ~/.spectrwm.conf
748 quirk[Castle Menu] = FLOAT
754 #+begin_src shell :tangle ~/.config/zsh/zshrc
755 autoload -Uz compinit
759 unsetopt glob_complete
762 #+begin_src shell :tangle ~/.config/zsh/zshrc
766 bindkey -M vicmd "^[[3~" delete-char
767 bindkey "^[[3~" delete-char
769 autoload edit-command-line
770 zle -N edit-command-line
771 bindkey -M vicmd ^e edit-command-line
772 bindkey ^e edit-command-line
775 #+begin_src shell :tangle ~/.config/zsh/zshrc
776 setopt extended_history
778 setopt inc_append_history
779 setopt hist_ignore_dups
780 setopt hist_reduce_blanks
784 HISTFILE=~/.local/share/zsh/history
787 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
789 Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition.
791 #+begin_src conf :tangle ~/.config/zpe/repositories
792 https://github.com/zdharma/fast-syntax-highlighting
795 #+begin_src shell :tangle ~/.config/zsh/zshrc
796 source ~/Code/zpe/zpe.sh
797 source ~/Code/admone/admone.zsh
798 source ~/.config/zsh/fzf-bindings.zsh
800 zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
803 **** Time Zsh startup
804 #+begin_src shell :tangle ~/.config/zsh/zshrc
806 for i in $(seq 1 10); do time "$1" -i -c exit; done
809 **** Update all packages
810 #+begin_src shell :tangle ~/.config/zsh/zshrc
811 color=$(tput setaf 5)
815 sudo echo "${color}== upgrading with yay ==${reset}"
818 echo "${color}== checking for pacnew files ==${reset}"
821 echo "${color}== upgrading flatpaks ==${reset}"
824 echo "${color}== upgrading zsh plugins ==${reset}"
827 echo "${color}== updating nvim plugins ==${reset}"
828 nvim +PlugUpdate +PlugUpgrade +qall
829 echo "Updated nvim plugins"
831 echo "${color}You are entirely up to date!${reset}"
834 **** Clean all packages
835 #+begin_src shell :tangle ~/.config/zsh/zshrc
837 sudo echo "${color}== cleaning pacman orphans ==${reset}"
838 (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
840 echo "${color}== cleaning flatpaks ==${reset}"
841 flatpak remove --unused
843 echo "${color}== cleaning zsh plugins ==${reset}"
846 echo "${color}== cleaning nvim plugins ==${reset}"
847 nvim +PlugClean +qall
848 echo "Cleaned nvim plugins"
850 echo "${color}All orphans cleaned!${reset}"
854 #+begin_src shell :tangle ~/.config/zsh/zshrc
856 __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
857 if [ $? -eq 0 ]; then
858 eval "$__conda_setup"
860 if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
861 . "/opt/anaconda/etc/profile.d/conda.sh"
863 export PATH="/opt/anaconda/bin:$PATH"
869 **** Interact with 0x0
870 #+begin_src shell :tangle ~/.config/zsh/zshrc
871 zxz="https://envs.sh"
872 0file() { curl -F"file=@$1" "$zxz" ; }
873 0pb() { curl -F"file=@-;" "$zxz" ; }
874 0url() { curl -F"url=$1" "$zxz" ; }
875 0short() { curl -F"shorten=$1" "$zxz" ; }
876 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
879 #+begin_src shell :tangle ~/.config/zsh/zshrc
881 user=$(echo "$1" | cut -f 1 -d '@')
882 host=$(echo "$1" | cut -f 2 -d '@')
883 echo $user | nc "$host" 79 -N
886 **** Upload to ftp.armaanb.net
887 #+begin_src shell :tangle ~/.config/zsh/zshrc
889 rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
890 echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
895 #+begin_src shell :tangle ~/.config/zsh/zshrc
896 alias bhoji-drop='ssh -p 23 root@armaanb.net'
897 alias catgirl='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
898 alias union='ssh 192.168.1.18'
899 alias mine='ssh -p 23 root@pickupserver.cc'
900 alias tcf='ssh root@204.48.23.68'
901 alias ngmun='ssh root@157.245.89.25'
902 alias prox='ssh root@192.168.1.224'
903 alias ncq='ssh root@143.198.123.17'
904 alias dock='ssh root@192.168.1.225'
905 alias jenkins='ssh root@192.168.1.226'
906 alias envs='ssh acheam@envs.net'
909 #+begin_src shell :tangle ~/.config/zsh/zshrc
910 alias ls='exa -lh --icons --git --group-directories-first'
911 alias la='exa -lha --icons --git --group-directories-first'
912 alias df='df -h / /boot'
919 alias grep='grep -in --exclude-dir=.git --color=auto'
920 alias fname='find -name'
921 alias mkdir='mkdir -pv'
922 alias unar='atool -x'
923 alias wget='wget -e robots=off'
924 alias lanex='~/.local/share/lxc/lxc'
927 #+begin_src shell :tangle ~/.config/zsh/zshrc
930 alias vw="nvim ~/Documents/vimwiki/index.md"
932 **** System management
933 #+begin_src shell :tangle ~/.config/zsh/zshrc
934 alias jctl='journalctl -p 3 -xb'
935 alias pkill='pkill -i'
937 alias redoas='doas $(fc -ln -1)'
938 alias crontab='crontab-argh'
939 alias sudo='doas ' # allows aliases to be run with doas
940 alias pasu='git -C ~/.password-store push'
941 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
945 #+begin_src shell :tangle ~/.config/zsh/zshrc
946 alias ping='ping -c 10'
947 alias speed='speedtest-cli'
948 alias ip='ip --color=auto'
949 alias cip='curl https://armaanb.net/ip'
950 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
951 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
952 alias plan='T=$(mktemp) && \
953 rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
955 head -n -2 $T > $TT && \
957 echo "\nLast updated: $(date -R)" >> "$TT" && \
958 fold -sw 72 "$TT" > "$T"| \
959 rsync "$T" root@armaanb.net:/etc/finger/plan.txt'
960 alias wttr='curl -s "wttr.in/02445?n" | head -n -3'
963 #+begin_src shell :tangle ~/.config/zsh/zshrc
964 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
965 iflag=fullblock status=progress'
966 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
967 iflag=fullblock status=progress'
968 alias ts='gen-shell -c task'
969 alias ts='gen-shell -c task'
970 alias tetris='autoload -Uz tetriscurses && tetriscurses'
971 alias news='newsboat'
972 alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
973 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
974 --restrict-filenames -o '%(title)s.%(ext)s'"
975 alias cal="cal -3 --color=auto"
978 **** Virtual machines, chroots
979 #+begin_src shell :tangle ~/.config/zsh/zshrc
980 alias ckiss="sudo chrooter ~/Virtual/kiss"
981 alias cdebian="sudo chrooter ~/Virtual/debian bash"
982 alias cwindows='devour qemu-system-x86_64 \
987 -device VGA,vgamem_mb=64 \
991 -net user,smb=/home/armaa/Public \
992 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
995 #+begin_src shell :tangle ~/.config/zsh/zshrc
997 alias zpy="zconda && ipython"
998 alias math="ipython --profile=math"
999 alias pypi="python setup.py sdist && twine upload dist/*"
1000 alias pip="python -m pip"
1001 alias black="black -l 79"
1004 #+begin_src shell :tangle ~/.config/zsh/zshrc
1005 alias words='gen-shell -c "words"'
1006 alias words-e='gen-shell -c "words ~E"'
1009 #+begin_src shell :tangle ~/.config/zsh/zshrc
1010 alias zathura='devour zathura'
1011 alias mpv='devour mpv'
1012 alias sql='devour sqlitebrowser'
1013 alias cad='devour openscad'
1014 alias feh='devour feh'
1016 **** Package management (Pacman)
1017 #+begin_src shell :tangle ~/.config/zsh/zshrc
1019 alias api='yay -Syu'
1020 alias apii='sudo pacman -S'
1021 alias app='yay -Rns'
1023 alias apo='yay -Qttd'
1024 alias azf='pacman -Q | fzf'
1025 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1026 alias ufetch='ufetch-arch'
1027 alias reflect='reflector --verbose --sort rate --save \
1028 ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1030 **** Package management (KISS)
1031 #+begin_src shell :tangle ~/.config/zsh/zshrc
1032 alias kzf="kiss s \* | xargs -l basename | \
1033 fzf --preview 'kiss search {} | xargs -l dirname'"
1036 #+begin_src shell :tangle ~/.config/zsh/zshrc
1037 export EDITOR="emacsclient -c"
1038 export VISUAL="$EDITOR"
1039 export TERM=xterm-256color # for compatability
1041 export GPG_TTY="$(tty)"
1042 export MANPAGER='nvim +Man!'
1045 export GTK_USE_PORTAL=1
1047 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1048 export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
1049 export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
1050 export PATH="$PATH:/home/armaa/.cargo/bin"
1051 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1052 export PATH="$PATH:/usr/sbin"
1053 export PATH="$PATH:/opt/FreeTube/freetube"
1055 export LC_ALL="en_US.UTF-8"
1056 export LC_CTYPE="en_US.UTF-8"
1057 export LANGUAGE="en_US.UTF-8"
1059 export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
1060 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1061 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1062 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1063 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1064 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1068 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1071 family: JetBrains Mono Nerd Font
1078 ligatures: true # Requires ligature patch
1085 background_opacity: 1
1088 Modus vivendi. Source: https://github.com/ishan9299/Nixos/blob/d4bbb7536be95b59466bb9cca4d671be46e04e81/user/alacritty/alacritty.yml#L30-L118
1089 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1093 background: '#000000'
1094 foreground: '#ffffff'
1098 background: '#ffffff'
1100 # Normal colors (except green it is from intense colors)
1111 # Bright colors [all the faint colors in the modus theme]
1122 # dim [all the intense colors in modus theme]
1135 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1136 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1137 c.TerminalInteractiveShell.editing_mode = 'vi'
1138 c.InteractiveShell.colors = 'linux'
1139 c.TerminalInteractiveShell.confirm_exit = False
1142 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1146 return x * (180 / pi)
1149 return x * (pi / 180)
1152 return (x * (pi / 180)) / unit
1164 Make MPV play a little bit smoother.
1165 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1166 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1170 For any GNU Readline programs
1171 #+begin_src conf :tangle ~/.inputrc
1176 #+begin_src conf :tangle ~/.gitconfig
1178 name = Armaan Bhojwani
1179 email = me@armaanb.net
1180 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1183 #+begin_src conf :tangle ~/.gitconfig
1185 defaultBranch = main
1188 #+begin_src conf :tangle ~/.gitconfig
1193 #+begin_src conf :tangle ~/.gitconfig
1195 smtpserver = smtp.mailbox.org
1196 smtpuser = me@armaanb.net
1197 smtpencryption = ssl
1198 smtpserverport = 465
1202 #+begin_src conf :tangle ~/.gitconfig
1207 #+begin_src conf :tangle ~/.gitconfig
1210 sclone = clone --depth 1
1216 subup = submodule update --remote
1217 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1218 mirror = git config --global alias.mirrormirror
1219 pushnc = push -o skip-ci
1222 #+begin_src conf :tangle ~/.gitconfig
1228 Lightweight notification daemon.
1230 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1232 font = "JetBrains Mono Medium Nerd Font 11"
1234 format = "<b>%s</b>\n%b"
1236 indicate_hidden = yes
1239 show_age_threshold = 60
1242 geometry = "400x5-10+10"
1244 idle_threshold = 120
1246 sticky_history = yes
1248 separator_height = 1
1250 horizontal_padding = 8
1252 separator_color = "#ffffff"
1253 startup_notification = false
1256 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1263 close_all = mod4+shift+c
1264 history = mod4+ctrl+c
1267 background = "#222222"
1268 foreground = "#ffffff"
1269 highlight = "#ffffff"
1273 background = "#222222"
1274 foreground = "#ffffff"
1275 highlight = "#ffffff"
1279 background = "#222222"
1280 foreground = "#a60000"
1281 highlight = "#ffffff"
1286 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1288 map <A-b> toggle_statusbar
1289 set selection-clipboard clipboard
1292 set window-title-basename "true"
1293 set selection-clipboard "clipboard"
1296 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1297 set default-bg "#000000"
1298 set default-fg "#ffffff"
1299 set render-loading true
1300 set render-loading-bg "#000000"
1301 set render-loading-fg "#ffffff"
1303 set recolor-lightcolor "#000000" # bg
1304 set recolor-darkcolor "#ffffff" # fg
1308 *** Swap tab and URL bars
1309 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1311 -moz-box-ordinal-group: 1 !important;
1315 -moz-box-ordinal-group: 2 !important;
1319 -moz-box-ordinal-group: 3 !important;
1322 *** Hide URL bar when not focused.
1323 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1324 #navigator-toolbox:not(:focus-within):not(:hover) {
1328 #navigator-toolbox {
1329 transition: 0.1s margin-top ease-out;
1332 ** Black screen by default
1333 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1336 #browser vbox#appcontent tabbrowser,
1338 #tabbrowser-tabpanels,
1340 browser[type="content-primary"],
1341 browser[type="content"] > html,
1343 background: black !important;
1344 color: #fff !important;
1347 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1348 @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1350 background: black !important;
1357 #+begin_src conf :tangle ~/.Xresources
1359 ,*.foreground: #ffffff
1360 ,*.background: #000000
1361 ,*.cursorColor: #ffffff
1396 #+begin_src conf :tangle ~/.Xresources
1397 xterm*VT100.Translations: #override \
1398 Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
1399 Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
1400 Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
1401 Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
1404 #+begin_src conf :tangle ~/.Xresources
1405 xterm*cursorBlink: true
1408 #+begin_src conf :tangle ~/.Xresources
1409 XTerm*eightBitInput: false
1410 XTerm*eightBitOutput: true