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")
69 (ligature-set-ligatures
70 '(prog-mode text-mode)
71 '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" "/=="
72 "/>" "//" "/*" "*>" "***" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
73 "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>" "<-|"
74 "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>" "</" "<*"
75 "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>" ":=" "::=" "=>>"
76 "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!==" "!!" "!=" ">]" ">:"
77 ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]"
78 "|}" "|=>" "|->" "|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<"
79 "..." "+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" "##"
80 "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_"
81 "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
82 (global-ligature-mode t))
85 #+begin_src emacs-lisp
87 :config (global-emojify-mode))
89 ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
94 ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
95 ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
96 ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
99 Display relative line numbers except in some modes
100 #+begin_src emacs-lisp
101 (global-display-line-numbers-mode)
102 (setq display-line-numbers-type 'relative)
103 (dolist (no-line-num '(term-mode-hook
108 (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
110 ** Highlight matching parenthesis
111 #+begin_src emacs-lisp
113 :config (show-paren-mode)
114 :custom (show-paren-style 'parenthesis))
117 *** Show current function
118 #+begin_src emacs-lisp
119 (which-function-mode)
121 *** Make position in file more descriptive
122 Show current column and file size.
123 #+begin_src emacs-lisp
125 (size-indication-mode)
128 #+begin_src emacs-lisp
130 :config (minions-mode))
133 Show a ruler at a certain number of chars depending on mode.
134 #+begin_src emacs-lisp
135 (global-display-fill-column-indicator-mode)
138 Whenever starting a key chord, show possible future steps.
139 #+begin_src emacs-lisp
140 (use-package which-key
141 :config (which-key-mode)
142 :custom (which-key-idle-delay 0.3))
144 ** Visual highlights of changes
145 Highlight when changes are made.
146 #+begin_src emacs-lisp
147 (use-package evil-goggles
148 :config (evil-goggles-mode)
149 (evil-goggles-use-diff-faces))
151 ** Highlight "TODO" comments
152 #+begin_src emacs-lisp
154 :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
155 :config (global-hl-todo-mode))
158 #+begin_src emacs-lisp
162 Soft wrap words and do operations by visual lines.
163 #+begin_src emacs-lisp
164 (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
166 ** Display number of matches in search
167 #+begin_src emacs-lisp
169 :config (global-anzu-mode))
172 Inverts modeline instead of audible bell or the standard visual bell.
173 #+begin_src emacs-lisp
174 (setq visible-bell nil
175 ring-bell-function 'flash-mode-line)
176 (defun flash-mode-line ()
177 (invert-face 'mode-line)
178 (run-with-timer 0.1 nil #'invert-face 'mode-line))
182 #+begin_src emacs-lisp
184 :custom (select-enable-clipboard nil)
187 (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
188 ;; Use visual line motions even outside of visual-line-mode buffers
189 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
190 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
191 (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
194 #+begin_src emacs-lisp
195 (use-package evil-collection
197 :init (evil-collection-init)
198 :custom (evil-collection-setup-minibuffer t))
202 #+begin_src emacs-lisp
203 (use-package evil-surround
204 :config (global-evil-surround-mode))
207 #+begin_src emacs-lisp
208 (use-package evil-leader
209 :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
211 (evil-leader/set-leader "<SPC>")
212 (global-evil-leader-mode))
215 #+begin_src emacs-lisp
217 (use-package evil-nerd-commenter
218 :bind (:map evil-normal-state-map
219 ("gc" . evilnc-comment-or-uncomment-lines))
220 :custom (evilnc-invert-comment-line-by-line nil))
224 #+begin_src emacs-lisp
225 (use-package undo-tree
227 (undo-tree-auto-save-history t)
228 (undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree")))
230 (global-undo-tree-mode)
231 (evil-set-undo-system 'undo-tree))
233 ** Number incrementing
235 #+begin_src emacs-lisp
236 (use-package evil-numbers
237 :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
238 :bind (:map evil-normal-state-map
239 ("C-M-a" . evil-numbers/inc-at-pt)
240 ("C-M-x" . evil-numbers/dec-at-pt)))
244 #+begin_src emacs-lisp
245 (use-package evil-org
247 :hook (org-mode . evil-org-mode)
249 (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
250 (use-package evil-org-agenda
251 :straight (:type built-in)
254 (evil-org-agenda-set-keys))
257 #+begin_src emacs-lisp
258 (evil-leader/set-key-for-mode 'org-mode
259 "T" 'org-show-todo-tree
261 "c" 'org-archive-subtree)
265 #+begin_src emacs-lisp
267 :straight (:type built-in)
268 :commands (org-capture org-agenda)
271 (org-agenda-start-with-log-mode t)
273 (org-log-into-drawer t)
274 (org-src-tab-acts-natively t)
275 (org-src-fontify-natively t)
276 (org-startup-indented t)
277 (org-hide-emphasis-markers t)
278 (org-fontify-whole-block-delimiter-line nil))
280 ** Automatically tangle
281 #+begin_src emacs-lisp
282 (add-hook 'org-mode-hook
283 (lambda () (add-hook 'after-save-hook #'org-babel-tangle
287 #+begin_src emacs-lisp
288 (use-package org-tempo
290 :straight (:type built-in)
292 ;; TODO: There's gotta be a more efficient way to write this
293 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
294 (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
295 (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
296 (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
297 (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
298 (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
299 (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
300 (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc")))
304 Simple, but not too simple autocompletion.
305 #+begin_src emacs-lisp
307 :bind (("C-s" . swiper)
308 :map ivy-minibuffer-map
309 ("TAB" . ivy-alt-done)
310 :map ivy-switch-buffer-map
311 ("C-d" . ivy-switch-buffer-kill))
315 #+begin_src emacs-lisp
316 (use-package ivy-rich
318 :config (ivy-rich-mode))
322 #+begin_src emacs-lisp
324 :bind (("C-M-j" . 'counsel-switch-buffer)
325 :map minibuffer-local-map
326 ("C-r" . 'counsel-minibuffer-history))
327 :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
328 :config (counsel-mode))
330 ** Remember frequent commands
331 #+begin_src emacs-lisp
332 (use-package ivy-prescient
335 (ivy-prescient-enable-filtering nil)
337 (prescient-persist-mode)
338 (ivy-prescient-mode))
341 Better search utility.
342 #+begin_src emacs-lisp
347 Use elfeed for RSS. I have another file with all the feeds in it.
348 #+begin_src emacs-lisp
350 :bind (("C-c e" . elfeed))
352 (load "~/.emacs.d/feeds.el")
353 (add-hook 'elfeed-new-entry-hook
354 (elfeed-make-tagger :feed-url "youtube\\.com"
356 :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
358 (use-package elfeed-goodies
360 :config (elfeed-goodies/setup))
363 Use mu4e for reading emails.
365 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.
367 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.
368 #+begin_src emacs-lisp
369 (use-package smtpmail
370 :straight (:type built-in))
372 :load-path "/usr/share/emacs/site-lisp/mu4e"
373 :bind (("C-c m" . mu4e))
376 (setq user-full-name "Armaan Bhojwani"
377 smtpmail-local-domain "armaanb.net"
378 smtpmail-stream-type 'ssl
379 smtpmail-smtp-service '465
380 mu4e-change-filenames-when-moving t
381 message-kill-buffer-on-exit t
382 mu4e-get-mail-command "offlineimap -q"
383 message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
384 message-citation-line-function 'message-insert-formatted-citation-line
385 mu4e-context-policy "pick-first"
387 `( ,(make-mu4e-context
389 :enter-func (lambda () (mu4e-message "Entering school context"))
390 :leave-func (lambda () (mu4e-message "Leaving school context"))
391 :match-func (lambda (msg)
393 (string-match-p "^/school" (mu4e-message-field msg :maildir))))
394 :vars '( (user-mail-address . "abhojwani22@nobles.edu")
395 (mu4e-sent-folder . "/school/Sent")
396 (mu4e-drafts-folder . "/school/Drafts")
397 (mu4e-trash-folder . "/school/Trash")
398 (mu4e-refile-folder . "/school/Archive")
399 (user-mail-address . "abhojwani22@nobles.edu")
400 (smtpmail-smtp-user . "abhojwani22@nobles.edu")
401 (smtpmail-smtp-server . "smtp.gmail.com")))
404 :enter-func (lambda () (mu4e-message "Entering personal context"))
405 :leave-func (lambda () (mu4e-message "Leaving personal context"))
406 :match-func (lambda (msg)
408 (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
410 (mu4e-sent-folder . "/personal/Sent")
411 (mu4e-drafts-folder . "/personal/Drafts")
412 (mu4e-trash-folder . "/personal/Trash")
413 (mu4e-refile-folder . "/personal/Archive")
414 (user-mail-address . "me@armaanb.net")
415 (smtpmail-smtp-user . "me@armaanb.net")
416 (smtpmail-smtp-server "smtp.mailbox.org")
417 (mu4e-drafts-folder . "/school/Drafts")
418 (mu4e-trash-folder . "/school/Trash")))))
420 (add-to-list 'mu4e-bookmarks
422 :name "Unified inbox"
423 :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
427 #+begin_src emacs-lisp
429 (use-package calfw-org)
430 (use-package calfw-ical)
432 (defun acheam-calendar ()
435 (shell-command "vdirsyncer sync")
436 (let ((default-directory "~/.local/share/vdirsyncer/"))
437 (cfw:open-calendar-buffer
440 (cfw:ical-create-source "School" (expand-file-name "school/abhojwani22@nobles.edu.ics") "Green")
441 (cfw:ical-create-source "Personal" (expand-file-name "mailbox/Y2FsOi8vMC8zMQ.ics") "Blue")
442 (cfw:ical-create-source "Birthdays" (expand-file-name "mailbox/Y2FsOi8vMS8w.ics") "Gray")
446 Another file has more specific network configuration.
447 #+begin_src emacs-lisp
450 (load "~/.emacs.d/irc.el"))
451 (use-package circe-color-nicks
453 :straight (:type built-in))
454 (use-package circe-chanop
456 :straight (:type built-in))
459 Set EWW as default browser except for videos
460 #+begin_src emacs-lisp
461 (defun browse-url-mpv (url &optional new-window)
463 (start-process "mpv" "*mpv*" "mpv" url))
465 (setq browse-url-browser-function
467 (("youtu\\.?be" . browse-url-mpv)
468 ("." . eww-browse-url))))
471 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
472 "emacsclient --eval "(emacs-everywhere)".
473 #+begin_src emacs-lisp
474 (use-package emacs-everywhere)
479 #+begin_src emacs-lisp
480 (use-package lsp-mode
481 :commands (lsp lsp-deferred)
482 :custom (lsp-keymap-prefix "C-c l")
483 :hook ((lsp-mode . lsp-enable-which-key-integration)))
485 (use-package lsp-ivy)
488 :commands lsp-ui-mode
489 :custom (lsp-ui-doc-position 'bottom))
490 (use-package lsp-ui-flycheck
492 :straight (:type built-in))
495 Company-box adds icons.
496 #+begin_src emacs-lisp
499 :hook (lsp-mode . company-mode)
500 :bind (:map company-active-map
501 ("<tab>" . company-complete-selection))
503 ("<tab>" . company-indent-or-complete-common))
505 (company-minimum-prefix-length 1)
506 (setq company-dabbrev-downcase 0)
507 (company-idle-delay 0.0))
509 (use-package company-box
510 :hook (company-mode . company-box-mode))
514 #+begin_src emacs-lisp
515 (use-package lsp-pyright
516 :hook (python-mode . (lambda ()
517 (use-package lsp-pyright
518 :straight (:type built-in))
522 #+begin_src emacs-lisp
524 :hook (python-mode . blacken-mode)
526 (setq blacken-line-length 79))
529 (use-package ws-butler
531 (ws-butler-global-mode))
534 #+begin_src emacs-lisp
535 (use-package flycheck
537 (global-flycheck-mode))
539 ** Project management
540 #+begin_src emacs-lisp
541 (use-package projectile
542 :config (projectile-mode)
543 :custom ((projectile-completion-system 'ivy))
545 ("C-c p" . projectile-command-map)
547 (when (file-directory-p "~/Code")
548 (setq projectile-project-search-path '("~/Code")))
549 (setq projectile-switch-project-action #'projectile-dired))
551 (use-package counsel-projectile
553 :config (counsel-projectile-mode))
556 #+begin_src emacs-lisp
558 :straight (:type built-in)
559 :commands (dired dired-jump)
560 :custom ((dired-listing-switches "-agho --group-directories-first"))
562 (evil-collection-define-key 'normal 'dired-mode-map
563 "h" 'dired-single-up-directory
564 "l" 'dired-single-buffer))
566 (use-package dired-single
567 :commands (dired dired-jump))
569 (use-package dired-open
570 :commands (dired dired-jump)
572 (dired-open-extensions '(("png" . "feh")
575 (use-package dired-hide-dotfiles
576 :hook (dired-mode . dired-hide-dotfiles-mode)
578 (evil-collection-define-key 'normal 'dired-mode-map
579 "H" 'dired-hide-dotfiles-mode))
583 #+begin_src emacs-lisp
585 :hook (git-commit-setup-hook . pinentry-start))
587 *** Colored diff in line number area
588 #+begin_src emacs-lisp
590 :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
591 :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
592 (magit-post-refresh-hook . diff-hl-magit-post-refresh))
593 :config (global-diff-hl-mode))
595 * General text editing
597 Indent after every change.
598 #+begin_src emacs-lisp
599 (use-package aggressive-indent
600 :config (global-aggressive-indent-mode))
603 Spell check in text mode, and in prog-mode comments.
604 #+begin_src emacs-lisp
605 (dolist (hook '(text-mode-hook))
606 (add-hook hook (lambda () (flyspell-mode))))
607 (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
608 (add-hook hook (lambda () (flyspell-mode -1))))
609 (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
611 ** Expand tabs to spaces
612 #+begin_src emacs-lisp
613 (setq-default tab-width 2)
615 ** Copy kill ring to clipboard
616 #+begin_src emacs-lisp
617 (setq x-select-enable-clipboard t)
618 (defun copy-kill-ring-to-xorg ()
619 "Copy the current kill ring to the xorg clipboard."
621 (x-select-text (current-kill 0)))
624 #+begin_src emacs-lisp
625 (use-package browse-kill-ring)
628 Opens file where you left it.
629 #+begin_src emacs-lisp
633 Distraction free writing a la junegunn/goyo.
634 #+begin_src emacs-lisp
635 (use-package olivetti
637 (evil-leader/set-key "o" 'olivetti-mode))
641 #+begin_src emacs-lisp
642 (setq abbrev-file-name "~/.emacs.d/abbrevs")
643 (setq save-abbrevs 'silent)
644 (setq-default abbrev-mode t)
647 ** Easily convert splits
648 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
649 #+begin_src emacs-lisp
650 (defun toggle-window-split ()
652 (if (= (count-windows) 2)
653 (let* ((this-win-buffer (window-buffer))
654 (next-win-buffer (window-buffer (next-window)))
655 (this-win-edges (window-edges (selected-window)))
656 (next-win-edges (window-edges (next-window)))
657 (this-win-2nd (not (and (<= (car this-win-edges)
658 (car next-win-edges))
659 (<= (cadr this-win-edges)
660 (cadr next-win-edges)))))
662 (if (= (car this-win-edges)
663 (car (window-edges (next-window))))
664 'split-window-horizontally
665 'split-window-vertically)))
666 (delete-other-windows)
667 (let ((first-win (selected-window)))
669 (if this-win-2nd (other-window 1))
670 (set-window-buffer (selected-window) this-win-buffer)
671 (set-window-buffer (next-window) next-win-buffer)
672 (select-window first-win)
673 (if this-win-2nd (other-window 1))))))
675 (define-key ctl-x-4-map "t" 'toggle-window-split)
678 #+begin_src emacs-lisp
679 (defun insert-date ()
681 (insert (format-time-string "%Y-%m-%d")))
685 #+begin_src emacs-lisp
686 (use-package ace-window
687 :bind ("M-o" . ace-window))
689 ** Kill current buffer
690 Makes "C-x k" binding faster.
691 #+begin_src emacs-lisp
692 (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
696 Render OpenSCAD files, and add a preview window.
698 Personal fork just merges a PR.
699 #+begin_src emacs-lisp
700 (use-package scad-mode)
701 (use-package scad-preview
702 :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
704 ** Control backup files
705 Stop backup files from spewing everywhere.
706 #+begin_src emacs-lisp
707 (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
709 ** Make yes/no easier
710 #+begin_src emacs-lisp
711 (defalias 'yes-or-no-p 'y-or-n-p)
713 ** Move customize file
714 No more clogging up init.el.
715 #+begin_src emacs-lisp
716 (setq custom-file "~/.emacs.d/custom.el")
720 #+begin_src emacs-lisp
722 :commands (helpful-callable helpful-variable helpful-command helpful-key)
724 (counsel-describe-function-function #'helpful-callable)
725 (counsel-describe-variable-function #'helpful-variable)
727 ([remap describe-function] . counsel-describe-function)
728 ([remap describe-command] . helpful-command)
729 ([remap describe-variable] . counsel-describe-variable)
730 ([remap describe-key] . helpful-key))
733 #+begin_src emacs-lisp
734 (use-package epa-file
735 :straight (:type built-in))
736 (setq epa-file-select-keys nil
737 epa-file-encrypt-to '("me@armaanb.net")
738 password-cache-expiry (* 60 15))
740 (use-package pinentry)
743 #+begin_src emacs-lisp
745 :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
746 :custom (0x0-default-service 'envs)
747 :config (evil-leader/set-key
749 "0f" '0x0-upload-file
750 "0s" '0x0-upload-string
751 "0c" '0x0-upload-kill-ring
752 "0p" '0x0-upload-popup))
757 #+begin_src conf :tangle ~/.spectrwm.conf
763 autorun = ws[1]:/home/armaa/Code/scripts/autostart
767 #+begin_src conf :tangle ~/.spectrwm.conf
768 color_focus = rgb:83/a5/98
769 color_focus_maximized = rgb:d6/5d/0e
770 color_unfocus = rgb:58/58/58
773 #+begin_src conf :tangle ~/.spectrwm.conf
775 bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
779 #+begin_src conf :tangle ~/.spectrwm.conf
780 program[lock] = i3lock -c 000000 -ef
781 program[term] = alacritty
782 program[screenshot_all] = flameshot gui
783 program[menu] = rofi -show run # `rofi-dmenu` handles the rest
784 program[switcher] = rofi -show window
785 program[notif] = /home/armaa/Code/scripts/setter status
788 bind[switcher] = MOD+Tab
791 #+begin_src conf :tangle ~/.spectrwm.conf
792 program[paup] = /home/armaa/Code/scripts/setter audio +5
793 program[padown] = /home/armaa/Code/scripts/setter audio -5
794 program[pamute] = /home/armaa/Code/scripts/setter audio
795 program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
796 program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
797 program[next] = playerctl next
798 program[prev] = playerctl previous
799 program[pause] = playerctl play-pause
801 bind[padown] = XF86AudioLowerVolume
802 bind[paup] = XF86AudioRaiseVolume
803 bind[pamute] = XF86AudioMute
804 bind[brigdown] = XF86MonBrightnessDown
805 bind[brigup] = XF86MonBrightnessUp
806 bind[pause] = XF86AudioPlay
807 bind[next] = XF86AudioNext
808 bind[prev] = XF86AudioPrev
811 #+begin_src conf :tangle ~/.spectrwm.conf
812 program[h] = xdotool keyup h key --clearmodifiers Left
813 program[j] = xdotool keyup j key --clearmodifiers Down
814 program[k] = xdotool keyup k key --clearmodifiers Up
815 program[l] = xdotool keyup l key --clearmodifiers Right
817 bind[h] = MOD + Control + h
818 bind[j] = MOD + Control + j
819 bind[k] = MOD + Control + k
820 bind[l] = MOD + Control + l
823 #+begin_src conf :tangle ~/.spectrwm.conf
824 program[aerc] = alacritty -e aerc
825 program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
826 program[emacs] = emacsclient -c
827 program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
828 program[firefox] = firefox
829 program[thunderbird] = thunderbird
830 program[slack] = slack
832 bind[aerc] = MOD+Control+s
833 bind[weechat] = MOD+Control+d
834 bind[emacs] = MOD+Control+f
835 bind[emacs-anywhere] = MOD+f
836 bind[firefox] = MOD+Control+u
837 bind[thunderbird] = MOD+Control+i
838 bind[slack] = MOD+Control+o
843 #+begin_src shell :tangle ~/.config/zsh/zshrc
844 autoload -Uz compinit
848 unsetopt glob_complete
851 #+begin_src shell :tangle ~/.config/zsh/zshrc
855 bindkey -M vicmd "^[[3~" delete-char
856 bindkey "^[[3~" delete-char
858 autoload edit-command-line
859 zle -N edit-command-line
860 bindkey -M vicmd ^e edit-command-line
861 bindkey ^e edit-command-line
864 #+begin_src shell :tangle ~/.config/zsh/zshrc
865 setopt extended_history
867 setopt inc_append_history
868 setopt hist_ignore_dups
869 setopt hist_reduce_blanks
873 HISTFILE=~/.local/share/zsh/history
876 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
878 #+begin_src plain :tangle ~/.config/zpe/repositories
879 https://github.com/Aloxaf/fzf-tab
880 https://github.com/zdharma/fast-syntax-highlighting
881 https://github.com/rupa/z
884 #+begin_src shell :tangle ~/.config/zsh/zshrc
885 source ~/Code/zpe/zpe.sh
886 source ~/Code/admone/admone.zsh
887 source ~/.config/zsh/fzf-bindings.zsh
889 zpe-source fzf-tab/fzf-tab.zsh
890 zstyle ':completion:*:descriptions' format '[%d]'
891 zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
892 zstyle ':completion:*' completer _complete
893 zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
894 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
896 zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
897 export _Z_DATA="/home/armaa/.local/share/z"
901 **** Alert after long command
902 #+begin_src shell :tangle ~/.config/zsh/zshrc
904 notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
905 ${history[$HISTCMD]%[;&|][[:space:]]##alert}
908 **** Time Zsh startup
909 #+begin_src shell :tangle ~/.config/zsh/zshrc
911 for i in $(seq 1 10); do
912 time "zsh" -i -c exit;
916 **** Update all packages
917 #+begin_src shell :tangle ~/.config/zsh/zshrc
918 color=$(tput setaf 5)
922 sudo echo "${color}== upgrading with yay ==${reset}"
925 echo "${color}== checking for pacnew files ==${reset}"
928 echo "${color}== upgrading flatpaks ==${reset}"
931 echo "${color}== upgrading zsh plugins ==${reset}"
934 echo "${color}== updating nvim plugins ==${reset}"
935 nvim +PlugUpdate +PlugUpgrade +qall
936 echo "Updated nvim plugins"
938 echo "${color}You are entirely up to date!${reset}"
941 **** Clean all packages
942 #+begin_src shell :tangle ~/.config/zsh/zshrc
944 sudo echo "${color}== cleaning pacman orphans ==${reset}"
945 (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
947 echo "${color}== cleaning flatpaks ==${reset}"
948 flatpak remove --unused
950 echo "${color}== cleaning zsh plugins ==${reset}"
953 echo "${color}== cleaning nvim plugins ==${reset}"
954 nvim +PlugClean +qall
955 echo "Cleaned nvim plugins"
957 echo "${color}All orphans cleaned!${reset}"
961 #+begin_src shell :tangle ~/.config/zsh/zshrc
964 exa -lh --icons --git --group-directories-first
968 #+begin_src shell :tangle ~/.config/zsh/zshrc
970 __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
971 if [ $? -eq 0 ]; then
972 eval "$__conda_setup"
974 if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
975 . "/opt/anaconda/etc/profile.d/conda.sh"
977 export PATH="/opt/anaconda/bin:$PATH"
983 **** Interact with 0x0
984 #+begin_src shell :tangle ~/.config/zsh/zshrc
985 zxz="https://envs.sh"
986 0file() { curl -F"file=@$1" "$zxz" ; }
987 0pb() { curl -F"file=@-;" "$zxz" ; }
988 0url() { curl -F"url=$1" "$zxz" ; }
989 0short() { curl -F"shorten=$1" "$zxz" ; }
990 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
993 #+begin_src shell :tangle ~/.config/zsh/zshrc
1002 #+begin_src shell :tangle ~/.config/zsh/zshrc
1003 alias bhoji-drop='ssh -p 23 root@armaanb.net'
1004 alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
1005 alias tcf='ssh root@204.48.23.68'
1006 alias ngmun='ssh root@157.245.89.25'
1007 alias prox='ssh root@192.168.1.224'
1008 alias dock='ssh root@192.168.1.225'
1009 alias jenkins='ssh root@192.168.1.226'
1010 alias envs='ssh acheam@envs.net'
1012 **** File management
1013 #+begin_src shell :tangle ~/.config/zsh/zshrc
1014 alias ls='exa -lh --icons --git --group-directories-first'
1015 alias la='exa -lha --icons --git --group-directories-first'
1016 alias df='df -h / /boot'
1018 alias free='free -h'
1023 alias grep='grep -in --exclude-dir=.git --color=auto'
1024 alias mkdir='mkdir -pv'
1025 alias unar='atool -x'
1026 alias wget='wget -e robots=off'
1027 alias lanex='~/.local/share/lxc/lxc'
1030 #+begin_src shell :tangle ~/.config/zsh/zshrc
1031 alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1032 alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1034 alias padu='padm add -u && padm commit && padm push && yadu'
1037 #+begin_src shell :tangle ~/.config/zsh/zshrc
1040 alias vw="nvim ~/Documents/vimwiki/index.md"
1042 **** System management
1043 #+begin_src shell :tangle ~/.config/zsh/zshrc
1044 alias jctl='journalctl -p 3 -xb'
1045 alias pkill='pkill -i'
1047 alias please='sudo $(fc -ln -1)'
1048 alias sudo='sudo ' # allows aliases to be run with sudo
1051 #+begin_src shell :tangle ~/.config/zsh/zshrc
1052 alias ping='ping -c 10'
1053 alias speed='speedtest-cli'
1054 alias ip='ip --color=auto'
1055 alias cip='curl https://armaanb.net/ip'
1056 alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1057 alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1060 #+begin_src shell :tangle ~/.config/zsh/zshrc
1061 alias dc='docker-compose'
1062 alias dcdu='docker-compose down && docker-compose up -d'
1065 #+begin_src shell :tangle ~/.config/zsh/zshrc
1066 alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1067 iflag=fullblock status=progress'
1068 alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1069 iflag=fullblock status=progress'
1070 alias ts='gen-shell -c task'
1071 alias ts='gen-shell -c task'
1072 alias tetris='autoload -Uz tetriscurses && tetriscurses'
1073 alias news='newsboat'
1074 alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1075 alias ytmusic="youtube-dl -x --add-metadata --audio-format aac \
1076 --restrict-filenames -o '%(title)s.%(ext)s'"
1077 alias cal="cal -3 --color=auto"
1079 **** Virtual machines, chroots
1080 #+begin_src shell :tangle ~/.config/zsh/zshrc
1081 alias ckiss="sudo chrooter ~/Virtual/kiss"
1082 alias cdebian="sudo chrooter ~/Virtual/debian bash"
1083 alias cwindows='devour qemu-system-x86_64 \
1088 -device VGA,vgamem_mb=64 \
1090 -device hda-duplex \
1092 -net user,smb=/home/armaa/Public \
1093 -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1096 #+begin_src shell :tangle ~/.config/zsh/zshrc
1098 alias zpy="zconda && ipython"
1099 alias math="ipython --profile=math"
1100 alias pypi="python setup.py sdist && twine upload dist/*"
1101 alias pip="python -m pip"
1102 alias black="black -l 79"
1105 #+begin_src shell :tangle ~/.config/zsh/zshrc
1106 alias words='gen-shell -c "words"'
1107 alias words-e='gen-shell -c "words ~E"'
1110 #+begin_src shell :tangle ~/.config/zsh/zshrc
1111 alias zathura='devour zathura'
1112 alias mpv='devour mpv'
1113 alias sql='devour sqlitebrowser'
1114 alias cad='devour openscad'
1115 alias feh='devour feh'
1117 **** Package management (Pacman)
1118 #+begin_src shell :tangle ~/.config/zsh/zshrc
1120 alias api='yay -Syu'
1121 alias app='yay -Rns'
1123 alias apo='yay -Qttd'
1124 alias azf='pacman -Q | fzf'
1125 alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1126 alias ufetch='ufetch-arch'
1127 alias reflect='reflector --verbose --sort rate --save \
1128 ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1131 #+begin_src shell :tangle ~/.config/zsh/zshrc
1132 export EDITOR="emacsclient -c" # $EDITOR opens in terminal
1133 export VISUAL="emacsclient -c -a emacs" # $VISUAL opens in GUI mode
1134 export TERM=xterm-256color # for compatability
1136 export GPG_TTY="$(tty)"
1137 export MANPAGER='nvim +Man!'
1140 # generated with "vivid generate gruvbox"
1141 export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1143 export GTK_USE_PORTAL=1
1145 export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1146 export PATH="$PATH:/home/armaa/Code/scripts"
1147 export PATH="$PATH:/home/armaa/.cargo/bin"
1148 export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1149 export PATH="$PATH:/usr/sbin"
1150 export PATH="$PATH:/opt/FreeTube/freetube"
1152 export LC_ALL="en_US.UTF-8"
1153 export LC_CTYPE="en_US.UTF-8"
1154 export LANGUAGE="en_US.UTF-8"
1156 export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1157 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1158 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1159 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1160 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1161 export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1165 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1168 family: JetBrains Mono Nerd Font
1175 ligatures: true # Requires ligature patch
1182 background_opacity: 0.6
1185 Send <RET> + modifier through
1186 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1201 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1205 background: '#000000'
1206 foreground: '#ebdbb2'
1232 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1233 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1234 c.TerminalInteractiveShell.editing_mode = 'vi'
1235 c.InteractiveShell.colors = 'linux'
1236 c.TerminalInteractiveShell.confirm_exit = False
1239 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1243 return x * (180 / pi)
1246 return x * (pi / 180)
1249 return (x * (pi / 180)) / unit
1261 Make MPV play a little bit smoother.
1262 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1263 ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1268 #+begin_src conf :tangle ~/.config/picom/picom.conf
1271 shadow-offset-x = -5;
1272 shadow-offset-y = -5;
1275 #+begin_src conf :tangle ~/.config/picom/picom.conf
1280 #+begin_src conf :tangle ~/.config/picom/picom.conf
1283 method = "gaussian";
1289 Needs picom to be run with "--experimental-backends"
1290 #+begin_src conf :tangle ~/.config/picom/picom.conf
1294 For any GNU Readline programs
1295 #+begin_src plain :tangle ~/.inputrc
1299 https://github.com/sharkdp/vivid
1301 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1303 background_color: '282A36'
1315 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1332 missing_symlink_target:
1358 sticky_other_writable:
1391 continuous-integration:
1402 font-style: underline
1413 #+begin_src plain :tangle ~/.gitconfig
1415 name = Armaan Bhojwani
1416 email = me@armaanb.net
1417 signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1420 #+begin_src plain :tangle ~/.gitconfig
1422 defaultBranch = main
1425 #+begin_src plain :tangle ~/.gitconfig
1430 #+begin_src plain :tangle ~/.gitconfig
1432 smtpserver = smtp.mailbox.org
1433 smtpuser = me@armaanb.net
1434 smtpencryption = ssl
1435 smtpserverport = 465
1439 #+begin_src plain :tangle ~/.gitconfig
1444 #+begin_src plain :tangle ~/.gitconfig
1447 sclone = clone --depth 1
1453 subup = submodule update --remote
1454 loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1455 mirror = git config --global alias.mirrormirror
1458 #+begin_src plain :tangle ~/.gitconfig
1463 Lightweight notification daemon. Gruvbox colors, based on https://github.com/a-schaefers/i3-wm-gruvbox-theme/
1465 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1467 font = "JetBrains Mono Medium Nerd Font 11"
1469 format = "<b>%s</b>\n%b"
1471 indicate_hidden = yes
1474 show_age_threshold = 60
1477 geometry = "400x5-20+20"
1479 idle_threshold = 120
1481 sticky_history = yes
1483 separator_height = 4
1485 horizontal_padding = 8
1487 separator_color = "#585858"
1488 startup_notification = false
1491 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1498 close_all = mod4+shift+c
1499 history = mod4+ctrl+c
1502 background = "#282828"
1503 foreground = "#ebdbb2"
1504 highlight = "#ebdbb2"
1508 background = "#282828"
1509 foreground = "#ebdbb2"
1510 highlight = "#ebdbb2"
1514 background = "#282828"
1515 foreground = "#cc241d"
1516 highlight = "#ebdbb2"