1 #+TITLE: System Configuration
2 #+DESCRIPTION: Armaan's system configuration.
5 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!
7 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.
9 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.
11 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.
13 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.
15 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
16 *** TODO Put configs with passwords in here with some kind of authentication
20 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work at the snippet.
22 ** Bootstrap straight.el
23 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
24 #+begin_src emacs-lisp
25 (defvar bootstrap-version)
27 (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
28 (bootstrap-version 5))
29 (unless (file-exists-p bootstrap-file)
31 (url-retrieve-synchronously
32 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
33 'silent 'inhibit-cookies)
34 (goto-char (point-max))
35 (eval-print-last-sexp)))
36 (load bootstrap-file nil 'nomessage))
38 ** Replace use-package with straight
39 #+begin_src emacs-lisp
40 (straight-use-package 'use-package)
41 (setq straight-use-package-by-default t)
45 Very nice high contrast theme.
47 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.
48 #+begin_src emacs-lisp
49 (setq modus-themes-slanted-constructs t
50 modus-themes-bold-constructs t
51 modus-themes-org-blocks 'rainbow
52 modus-themes-mode-line '3d
53 modus-themes-scale-headings t
54 modus-themes-region 'no-extend
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")
68 :load-path "path-to-ligature-repo"
70 (ligature-set-ligatures 'prog-mode '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" "/=="
71 "/>" "//" "/*" "*>" "***" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
72 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>" "<-|"
73 "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>" "</" "<*"
74 "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>" ":=" "::=" "=>>"
75 "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!==" "!!" "!=" ">]" ">:"
76 ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]"
77 "|}" "|=>" "|->" "|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<"
78 "..." "+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" "##"
79 "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_"
80 "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
81 (global-ligature-mode t))
84 #+begin_src emacs-lisp
86 :config (global-emojify-mode))
88 ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
93 ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
94 ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
95 ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
98 Display relative line numbers except in some modes
99 #+begin_src emacs-lisp
100 (global-display-line-numbers-mode)
101 (setq display-line-numbers-type 'relative)
102 (dolist (no-line-num '(term-mode-hook
107 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
109 ** Highlight matching parenthesis
110 #+begin_src emacs-lisp
112 :config (show-paren-mode)
113 :custom (show-paren-style 'parenthesis))
116 *** Show current function
117 #+begin_src emacs-lisp
118 (which-function-mode)
120 *** Make position in file more descriptive
121 Show current column and file size.
122 #+begin_src emacs-lisp
124 (size-indication-mode)
127 #+begin_src emacs-lisp
129 :config (minions-mode))
132 Show a ruler at a certain number of chars depending on mode.
133 #+begin_src emacs-lisp
134 (global-display-fill-column-indicator-mode)
137 Whenever starting a key chord, show possible future steps.
138 #+begin_src emacs-lisp
139 (use-package which-key
140 :config (which-key-mode)
141 :custom (which-key-idle-delay 0.3))
143 ** Visual highlights of changes
144 Highlight when changes are made.
145 #+begin_src emacs-lisp
146 (use-package evil-goggles
147 :config (evil-goggles-mode)
148 (evil-goggles-use-diff-faces))
150 ** Highlight "TODO" comments
151 #+begin_src emacs-lisp
153 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
154 :config (global-hl-todo-mode))
157 #+begin_src emacs-lisp
161 Soft wrap words and do operations by visual lines.
162 #+begin_src emacs-lisp
163 (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
165 ** Display number of matches in search
166 #+begin_src emacs-lisp
168 :config (global-anzu-mode))
171 Inverts modeline instead of audible bell or the standard visual bell.
172 #+begin_src emacs-lisp
173 (setq visible-bell nil
174 ring-bell-function 'flash-mode-line)
175 (defun flash-mode-line ()
176 (invert-face 'mode-line)
177 (run-with-timer 0.1 nil #'invert-face 'mode-line))
181 #+begin_src emacs-lisp
183 :custom (select-enable-clipboard nil)
186 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
187 ;; Use visual line motions even outside of visual-line-mode buffers
188 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
189 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
190 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
193 #+begin_src emacs-lisp
194 (use-package evil-collection
196 :init (evil-collection-init)
197 :custom (evil-collection-setup-minibuffer t))
201 #+begin_src emacs-lisp
202 (use-package evil-surround
203 :config (global-evil-surround-mode))
206 #+begin_src emacs-lisp
207 (use-package evil-leader
208 :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
210 (evil-leader/set-leader "<SPC>")
211 (global-evil-leader-mode))
214 #+begin_src emacs-lisp
216 (use-package evil-nerd-commenter
217 :bind (:map evil-normal-state-map
218 ("gc" . evilnc-comment-or-uncomment-lines))
219 :custom (evilnc-invert-comment-line-by-line nil))
223 #+begin_src emacs-lisp
224 (use-package undo-tree
226 (undo-tree-auto-save-history t)
227 (undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree")))
229 (global-undo-tree-mode)
230 (evil-set-undo-system 'undo-tree))
232 ** Number incrementing
234 #+begin_src emacs-lisp
235 (use-package evil-numbers
236 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
237 :bind (:map evil-normal-state-map
238 ("C-M-a" . evil-numbers/inc-at-pt)
239 ("C-M-x" . evil-numbers/dec-at-pt)))
243 #+begin_src emacs-lisp
244 (use-package evil-org
246 :hook (org-mode . evil-org-mode)
248 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
249 (use-package evil-org-agenda
250 :straight (:type built-in)
253 (evil-org-agenda-set-keys))
256 #+begin_src emacs-lisp
257 (evil-leader/set-key-for-mode 'org-mode
258 "T" 'org-show-todo-tree
260 "c" 'org-archive-subtree)
264 #+begin_src emacs-lisp
266 :straight (:type built-in)
267 :commands (org-capture org-agenda)
269 (org-ellipsis " â–¾")
270 (org-agenda-start-with-log-mode t)
272 (org-log-into-drawer t)
273 (org-src-tab-acts-natively t)
274 (org-startup-indented t)
275 (org-hide-emphasis-markers t)
276 (org-fontify-whole-block-delimiter-line nil))
278 ** Automatically tangle
279 #+begin_src emacs-lisp
280 (add-hook 'org-mode-hook
281 (lambda () (add-hook 'after-save-hook #'org-babel-tangle
285 #+begin_src emacs-lisp
286 (use-package org-tempo
288 :straight (:type built-in)
290 ;; TODO: There's gotta be a more efficient way to write this
291 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
292 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
293 (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
294 (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
295 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
296 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
297 (add-to-list 'org-structure-template-alist '("git" . "src plain :tangle ~/.gitconfig")))
301 Simple, but not too simple autocompletion.
302 #+begin_src emacs-lisp
304 :bind (("C-s" . swiper)
305 :map ivy-minibuffer-map
306 ("TAB" . ivy-alt-done)
307 :map ivy-switch-buffer-map
308 ("C-d" . ivy-switch-buffer-kill))
312 #+begin_src emacs-lisp
313 (use-package ivy-rich
315 :config (ivy-rich-mode))
319 #+begin_src emacs-lisp
321 :bind (("C-M-j" . 'counsel-switch-buffer)
322 :map minibuffer-local-map
323 ("C-r" . 'counsel-minibuffer-history))
324 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
325 :config (counsel-mode))
327 ** Remember frequent commands
328 #+begin_src emacs-lisp
329 (use-package ivy-prescient
332 (ivy-prescient-enable-filtering nil)
334 (prescient-persist-mode)
335 (ivy-prescient-mode))
338 Better search utility.
339 #+begin_src emacs-lisp
344 Use elfeed for RSS. I have another file with all the feeds in it.
345 #+begin_src emacs-lisp
347 :bind (("C-c e" . elfeed))
349 (load "~/.emacs.d/feeds.el")
350 (add-hook 'elfeed-new-entry-hook
351 (elfeed-make-tagger :feed-url "youtube\\.com"
353 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
355 (use-package elfeed-goodies
357 :config (elfeed-goodies/setup))
360 Use mu4e for reading emails.
362 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.
364 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.
365 #+begin_src emacs-lisp
366 (use-package smtpmail
367 :straight (:type built-in))
369 :load-path "/usr/share/emacs/site-lisp/mu4e"
370 :bind (("C-c m" . mu4e))
373 (setq user-full-name "Armaan Bhojwani"
374 smtpmail-local-domain "armaanb.net"
375 smtpmail-stream-type 'ssl
376 smtpmail-smtp-service '465
377 mu4e-change-filenames-when-moving t
378 message-kill-buffer-on-exit t
379 mu4e-get-mail-command "offlineimap -q"
380 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
381 message-citation-line-function 'message-insert-formatted-citation-line
382 mu4e-context-policy "pick-first"
384 `( ,(make-mu4e-context
386 :enter-func (lambda () (mu4e-message "Entering school context"))
387 :leave-func (lambda () (mu4e-message "Leaving school context"))
388 :match-func (lambda (msg)
390 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
391 :vars '( (user-mail-address . "abhojwani22@nobles.edu")
392 (mu4e-sent-folder . "/school/Sent")
393 (mu4e-drafts-folder . "/school/Drafts")
394 (mu4e-trash-folder . "/school/Trash")
395 (mu4e-refile-folder . "/school/Archive")
396 (user-mail-address . "abhojwani22@nobles.edu")
397 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
398 (smtpmail-smtp-server . "smtp.gmail.com")))
401 :enter-func (lambda () (mu4e-message "Entering personal context"))
402 :leave-func (lambda () (mu4e-message "Leaving personal context"))
403 :match-func (lambda (msg)
405 (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
407 (mu4e-sent-folder . "/personal/Sent")
408 (mu4e-drafts-folder . "/personal/Drafts")
409 (mu4e-trash-folder . "/personal/Trash")
410 (mu4e-refile-folder . "/personal/Archive")
411 (user-mail-address . "me@armaanb.net")
412 (smtpmail-smtp-user . "me@armaanb.net")
413 (smtpmail-smtp-server "smtp.mailbox.org")
414 (mu4e-drafts-folder . "/school/Drafts")
415 (mu4e-trash-folder . "/school/Trash")))))
417 (add-to-list 'mu4e-bookmarks
419 :name "Unified inbox"
420 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
424 #+begin_src emacs-lisp
426 (use-package calfw-org)
427 (use-package calfw-ical)
429 (defun acheam-calendar ()
432 (shell-command "vdirsyncer sync")
433 (let ((default-directory "~/.local/share/vdirsyncer/"))
434 (cfw:open-calendar-buffer
437 (cfw:ical-create-source "School" (expand-file-name "school/abhojwani22@nobles.edu.ics") "Green")
438 (cfw:ical-create-source "Personal" (expand-file-name "mailbox/Y2FsOi8vMC8zMQ.ics") "Blue")
439 (cfw:ical-create-source "Birthdays" (expand-file-name "mailbox/Y2FsOi8vMS8w.ics") "Gray")
443 Another file has more specific network configuration.
444 #+begin_src emacs-lisp
447 (load "~/.emacs.d/irc.el"))
448 (use-package circe-color-nicks
450 :straight (:type built-in))
451 (use-package circe-chanop
453 :straight (:type built-in))
456 Set EWW as default browser except for videos
457 #+begin_src emacs-lisp
458 (defun browse-url-mpv (url &optional new-window)
460 (start-process "mpv" "*mpv*" "mpv" url))
462 (setq browse-url-browser-function
464 (("youtu\\.?be" . browse-url-mpv)
465 ("." . eww-browse-url))))
468 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
469 "emacsclient --eval "(emacs-everywhere)".
470 #+begin_src emacs-lisp
471 (use-package emacs-everywhere)
476 #+begin_src emacs-lisp
477 (use-package lsp-mode
478 :commands (lsp lsp-deferred)
479 :custom (lsp-keymap-prefix "C-c l")
480 :hook ((lsp-mode . lsp-enable-which-key-integration)))
482 (use-package lsp-ivy)
485 :commands lsp-ui-mode
486 :custom (lsp-ui-doc-position 'bottom))
487 (use-package lsp-ui-flycheck
489 :straight (:type built-in))
492 Company-box adds icons.
493 #+begin_src emacs-lisp
496 :hook (lsp-mode . company-mode)
497 :bind (:map company-active-map
498 ("<tab>" . company-complete-selection))
500 ("<tab>" . company-indent-or-complete-common))
502 (company-minimum-prefix-length 1)
503 (setq company-dabbrev-downcase 0)
504 (company-idle-delay 0.0))
506 (use-package company-box
507 :hook (company-mode . company-box-mode))
511 #+begin_src emacs-lisp
512 (use-package lsp-pyright
513 :hook (python-mode . (lambda ()
514 (use-package lsp-pyright
515 :straight (:type built-in))
519 #+begin_src emacs-lisp
521 :hook (python-mode . blacken-mode)
523 (setq blacken-line-length 79))
526 (use-package ws-butler
528 (ws-butler-global-mode))
531 #+begin_src emacs-lisp
532 (use-package flycheck
534 (global-flycheck-mode))
536 ** Project management
537 #+begin_src emacs-lisp
538 (use-package projectile
539 :config (projectile-mode)
540 :custom ((projectile-completion-system 'ivy))
542 ("C-c p" . projectile-command-map)
544 (when (file-directory-p "~/Code")
545 (setq projectile-project-search-path '("~/Code")))
546 (setq projectile-switch-project-action #'projectile-dired))
548 (use-package counsel-projectile
550 :config (counsel-projectile-mode))
553 #+begin_src emacs-lisp
555 :straight (:type built-in)
556 :commands (dired dired-jump)
557 :custom ((dired-listing-switches "-agho --group-directories-first"))
559 (evil-collection-define-key 'normal 'dired-mode-map
560 "h" 'dired-single-up-directory
561 "l" 'dired-single-buffer))
563 (use-package dired-single
564 :commands (dired dired-jump))
566 (use-package dired-open
567 :commands (dired dired-jump)
569 (dired-open-extensions '(("png" . "feh")
572 (use-package dired-hide-dotfiles
573 :hook (dired-mode . dired-hide-dotfiles-mode)
575 (evil-collection-define-key 'normal 'dired-mode-map
576 "H" 'dired-hide-dotfiles-mode))
580 #+begin_src emacs-lisp
582 :hook (git-commit-setup-hook . pinentry-start))
584 *** Colored diff in line number area
585 #+begin_src emacs-lisp
587 :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
588 :config (global-diff-hl-mode))
591 ** Easily convert splits
592 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
593 #+begin_src emacs-lisp
594 (defun toggle-window-split ()
596 (if (= (count-windows) 2)
597 (let* ((this-win-buffer (window-buffer))
598 (next-win-buffer (window-buffer (next-window)))
599 (this-win-edges (window-edges (selected-window)))
600 (next-win-edges (window-edges (next-window)))
601 (this-win-2nd (not (and (<= (car this-win-edges)
602 (car next-win-edges))
603 (<= (cadr this-win-edges)
604 (cadr next-win-edges)))))
606 (if (= (car this-win-edges)
607 (car (window-edges (next-window))))
608 'split-window-horizontally
609 'split-window-vertically)))
610 (delete-other-windows)
611 (let ((first-win (selected-window)))
613 (if this-win-2nd (other-window 1))
614 (set-window-buffer (selected-window) this-win-buffer)
615 (set-window-buffer (next-window) next-win-buffer)
616 (select-window first-win)
617 (if this-win-2nd (other-window 1))))))
619 (define-key ctl-x-4-map "t" 'toggle-window-split)
622 #+begin_src emacs-lisp
623 (defun insert-date ()
625 (insert (format-time-string "%Y-%m-%d")))
629 #+begin_src emacs-lisp
630 (use-package ace-window
631 :bind ("M-o" . ace-window))
633 ** Kill current buffer
634 Makes "C-x k" binding faster.
635 #+begin_src emacs-lisp
636 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
640 Opens file where you left it.
641 #+begin_src emacs-lisp
645 Render OpenSCAD files, and add a preview window.
647 Personal fork just merges a PR.
648 #+begin_src emacs-lisp
649 (use-package scad-mode)
650 (use-package scad-preview
651 :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
654 Distraction free writing a la junegunn/goyo.
655 #+begin_src emacs-lisp
656 (use-package olivetti
658 (evil-leader/set-key "o" 'olivetti-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")))
667 #+begin_src emacs-lisp
668 (setq abbrev-file-name "~/.emacs.d/abbrevs")
669 (setq save-abbrevs 'silent)
670 (setq-default abbrev-mode t)
672 ** Expand tabs to spaces
673 #+begin_src emacs-lisp
674 (setq-default tab-width 2)
676 ** Make yes/no easier
677 #+begin_src emacs-lisp
678 (defalias 'yes-or-no-p 'y-or-n-p)
680 ** Move customize file
681 No more clogging up init.el.
682 #+begin_src emacs-lisp
683 (setq custom-file "~/.emacs.d/custom.el")
687 #+begin_src emacs-lisp
689 :commands (helpful-callable helpful-variable helpful-command helpful-key)
691 (counsel-describe-function-function #'helpful-callable)
692 (counsel-describe-variable-function #'helpful-variable)
694 ([remap describe-function] . counsel-describe-function)
695 ([remap describe-command] . helpful-command)
696 ([remap describe-variable] . counsel-describe-variable)
697 ([remap describe-key] . helpful-key))
700 #+begin_src emacs-lisp
701 (use-package epa-file
702 :straight (:type built-in))
703 (setq epa-file-select-keys nil
704 epa-file-encrypt-to '("me@armaanb.net")
705 password-cache-expiry (* 60 15))
707 (use-package pinentry)
710 #+begin_src emacs-lisp
712 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
713 :custom (0x0-default-service 'envs)
714 :config (evil-leader/set-key
716 "0f" '0x0-upload-file
717 "0s" '0x0-upload-string
718 "0c" '0x0-upload-kill-ring
719 "0p" '0x0-upload-popup))
721 ** Copy kill ring to clipboard
722 #+begin_src emacs-lisp
723 (setq x-select-enable-clipboard t)
724 (defun copy-kill-ring-to-xorg ()
725 "Copy the current kill ring to the xorg clipboard."
727 (x-select-text (current-kill 0)))
730 #+begin_src emacs-lisp
731 (use-package browse-kill-ring)
736 #+begin_src conf :tangle ~/.spectrwm.conf
742 autorun = ws[1]:/home/armaa/Code/scripts/autostart
746 #+begin_src conf :tangle ~/.spectrwm.conf
747 color_focus = rgb:83/a5/98
748 color_focus_maximized = rgb:d6/5d/0e
749 color_unfocus = rgb:58/58/58
752 bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
756 #+begin_src conf :tangle ~/.spectrwm.conf
757 program[lock] = i3lock -c 000000 -ef
758 program[term] = alacritty
759 program[screenshot_all] = flameshot gui
760 program[menu] = rofi -show run # `rofi-dmenu` handles the rest
761 program[switcher] = rofi -show window
762 program[notif] = /home/armaa/Code/scripts/setter status
765 bind[switcher] = MOD+Tab
768 #+begin_src conf :tangle ~/.spectrwm.conf
769 program[paup] = /home/armaa/Code/scripts/setter audio +5
770 program[padown] = /home/armaa/Code/scripts/setter audio -5
771 program[pamute] = /home/armaa/Code/scripts/setter audio
772 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
773 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
774 program[next] = playerctl next
775 program[prev] = playerctl previous
776 program[pause] = playerctl play-pause
778 bind[padown] = XF86AudioLowerVolume
779 bind[paup] = XF86AudioRaiseVolume
780 bind[pamute] = XF86AudioMute
781 bind[brigdown] = XF86MonBrightnessDown
782 bind[brigup] = XF86MonBrightnessUp
783 bind[pause] = XF86AudioPlay
784 bind[next] = XF86AudioNext
785 bind[prev] = XF86AudioPrev
788 #+begin_src conf :tangle ~/.spectrwm.conf
789 program[h] = xdotool keyup h key --clearmodifiers Left
790 program[j] = xdotool keyup j key --clearmodifiers Down
791 program[k] = xdotool keyup k key --clearmodifiers Up
792 program[l] = xdotool keyup l key --clearmodifiers Right
794 bind[h] = MOD + Control + h
795 bind[j] = MOD + Control + j
796 bind[k] = MOD + Control + k
797 bind[l] = MOD + Control + l
800 #+begin_src conf :tangle ~/.spectrwm.conf
801 program[aerc] = alacritty -e aerc
802 program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
803 program[emacs] = emacsclient -c
804 program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
805 program[firefox] = firefox
806 program[thunderbird] = thunderbird
807 program[slack] = slack
809 bind[aerc] = MOD+Control+s
810 bind[weechat] = MOD+Control+d
811 bind[emacs] = MOD+Control+f
812 bind[emacs-anywhere] = MOD+f
813 bind[firefox] = MOD+Control+u
814 bind[thunderbird] = MOD+Control+i
815 bind[slack] = MOD+Control+o
820 #+begin_src shell :tangle ~/.config/zsh/zshrc
821 autoload -Uz compinit
825 unsetopt glob_complete
828 #+begin_src shell :tangle ~/.config/zsh/zshrc
832 bindkey -M vicmd "^[[3~" delete-char
833 bindkey "^[[3~" delete-char
835 autoload edit-command-line
836 zle -N edit-command-line
837 bindkey -M vicmd ^e edit-command-line
838 bindkey ^e edit-command-line
841 #+begin_src shell :tangle ~/.config/zsh/zshrc
842 setopt extended_history
844 setopt inc_append_history
845 setopt hist_ignore_dups
846 setopt hist_reduce_blanks
850 HISTFILE=~/.local/share/zsh/history
853 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
855 #+begin_src plain :tangle ~/.config/zpe/repositories
856 https://github.com/Aloxaf/fzf-tab
857 https://github.com/zdharma/fast-syntax-highlighting
858 https://github.com/rupa/z
861 #+begin_src shell :tangle ~/.config/zsh/zshrc
862 source ~/Code/zpe/zpe.sh
863 source ~/Code/admone/admone.zsh
864 source ~/.config/zsh/fzf-bindings.zsh
866 zpe-source fzf-tab/fzf-tab.zsh
867 zstyle ':completion:*:descriptions' format '[%d]'
868 zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
869 zstyle ':completion:*' completer _complete
870 zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
871 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
873 zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
874 export _Z_DATA="/home/armaa/.local/share/z"
878 **** Alert after long command
879 #+begin_src shell :tangle ~/.config/zsh/zshrc
881 notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
882 ${history[$HISTCMD]%[;&|][[:space:]]##alert}
885 **** Time Zsh startup
886 #+begin_src shell :tangle ~/.config/zsh/zshrc
888 for i in $(seq 1 10); do
889 time "zsh" -i -c exit;
893 **** Update all packages
894 #+begin_src shell :tangle ~/.config/zsh/zshrc
895 color=$(tput setaf 5)
899 sudo echo "${color}== upgrading with yay ==${reset}"
902 echo "${color}== checking for pacnew files ==${reset}"
905 echo "${color}== upgrading flatpaks ==${reset}"
908 echo "${color}== upgrading zsh plugins ==${reset}"
911 echo "${color}== updating nvim plugins ==${reset}"
912 nvim +PlugUpdate +PlugUpgrade +qall
913 echo "Updated nvim plugins"
915 echo "${color}You are entirely up to date!${reset}"
918 **** Clean all packages
919 #+begin_src shell :tangle ~/.config/zsh/zshrc
921 sudo echo "${color}== cleaning pacman orphans ==${reset}"
922 (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
924 echo "${color}== cleaning flatpaks ==${reset}"
925 flatpak remove --unused
927 echo "${color}== cleaning zsh plugins ==${reset}"
930 echo "${color}== cleaning nvim plugins ==${reset}"
931 nvim +PlugClean +qall
932 echo "Cleaned nvim plugins"
934 echo "${color}All orphans cleaned!${reset}"
938 #+begin_src shell :tangle ~/.config/zsh/zshrc
941 exa -lh --icons --git --group-directories-first
945 #+begin_src shell :tangle ~/.config/zsh/zshrc
947 __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
948 if [ $? -eq 0 ]; then
949 eval "$__conda_setup"
951 if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
952 . "/opt/anaconda/etc/profile.d/conda.sh"
954 export PATH="/opt/anaconda/bin:$PATH"
960 **** Interact with 0x0
961 #+begin_src shell :tangle ~/.config/zsh/zshrc
962 zxz="https://envs.sh"
963 0file() { curl -F"file=@$1" "$zxz" ; }
964 0pb() { curl -F"file=@-;" "$zxz" ; }
965 0url() { curl -F"url=$1" "$zxz" ; }
966 0short() { curl -F"shorten=$1" "$zxz" ; }
967 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
970 #+begin_src shell :tangle ~/.config/zsh/zshrc
979 #+begin_src shell :tangle ~/.config/zsh/zshrc
980 alias bhoji-drop='ssh -p 23 root@armaanb.net'
981 alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
982 alias tcf='ssh root@204.48.23.68'
983 alias ngmun='ssh root@157.245.89.25'
984 alias prox='ssh root@192.168.1.224'
985 alias dock='ssh root@192.168.1.225'
986 alias jenkins='ssh root@192.168.1.226'
987 alias envs='ssh acheam@envs.net'
990 #+begin_src shell :tangle ~/.config/zsh/zshrc
991 alias ls='exa -lh --icons --git --group-directories-first'
992 alias la='exa -lha --icons --git --group-directories-first'
993 alias df='df -h / /boot'
1000 alias grep='grep -in --exclude-dir=.git --color=auto'
1001 alias mkdir='mkdir -pv'
1002 alias unar='atool -x'
1003 alias wget='wget -e robots=off'
1004 alias lanex='~/.local/share/lxc/lxc'
1007 #+begin_src shell :tangle ~/.config/zsh/zshrc
1008 alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1009 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1011 alias padu='padm add -u && padm commit && padm push && yadu'
1014 #+begin_src shell :tangle ~/.config/zsh/zshrc
1017 alias vw="nvim ~/Documents/vimwiki/index.md"
1019 **** System management
1020 #+begin_src shell :tangle ~/.config/zsh/zshrc
1021 alias jctl='journalctl -p 3 -xb'
1022 alias pkill='pkill -i'
1024 alias please='sudo $(fc -ln -1)'
1025 alias sudo='sudo ' # allows aliases to be run with sudo
1028 #+begin_src shell :tangle ~/.config/zsh/zshrc
1029 alias ping='ping -c 10'
1030 alias speed='speedtest-cli'
1031 alias ip='ip --color=auto'
1032 alias cip='curl https://armaanb.net/ip'
1033 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1034 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1037 #+begin_src shell :tangle ~/.config/zsh/zshrc
1038 alias dc='docker-compose'
1039 alias dcdu='docker-compose down && docker-compose up -d'
1042 #+begin_src shell :tangle ~/.config/zsh/zshrc
1043 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1044 iflag=fullblock status=progress'
1045 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1046 iflag=fullblock status=progress'
1047 alias ts='gen-shell -c task'
1048 alias ts='gen-shell -c task'
1049 alias tetris='autoload -Uz tetriscurses && tetriscurses'
1050 alias news='newsboat'
1051 alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1052 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
1053 --restrict-filenames -o '%(title)s.%(ext)s'"
1054 alias cal="cal -3 --color=auto"
1056 **** Virtual machines, chroots
1057 #+begin_src shell :tangle ~/.config/zsh/zshrc
1058 alias ckiss="sudo chrooter ~/Virtual/kiss"
1059 alias cdebian="sudo chrooter ~/Virtual/debian bash"
1060 alias cwindows='devour qemu-system-x86_64 \
1065 -device VGA,vgamem_mb=64 \
1067 -device hda-duplex \
1069 -net user,smb=/home/armaa/Public \
1070 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1073 #+begin_src shell :tangle ~/.config/zsh/zshrc
1075 alias zpy="zconda && ipython"
1076 alias math="ipython --profile=math"
1077 alias pypi="python setup.py sdist && twine upload dist/*"
1078 alias pip="python -m pip"
1079 alias black="black -l 79"
1082 #+begin_src shell :tangle ~/.config/zsh/zshrc
1083 alias words='gen-shell -c "words"'
1084 alias words-e='gen-shell -c "words ~E"'
1087 #+begin_src shell :tangle ~/.config/zsh/zshrc
1088 alias zathura='devour zathura'
1089 alias mpv='devour mpv'
1090 alias sql='devour sqlitebrowser'
1091 alias cad='devour openscad'
1092 alias feh='devour feh'
1094 **** Package management (Pacman)
1095 #+begin_src shell :tangle ~/.config/zsh/zshrc
1097 alias api='yay -Syu'
1098 alias app='yay -Rns'
1100 alias apo='yay -Qttd'
1101 alias azf='pacman -Q | fzf'
1102 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1103 alias ufetch='ufetch-arch'
1104 alias reflect='reflector --verbose --sort rate --save \
1105 ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1108 #+begin_src shell :tangle ~/.config/zsh/zshrc
1109 export EDITOR="emacsclient -c" # $EDITOR opens in terminal
1110 export VISUAL="emacsclient -c -a emacs" # $VISUAL opens in GUI mode
1111 export TERM=xterm-256color # for compatability
1113 export GPG_TTY="$(tty)"
1114 export MANPAGER='nvim +Man!'
1117 # generated with "vivid generate gruvbox"
1118 export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1120 export GTK_USE_PORTAL=1
1122 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1123 export PATH="$PATH:/home/armaa/Code/scripts"
1124 export PATH="$PATH:/home/armaa/.cargo/bin"
1125 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1126 export PATH="$PATH:/usr/sbin"
1127 export PATH="$PATH:/opt/FreeTube/freetube"
1129 export LC_ALL="en_US.UTF-8"
1130 export LC_CTYPE="en_US.UTF-8"
1131 export LANGUAGE="en_US.UTF-8"
1133 export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1134 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1135 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1136 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1137 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1138 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1142 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1145 family: JetBrains Mono Nerd Font
1152 ligatures: true # Requires ligature patch
1159 background_opacity: 0.6
1162 Send <RET> + modifier through
1163 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1178 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1182 background: '#000000'
1183 foreground: '#ebdbb2'
1209 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1210 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1211 c.TerminalInteractiveShell.editing_mode = 'vi'
1212 c.InteractiveShell.colors = 'linux'
1213 c.TerminalInteractiveShell.confirm_exit = False
1216 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1220 return x * (180 / pi)
1223 return x * (pi / 180)
1226 return (x * (pi / 180)) / unit
1238 Make MPV play a little bit smoother.
1239 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1240 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1245 #+begin_src conf :tangle ~/.config/picom/picom.conf
1248 shadow-offset-x = -5;
1249 shadow-offset-y = -5;
1252 #+begin_src conf :tangle ~/.config/picom/picom.conf
1257 #+begin_src conf :tangle ~/.config/picom/picom.conf
1260 method = "gaussian";
1266 Needs picom to be run with "--experimental-backends"
1267 #+begin_src conf :tangle ~/.config/picom/picom.conf
1271 For any GNU Readline programs
1272 #+begin_src plain :tangle ~/.inputrc
1276 https://github.com/sharkdp/vivid
1278 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1280 background_color: '282A36'
1292 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1309 missing_symlink_target:
1335 sticky_other_writable:
1368 continuous-integration:
1379 font-style: underline
1390 #+begin_src plain :tangle ~/.gitconfig
1392 name = Armaan Bhojwani
1393 email = me@armaanb.net
1394 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1397 #+begin_src plain :tangle ~/.gitconfig
1399 defaultBranch = main
1402 #+begin_src plain :tangle ~/.gitconfig
1407 #+begin_src plain :tangle ~/.gitconfig
1409 smtpserver = smtp.mailbox.org
1410 smtpuser = me@armaanb.net
1411 smtpencryption = ssl
1412 smtpserverport = 465
1416 #+begin_src plain :tangle ~/.gitconfig
1421 #+begin_src plain :tangle ~/.gitconfig
1424 sclone = clone --depth 1
1430 subup = submodule update --remote
1431 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1432 mirror = git config --global alias.mirrormirror
1435 #+begin_src plain :tangle ~/.gitconfig