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)
61 #+begin_src emacs-lisp
62 (use-package tree-sitter-langs)
63 (use-package tree-sitter
64 :config (global-tree-sitter-mode)
65 :hook (tree-sitter-after-on-hook . tree-sitter-hl-mode))
69 Great programming font with ligatures.
70 #+begin_src emacs-lisp
71 (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
74 #+begin_src emacs-lisp
76 :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
78 (ligature-set-ligatures
79 '(prog-mode text-mode)
80 '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
81 "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
82 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
83 "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
84 "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
85 ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
86 "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
87 "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
88 "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
89 "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
90 "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
91 "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
92 (global-ligature-mode t))
95 #+begin_src emacs-lisp
97 :config (global-emojify-mode))
99 ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
104 ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
105 ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
106 ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
109 Display relative line numbers except in some modes
110 #+begin_src emacs-lisp
111 (global-display-line-numbers-mode)
112 (setq display-line-numbers-type 'relative)
113 (dolist (no-line-num '(term-mode-hook
118 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
120 ** Highlight matching parenthesis
121 #+begin_src emacs-lisp
123 :config (show-paren-mode)
124 :custom (show-paren-style 'parenthesis))
127 *** Show current function
128 #+begin_src emacs-lisp
129 (which-function-mode)
131 *** Make position in file more descriptive
132 Show current column and file size.
133 #+begin_src emacs-lisp
135 (size-indication-mode)
138 #+begin_src emacs-lisp
140 :config (minions-mode))
143 #+begin_src emacs-lisp
145 :straight (wc-mode :type git :host github :repo "bnbeckwith/wc-mode")
146 :hook (text-mode-hook . wc-mode))
149 Show a ruler at a certain number of chars depending on mode.
150 #+begin_src emacs-lisp
151 (global-display-fill-column-indicator-mode)
154 Whenever starting a key chord, show possible future steps.
155 #+begin_src emacs-lisp
156 (use-package which-key
157 :config (which-key-mode)
158 :custom (which-key-idle-delay 0.3))
160 ** Highlight TODOs in comments
161 #+begin_src emacs-lisp
163 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
164 :config (global-hl-todo-mode 1))
167 #+begin_src emacs-lisp
171 Soft wrap words and do operations by visual lines.
172 #+begin_src emacs-lisp
173 (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
175 ** Display number of matches in search
176 #+begin_src emacs-lisp
178 :config (global-anzu-mode))
181 Inverts modeline instead of audible bell or the standard visual bell.
182 #+begin_src emacs-lisp
183 (setq visible-bell nil
184 ring-bell-function 'flash-mode-line)
185 (defun flash-mode-line ()
186 (invert-face 'mode-line)
187 (run-with-timer 0.1 nil #'invert-face 'mode-line))
191 #+begin_src emacs-lisp
193 :custom (select-enable-clipboard nil)
196 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
197 ;; Use visual line motions even outside of visual-line-mode buffers
198 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
199 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
200 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
203 #+begin_src emacs-lisp
204 (use-package evil-collection
206 :init (evil-collection-init)
207 :custom (evil-collection-setup-minibuffer t))
211 #+begin_src emacs-lisp
212 (use-package evil-surround
213 :config (global-evil-surround-mode))
216 #+begin_src emacs-lisp
217 (use-package evil-leader
218 :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
220 (evil-leader/set-leader "<SPC>")
221 (global-evil-leader-mode))
224 #+begin_src emacs-lisp
226 (use-package evil-nerd-commenter
227 :bind (:map evil-normal-state-map
228 ("gc" . evilnc-comment-or-uncomment-lines))
229 :custom (evilnc-invert-comment-line-by-line nil))
233 #+begin_src emacs-lisp
234 (evil-set-undo-system 'undo-redo)
236 ** Number incrementing
238 #+begin_src emacs-lisp
239 (use-package evil-numbers
240 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
241 :bind (:map evil-normal-state-map
242 ("C-M-a" . evil-numbers/inc-at-pt)
243 ("C-M-x" . evil-numbers/dec-at-pt)))
247 #+begin_src emacs-lisp
248 (use-package evil-org
250 :hook (org-mode . evil-org-mode)
252 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
253 (use-package evil-org-agenda
254 :straight (:type built-in)
257 (evil-org-agenda-set-keys))
260 #+begin_src emacs-lisp
261 (evil-leader/set-key-for-mode 'org-mode
262 "T" 'org-show-todo-tree
264 "c" 'org-archive-subtree)
268 #+begin_src emacs-lisp
270 :straight (:type built-in)
271 :commands (org-capture org-agenda)
274 (org-agenda-start-with-log-mode t)
275 (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
277 (org-log-into-drawer t)
278 (org-src-tab-acts-natively t)
279 (org-src-fontify-natively t)
280 (org-startup-indented t)
281 (org-hide-emphasis-markers t)
282 (org-fontify-whole-block-delimiter-line nil)
283 :bind ("C-c a" . org-agenda))
286 #+begin_src emacs-lisp
287 (use-package org-tempo
289 :straight (:type built-in)
291 ;; TODO: There's gotta be a more efficient way to write this
292 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
293 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
294 (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
295 (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
296 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
297 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
298 (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
299 (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
300 (add-to-list 'org-structure-template-alist '("ro" . "src javascript :tangle ~/.config/rofi/config.rasi"))
301 (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
302 (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
303 (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
304 (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")))
307 #+begin_src emacs-lisp
308 (use-package org-present
309 :straight (org-present :type git :host github :repo "rlister/org-present"))
313 Simple, but not too simple autocompletion.
314 #+begin_src emacs-lisp
316 :bind (("C-s" . swiper)
317 :map ivy-minibuffer-map
318 ("TAB" . ivy-alt-done)
319 :map ivy-switch-buffer-map
320 ("M-d" . ivy-switch-buffer-kill))
324 #+begin_src emacs-lisp
325 (use-package ivy-rich
327 :config (ivy-rich-mode))
331 #+begin_src emacs-lisp
333 :bind (("C-M-j" . 'counsel-switch-buffer)
334 :map minibuffer-local-map
335 ("C-r" . 'counsel-minibuffer-history))
336 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
337 :config (counsel-mode))
339 ** Remember frequent commands
340 #+begin_src emacs-lisp
341 (use-package ivy-prescient
344 (ivy-prescient-enable-filtering nil)
346 (prescient-persist-mode)
347 (ivy-prescient-mode))
350 Better search utility.
351 #+begin_src emacs-lisp
356 Use elfeed for RSS. I have another file with all the feeds in it.
357 #+begin_src emacs-lisp
359 :bind (("C-c e" . elfeed))
361 (load "~/.emacs.d/feeds.el")
362 (add-hook 'elfeed-new-entry-hook
363 (elfeed-make-tagger :feed-url "youtube\\.com"
365 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
367 (use-package elfeed-goodies
369 :config (elfeed-goodies/setup))
372 Use mu4e for reading emails.
374 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.
376 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.
377 #+begin_src emacs-lisp
378 (use-package smtpmail
379 :straight (:type built-in))
381 :load-path "/usr/share/emacs/site-lisp/mu4e"
382 :straight (:build nil)
383 :bind (("C-c m" . mu4e))
385 (setq user-full-name "Armaan Bhojwani"
386 smtpmail-local-domain "armaanb.net"
387 smtpmail-stream-type 'ssl
388 smtpmail-smtp-service '465
389 mu4e-change-filenames-when-moving t
390 mu4e-get-mail-command "offlineimap -q"
391 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
392 message-citation-line-function 'message-insert-formatted-citation-line
393 mu4e-completing-read-function 'ivy-completing-read
394 mu4e-confirm-quit nil
395 mail-user-agent 'mu4e-user-agent
397 `( ,(make-mu4e-context
399 :enter-func (lambda () (mu4e-message "Entering school context"))
400 :leave-func (lambda () (mu4e-message "Leaving school context"))
401 :match-func (lambda (msg)
403 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
404 :vars '((user-mail-address . "abhojwani22@nobles.edu")
405 (mu4e-sent-folder . "/school/Sent")
406 (mu4e-drafts-folder . "/school/Drafts")
407 (mu4e-trash-folder . "/school/Trash")
408 (mu4e-refile-folder . "/school/Archive")
409 (user-mail-address . "abhojwani22@nobles.edu")
410 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
411 (smtpmail-smtp-server . "smtp.gmail.com")))
414 :enter-func (lambda () (mu4e-message "Entering personal context"))
415 :leave-func (lambda () (mu4e-message "Leaving personal context"))
416 :match-func (lambda (msg)
418 (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
419 :vars '((mu4e-sent-folder . "/personal/Sent")
420 (mu4e-drafts-folder . "/personal/Drafts")
421 (mu4e-trash-folder . "/personal/Trash")
422 (mu4e-refile-folder . "/personal/Archive")
423 (user-mail-address . "me@armaanb.net")
424 (smtpmail-smtp-user . "me@armaanb.net")
425 (smtpmail-smtp-server "smtp.mailbox.org")
426 (mu4e-drafts-folder . "/school/Drafts")
427 (mu4e-trash-folder . "/school/Trash")))))
428 (add-to-list 'mu4e-bookmarks
429 '(:name "Unified inbox"
430 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
432 :hook ((mu4e-compose-mode . flyspell-mode)
433 (mu4e-view-mode-hook . turn-on-visual-line-mode)))
436 Set EWW as default browser except for videos.
437 #+begin_src emacs-lisp
438 (defun browse-url-mpv (url &optional new-window)
440 (start-process "mpv" "*mpv*" "mpv" url))
442 (setq browse-url-handlers
444 (("youtu\\.?be" . browse-url-mpv)
445 ("peertube.*" . browse-url-mpv)
446 ("vid.*" . browse-url-mpv)
447 ("vid.*" . browse-url-mpv)
448 ("." . eww-browse-url)
452 Some EWW enhancements.
453 *** Give buffer a useful name
454 #+begin_src emacs-lisp
455 ;; From https://protesilaos.com/dotemacs/
456 (defun prot-eww--rename-buffer ()
457 "Rename EWW buffer using page title or URL.
458 To be used by `eww-after-render-hook'."
459 (let ((name (if (eq "" (plist-get eww-data :title))
460 (plist-get eww-data :url)
461 (plist-get eww-data :title))))
462 (rename-buffer (format "*%s # eww*" name) t)))
464 (add-hook 'eww-after-render-hook #'prot-eww--rename-buffer)
466 *** Better entrypoint
467 #+begin_src emacs-lisp
468 ;; From https://protesilaos.com/dotemacs/
469 (defun prot-eww-browse-dwim (url &optional arg)
470 "Visit a URL, maybe from `eww-prompt-history', with completion.
472 With optional prefix ARG (\\[universal-argument]) open URL in a
475 If URL does not look like a valid link, run a web query using
478 When called from an eww buffer, provide the current link as
482 (completing-read "Query:" eww-prompt-history
483 nil nil (plist-get eww-data :url) 'eww-prompt-history)
485 (eww url (if arg 4 nil)))
487 (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
490 #+begin_src emacs-lisp
492 :straight (:type built-in)
494 (load "~/.emacs.d/irc.el")
496 (erc-notifications-enable)
497 (erc-smiley-disable))
499 (use-package erc-hl-nicks
500 :config (erc-hl-nicks-mode 1))
503 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
504 =emacsclient --eval "(emacs-everywhere)"=.
505 #+begin_src emacs-lisp
506 (use-package emacs-everywhere)
510 #+begin_src emacs-lisp
512 :hook (python-mode . blacken-mode)
514 (setq blacken-line-length 79))
517 (use-package ws-butler
519 (ws-butler-global-mode))
522 #+begin_src emacs-lisp
523 (use-package flycheck
525 (global-flycheck-mode))
527 ** Project management
528 #+begin_src emacs-lisp
529 (use-package projectile
530 :config (projectile-mode)
531 :custom ((projectile-completion-system 'ivy))
533 ("C-c p" . projectile-command-map)
535 (when (file-directory-p "~/Code")
536 (setq projectile-project-search-path '("~/Code")))
537 (setq projectile-switch-project-action #'projectile-dired))
539 (use-package counsel-projectile
541 :config (counsel-projectile-mode))
544 #+begin_src emacs-lisp
546 :straight (:type built-in)
547 :commands (dired dired-jump)
548 :custom ((dired-listing-switches "-agho --group-directories-first"))
550 (evil-collection-define-key 'normal 'dired-mode-map
551 "h" 'dired-single-up-directory
552 "l" 'dired-single-buffer))
554 (use-package dired-single
555 :commands (dired dired-jump))
557 (use-package dired-open
558 :commands (dired dired-jump)
560 (dired-open-extensions '(("png" . "feh")
563 (use-package dired-hide-dotfiles
564 :hook (dired-mode . dired-hide-dotfiles-mode)
566 (evil-collection-define-key 'normal 'dired-mode-map
567 "H" 'dired-hide-dotfiles-mode))
571 # TODO: Write a command that commits hunk, skipping staging step.
572 #+begin_src emacs-lisp
575 *** Colored diff in line number area
576 #+begin_src emacs-lisp
578 :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
579 :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
580 (magit-post-refresh-hook . diff-hl-magit-post-refresh))
581 :config (global-diff-hl-mode))
583 * General text editing
585 Indent after every change.
586 #+begin_src emacs-lisp
587 (use-package aggressive-indent
588 :config (global-aggressive-indent-mode))
591 Spell check in text mode, and in prog-mode comments.
592 #+begin_src emacs-lisp
593 (dolist (hook '(text-mode-hook))
594 (add-hook hook (lambda () (flyspell-mode))))
595 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
596 (add-hook hook (lambda () (flyspell-mode -1))))
597 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
599 ** Expand tabs to spaces
600 #+begin_src emacs-lisp
601 (setq-default tab-width 2)
603 ** Copy kill ring to clipboard
604 #+begin_src emacs-lisp
605 (setq x-select-enable-clipboard t)
606 (defun copy-kill-ring-to-xorg ()
607 "Copy the current kill ring to the xorg clipboard."
609 (x-select-text (current-kill 0)))
612 #+begin_src emacs-lisp
613 (use-package browse-kill-ring)
616 Opens file where you left it.
617 #+begin_src emacs-lisp
621 Distraction free writing a la junegunn/goyo.
622 #+begin_src emacs-lisp
623 (use-package olivetti
625 (evil-leader/set-key "o" 'olivetti-mode))
629 #+begin_src emacs-lisp
630 (setq abbrev-file-name "~/.emacs.d/abbrevs")
631 (setq save-abbrevs 'silent)
632 (setq-default abbrev-mode t)
635 #+begin_src emacs-lisp
636 (setq tramp-default-method "ssh")
638 ** Don't ask about following symlinks in vc
639 #+begin_src emacs-lisp
640 (setq vc-follow-symlinks t)
643 ** Easily convert splits
644 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
645 #+begin_src emacs-lisp
646 (defun toggle-window-split ()
648 (if (= (count-windows) 2)
649 (let* ((this-win-buffer (window-buffer))
650 (next-win-buffer (window-buffer (next-window)))
651 (this-win-edges (window-edges (selected-window)))
652 (next-win-edges (window-edges (next-window)))
653 (this-win-2nd (not (and (<= (car this-win-edges)
654 (car next-win-edges))
655 (<= (cadr this-win-edges)
656 (cadr next-win-edges)))))
658 (if (= (car this-win-edges)
659 (car (window-edges (next-window))))
660 'split-window-horizontally
661 'split-window-vertically)))
662 (delete-other-windows)
663 (let ((first-win (selected-window)))
665 (if this-win-2nd (other-window 1))
666 (set-window-buffer (selected-window) this-win-buffer)
667 (set-window-buffer (next-window) next-win-buffer)
668 (select-window first-win)
669 (if this-win-2nd (other-window 1))))))
671 (define-key ctl-x-4-map "t" 'toggle-window-split)
674 #+begin_src emacs-lisp
675 (defun insert-date ()
677 (insert (format-time-string "%Y-%m-%d")))
681 #+begin_src emacs-lisp
682 (use-package ace-window
683 :bind ("M-o" . ace-window))
685 ** Kill current buffer
686 Makes "C-x k" binding faster.
687 #+begin_src emacs-lisp
688 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
692 Render OpenSCAD files, and add a preview window.
694 Personal fork just merges a PR.
695 #+begin_src emacs-lisp
696 (use-package scad-mode)
697 (use-package scad-preview
698 :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
700 ** Control backup files
701 Stop backup files from spewing everywhere.
702 #+begin_src emacs-lisp
703 (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
705 ** Make yes/no easier
706 #+begin_src emacs-lisp
707 (defalias 'yes-or-no-p 'y-or-n-p)
709 ** Move customize file
710 No more clogging up init.el.
711 #+begin_src emacs-lisp
712 (setq custom-file "~/.emacs.d/custom.el")
716 #+begin_src emacs-lisp
718 :commands (helpful-callable helpful-variable helpful-command helpful-key)
720 (counsel-describe-function-function #'helpful-callable)
721 (counsel-describe-variable-function #'helpful-variable)
723 ([remap describe-function] . counsel-describe-function)
724 ([remap describe-command] . helpful-command)
725 ([remap describe-variable] . counsel-describe-variable)
726 ([remap describe-key] . helpful-key))
729 #+begin_src emacs-lisp
730 (use-package epa-file
731 :straight (:type built-in)
733 (epa-file-select-keys nil)
734 (epa-file-encrypt-to '("me@armaanb.net"))
735 (password-cache-expiry (* 60 15)))
737 (use-package pinentry
738 :config (pinentry-start))
741 #+begin_src emacs-lisp
743 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
744 :custom (0x0-default-service 'envs)
745 :config (evil-leader/set-key
747 "0f" '0x0-upload-file
748 "0s" '0x0-upload-string
749 "0c" '0x0-upload-kill-ring
750 "0p" '0x0-upload-popup))
755 #+begin_src conf :tangle ~/.spectrwm.conf
759 autorun = ws[1]:/home/armaa/Code/scripts/autostart
762 #+begin_src conf :tangle ~/.spectrwm.conf
764 bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
768 #+begin_src conf :tangle ~/.spectrwm.conf
769 program[term] = alacritty
770 program[screenshot_all] = flameshot gui
771 program[menu] = rofi -show run # `rofi-dmenu` handles the rest
772 program[switcher] = rofi -show window
773 program[notif] = /home/armaa/Code/scripts/setter status
776 bind[switcher] = MOD+Tab
779 #+begin_src conf :tangle ~/.spectrwm.conf
780 program[paup] = /home/armaa/Code/scripts/setter audio +5
781 program[padown] = /home/armaa/Code/scripts/setter audio -5
782 program[pamute] = /home/armaa/Code/scripts/setter audio
783 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
784 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
785 program[next] = playerctl next
786 program[prev] = playerctl previous
787 program[pause] = playerctl play-pause
789 bind[padown] = XF86AudioLowerVolume
790 bind[paup] = XF86AudioRaiseVolume
791 bind[pamute] = XF86AudioMute
792 bind[brigdown] = XF86MonBrightnessDown
793 bind[brigup] = XF86MonBrightnessUp
794 bind[pause] = XF86AudioPlay
795 bind[next] = XF86AudioNext
796 bind[prev] = XF86AudioPrev
799 #+begin_src conf :tangle ~/.spectrwm.conf
800 program[h] = xdotool keyup h key --clearmodifiers Left
801 program[j] = xdotool keyup j key --clearmodifiers Down
802 program[k] = xdotool keyup k key --clearmodifiers Up
803 program[l] = xdotool keyup l key --clearmodifiers Right
805 bind[h] = MOD + Control + h
806 bind[j] = MOD + Control + j
807 bind[k] = MOD + Control + k
808 bind[l] = MOD + Control + l
811 #+begin_src conf :tangle ~/.spectrwm.conf
812 program[aerc] = alacritty -e aerc
813 program[catgirl] = alacritty --hold -e sh -c "while : ; do ssh root@armaanb.net -t abduco -A irc catgirl freenode; sleep 2; done"
814 program[emacs] = emacsclient -c
815 program[firefox] = firefox
816 program[calc] = alacritty -e bc
817 program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
818 program[pass] = rofi-pass
820 bind[aerc] = MOD+Control+1
821 bind[catgirl] = MOD+Control+2
822 bind[firefox] = MOD+Control+3
823 bind[emacs-anywhere] = MOD+Control+4
824 bind[calc] = MOD+Control+5
825 bind[emacs] = MOD+Control+Return
826 bind[pass] = MOD+Shift+P
831 #+begin_src shell :tangle ~/.config/zsh/zshrc
832 autoload -Uz compinit
836 unsetopt glob_complete
838 # Fragment completions
839 zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
842 zstyle ':completion:*' menu select
843 zmodload zsh/complist
844 bindkey -M menuselect '^n' expand-or-complete
845 bindkey -M menuselect '^p' reverse-menu-complete
849 #+begin_src shell :tangle ~/.config/zsh/zshrc
853 bindkey -M vicmd "^[[3~" delete-char
854 bindkey "^[[3~" delete-char
856 autoload edit-command-line
857 zle -N edit-command-line
858 bindkey -M vicmd ^e edit-command-line
859 bindkey ^e edit-command-line
862 #+begin_src shell :tangle ~/.config/zsh/zshrc
863 setopt extended_history
865 setopt inc_append_history
866 setopt hist_ignore_dups
867 setopt hist_reduce_blanks
871 HISTFILE=~/.local/share/zsh/history
874 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
876 Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition.
878 #+begin_src conf :tangle ~/.config/zpe/repositories
879 https://github.com/zdharma/fast-syntax-highlighting
882 #+begin_src shell :tangle ~/.config/zsh/zshrc
883 source ~/Code/zpe/zpe.sh
884 source ~/Code/admone/admone.zsh
885 source ~/.config/zsh/fzf-bindings.zsh
887 zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
890 **** Time Zsh startup
891 #+begin_src shell :tangle ~/.config/zsh/zshrc
893 for i in $(seq 1 10); do time "$1" -i -c exit; done
896 **** Update all packages
897 #+begin_src shell :tangle ~/.config/zsh/zshrc
898 color=$(tput setaf 5)
902 sudo echo "${color}== upgrading with yay ==${reset}"
905 echo "${color}== checking for pacnew files ==${reset}"
908 echo "${color}== upgrading flatpaks ==${reset}"
911 echo "${color}== upgrading zsh plugins ==${reset}"
914 echo "${color}== updating nvim plugins ==${reset}"
915 nvim +PlugUpdate +PlugUpgrade +qall
916 echo "Updated nvim plugins"
918 echo "${color}You are entirely up to date!${reset}"
921 **** Clean all packages
922 #+begin_src shell :tangle ~/.config/zsh/zshrc
924 sudo echo "${color}== cleaning pacman orphans ==${reset}"
925 (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
927 echo "${color}== cleaning flatpaks ==${reset}"
928 flatpak remove --unused
930 echo "${color}== cleaning zsh plugins ==${reset}"
933 echo "${color}== cleaning nvim plugins ==${reset}"
934 nvim +PlugClean +qall
935 echo "Cleaned nvim plugins"
937 echo "${color}All orphans cleaned!${reset}"
941 #+begin_src shell :tangle ~/.config/zsh/zshrc
943 __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
944 if [ $? -eq 0 ]; then
945 eval "$__conda_setup"
947 if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
948 . "/opt/anaconda/etc/profile.d/conda.sh"
950 export PATH="/opt/anaconda/bin:$PATH"
956 **** Interact with 0x0
957 #+begin_src shell :tangle ~/.config/zsh/zshrc
958 zxz="https://envs.sh"
959 0file() { curl -F"file=@$1" "$zxz" ; }
960 0pb() { curl -F"file=@-;" "$zxz" ; }
961 0url() { curl -F"url=$1" "$zxz" ; }
962 0short() { curl -F"shorten=$1" "$zxz" ; }
963 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
966 #+begin_src shell :tangle ~/.config/zsh/zshrc
968 user=$(echo "$1" | cut -f 1 -d '@')
969 host=$(echo "$1" | cut -f 2 -d '@')
970 echo $user | nc "$host" 79 -N
973 **** Upload to ftp.armaanb.net
974 #+begin_src shell :tangle ~/.config/zsh/zshrc
976 rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
977 echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
982 #+begin_src shell :tangle ~/.config/zsh/zshrc
983 alias bhoji-drop='ssh -p 23 root@armaanb.net'
984 alias catgirl='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
985 alias union='ssh 192.168.1.18'
986 alias mine='ssh -p 23 root@pickupserver.cc'
987 alias tcf='ssh root@204.48.23.68'
988 alias ngmun='ssh root@157.245.89.25'
989 alias prox='ssh root@192.168.1.224'
990 alias ncq='ssh root@143.198.123.17'
991 alias dock='ssh root@192.168.1.225'
992 alias jenkins='ssh root@192.168.1.226'
993 alias envs='ssh acheam@envs.net'
996 #+begin_src shell :tangle ~/.config/zsh/zshrc
997 alias ls='exa -lh --icons --git --group-directories-first'
998 alias la='exa -lha --icons --git --group-directories-first'
999 alias df='df -h / /boot'
1001 alias free='free -h'
1006 alias grep='grep -in --exclude-dir=.git --color=auto'
1007 alias fname='find -name'
1008 alias mkdir='mkdir -pv'
1009 alias unar='atool -x'
1010 alias wget='wget -e robots=off'
1011 alias lanex='~/.local/share/lxc/lxc'
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 redoas='doas $(fc -ln -1)'
1025 alias crontab='crontab-argh'
1026 alias sudo='doas ' # allows aliases to be run with doas
1027 alias pasc='pass -c'
1028 alias pasu='\pass git push'
1029 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1033 #+begin_src shell :tangle ~/.config/zsh/zshrc
1034 alias ping='ping -c 10'
1035 alias speed='speedtest-cli'
1036 alias ip='ip --color=auto'
1037 alias cip='curl https://armaanb.net/ip'
1038 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1039 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1040 alias plan='T=$(mktemp) && \
1041 rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
1043 head -n -2 $T > $TT && \
1045 echo "\nLast updated: $(date -R)" >> "$TT" && \
1046 rsync "$TT" root@armaanb.net:/etc/finger/plan.txt'
1047 alias wttr='curl -s "wttr.in/02445?n" | head -n -3'
1050 #+begin_src shell :tangle ~/.config/zsh/zshrc
1051 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1052 iflag=fullblock status=progress'
1053 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1054 iflag=fullblock status=progress'
1055 alias ts='gen-shell -c task'
1056 alias ts='gen-shell -c task'
1057 alias tetris='autoload -Uz tetriscurses && tetriscurses'
1058 alias news='newsboat'
1059 alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1060 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
1061 --restrict-filenames -o '%(title)s.%(ext)s'"
1062 alias cal="cal -3 --color=auto"
1065 **** Virtual machines, chroots
1066 #+begin_src shell :tangle ~/.config/zsh/zshrc
1067 alias ckiss="sudo chrooter ~/Virtual/kiss"
1068 alias cdebian="sudo chrooter ~/Virtual/debian bash"
1069 alias cwindows='devour qemu-system-x86_64 \
1074 -device VGA,vgamem_mb=64 \
1076 -device hda-duplex \
1078 -net user,smb=/home/armaa/Public \
1079 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1082 #+begin_src shell :tangle ~/.config/zsh/zshrc
1084 alias zpy="zconda && ipython"
1085 alias math="ipython --profile=math"
1086 alias pypi="python setup.py sdist && twine upload dist/*"
1087 alias pip="python -m pip"
1088 alias black="black -l 79"
1091 #+begin_src shell :tangle ~/.config/zsh/zshrc
1092 alias words='gen-shell -c "words"'
1093 alias words-e='gen-shell -c "words ~E"'
1096 #+begin_src shell :tangle ~/.config/zsh/zshrc
1097 alias zathura='devour zathura'
1098 alias mpv='devour mpv'
1099 alias sql='devour sqlitebrowser'
1100 alias cad='devour openscad'
1101 alias feh='devour feh'
1103 **** Package management (Pacman)
1104 #+begin_src shell :tangle ~/.config/zsh/zshrc
1106 alias api='yay -Syu'
1107 alias apii='sudo pacman -S'
1108 alias app='yay -Rns'
1110 alias apo='yay -Qttd'
1111 alias azf='pacman -Q | fzf'
1112 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1113 alias ufetch='ufetch-arch'
1114 alias reflect='reflector --verbose --sort rate --save \
1115 ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1117 **** Package management (KISS)
1118 #+begin_src shell :tangle ~/.config/zsh/zshrc
1119 alias kzf="kiss s \* | xargs -l basename | \
1120 fzf --preview 'kiss search {} | xargs -l dirname'"
1123 #+begin_src shell :tangle ~/.config/zsh/zshrc
1124 export EDITOR="emacsclient -c"
1125 export VISUAL="$EDITOR"
1126 export TERM=xterm-256color # for compatability
1128 export GPG_TTY="$(tty)"
1129 export MANPAGER='nvim +Man!'
1132 export GTK_USE_PORTAL=1
1134 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1135 export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
1136 export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
1137 export PATH="$PATH:/home/armaa/.cargo/bin"
1138 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1139 export PATH="$PATH:/usr/sbin"
1140 export PATH="$PATH:/opt/FreeTube/freetube"
1142 export LC_ALL="en_US.UTF-8"
1143 export LC_CTYPE="en_US.UTF-8"
1144 export LANGUAGE="en_US.UTF-8"
1146 export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
1147 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1148 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1149 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1150 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1151 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1155 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1158 family: JetBrains Mono Nerd Font
1165 ligatures: true # Requires ligature patch
1172 background_opacity: 1
1175 Modus vivendi. Source: https://github.com/ishan9299/Nixos/blob/d4bbb7536be95b59466bb9cca4d671be46e04e81/user/alacritty/alacritty.yml#L30-L118
1176 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1180 background: '#000000'
1181 foreground: '#ffffff'
1185 background: '#ffffff'
1187 # Normal colors (except green it is from intense colors)
1198 # Bright colors [all the faint colors in the modus theme]
1209 # dim [all the intense colors in modus theme]
1222 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1223 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1224 c.TerminalInteractiveShell.editing_mode = 'vi'
1225 c.InteractiveShell.colors = 'linux'
1226 c.TerminalInteractiveShell.confirm_exit = False
1229 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1233 return x * (180 / pi)
1236 return x * (pi / 180)
1239 return (x * (pi / 180)) / unit
1251 Make MPV play a little bit smoother.
1252 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1253 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1257 For any GNU Readline programs
1258 #+begin_src conf :tangle ~/.inputrc
1263 #+begin_src conf :tangle ~/.gitconfig
1265 name = Armaan Bhojwani
1266 email = me@armaanb.net
1267 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1270 #+begin_src conf :tangle ~/.gitconfig
1272 defaultBranch = main
1275 #+begin_src conf :tangle ~/.gitconfig
1280 #+begin_src conf :tangle ~/.gitconfig
1282 smtpserver = smtp.mailbox.org
1283 smtpuser = me@armaanb.net
1284 smtpencryption = ssl
1285 smtpserverport = 465
1289 #+begin_src conf :tangle ~/.gitconfig
1294 #+begin_src conf :tangle ~/.gitconfig
1297 sclone = clone --depth 1
1303 subup = submodule update --remote
1304 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1305 mirror = git config --global alias.mirrormirror
1308 #+begin_src conf :tangle ~/.gitconfig
1314 Lightweight notification daemon.
1316 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1318 font = "JetBrains Mono Medium Nerd Font 11"
1320 format = "<b>%s</b>\n%b"
1322 indicate_hidden = yes
1325 show_age_threshold = 60
1328 geometry = "400x5-10+10"
1330 idle_threshold = 120
1332 sticky_history = yes
1334 separator_height = 1
1336 horizontal_padding = 8
1338 separator_color = "#ffffff"
1339 startup_notification = false
1342 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1349 close_all = mod4+shift+c
1350 history = mod4+ctrl+c
1353 background = "#222222"
1354 foreground = "#ffffff"
1355 highlight = "#ffffff"
1359 background = "#222222"
1360 foreground = "#ffffff"
1361 highlight = "#ffffff"
1365 background = "#222222"
1366 foreground = "#a60000"
1367 highlight = "#ffffff"
1371 Modus vivendi theme that extends DarkBlue.
1372 #+begin_src javascript :tangle ~/.config/rofi/config.rasi
1373 @import "/usr/share/rofi/themes/DarkBlue.rasi"
1375 white: rgba ( 255, 255, 255, 100 % );
1377 selected-normal-background: @white;
1378 separatorcolor: @white;
1379 background: rgba ( 34, 34, 34, 100 % );
1384 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1386 map <A-b> toggle_statusbar
1387 set selection-clipboard clipboard
1390 set window-title-basename "true"
1391 set selection-clipboard "clipboard"
1394 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1395 set default-bg "#000000"
1396 set default-fg "#ffffff"
1397 set render-loading true
1398 set render-loading-bg "#000000"
1399 set render-loading-fg "#ffffff"
1401 set recolor-lightcolor "#000000" # bg
1402 set recolor-darkcolor "#ffffff" # fg
1406 *** Swap tab and URL bars
1407 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1409 -moz-box-ordinal-group: 1 !important;
1413 -moz-box-ordinal-group: 2 !important;
1417 -moz-box-ordinal-group: 3 !important;
1420 *** Hide URL bar when not focused.
1421 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1422 #navigator-toolbox:not(:focus-within):not(:hover) {
1426 #navigator-toolbox {
1427 transition: 0.1s margin-top ease-out;
1430 ** Black screen by default
1431 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1434 #browser vbox#appcontent tabbrowser,
1436 #tabbrowser-tabpanels,
1438 browser[type="content-primary"],
1439 browser[type="content"] > html,
1441 background: black !important;
1442 color: #fff !important;
1445 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1446 @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1448 background: black !important;
1454 #+begin_src conf :tangle ~/.Xresources
1455 xterm*font: JetBrains Mono NF:pixelsize=15
1457 XTerm.vt100.translations: #override \n\
1458 Ctrl <Key> minus: smaller-vt-font() \n\
1459 Ctrl <Key> plus: larger-vt-font()
1463 #+begin_src conf :tangle ~/.Xresources
1465 ,*.foreground: #ffffff
1466 ,*.background: #000000
1467 ,*.cursorColor: #ffffff
1502 #+begin_src conf :tangle ~/.Xresources
1503 xterm*VT100.Translations: #override \
1504 Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
1505 Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
1506 Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
1507 Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
1510 #+begin_src conf :tangle ~/.Xresources
1511 xterm*cursorBlink: true
1514 #+begin_src conf :tangle ~/.Xresources
1515 XTerm*eightBitInput: false
1516 XTerm*eightBitOutput: true