]> git.armaanb.net Git - config.org.git/blob - config.org
Add back pas(s/h) bindings
[config.org.git] / config.org
1 #+TITLE: System Configuration
2 #+DESCRIPTION: Personal system configuration in org-mode format.
3 #+AUTHOR: Armaan Bhojwani
4 #+EMAIL: me@armaanb.net
5
6 * Welcome
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!
8 ** Compatability
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.
10 ** Choices
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.
12
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.
14
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.
16 ** TODOs
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
19 - Offlineimap
20 - irc.el
21 ** License
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.
23 * Package management
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)
28   (let ((bootstrap-file
29          (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
30         (bootstrap-version 5))
31     (unless (file-exists-p bootstrap-file)
32       (with-current-buffer
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))
39 #+end_src
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)
44 #+end_src
45 * Visual options
46 ** Theme
47 Very nice high contrast theme.
48
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)
59 #+end_src
60 ** Typography
61 *** Font
62 Great programming font with ligatures.
63 #+begin_src emacs-lisp
64   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
65 #+end_src
66 *** Ligatures
67 #+begin_src emacs-lisp
68   (use-package ligature
69     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
70     :config
71     (ligature-set-ligatures
72      '(prog-mode text-mode)
73      '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
74        "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
75        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
76        "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
77        "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
78        ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
79        "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
80        "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
81        "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
82        "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
83        "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
84        "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
85     (global-ligature-mode t))
86 #+end_src
87 *** Emoji
88 #+begin_src emacs-lisp
89   (use-package emojify
90     :config (global-emojify-mode))
91
92   ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
93   (set-fontset-font
94    t
95    '(#x1f300 . #x1fad0)
96    (cond
97     ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
98     ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
99     ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
100 #+end_src
101 ** Line numbers
102 Display relative line numbers except in some modes
103 #+begin_src emacs-lisp
104   (global-display-line-numbers-mode)
105   (setq display-line-numbers-type 'relative)
106   (dolist (no-line-num '(term-mode-hook
107                          pdf-view-mode-hook
108                          shell-mode-hook
109                          org-mode-hook
110                          eshell-mode-hook))
111     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
112 #+end_src
113 ** Highlight matching parenthesis
114 #+begin_src emacs-lisp
115   (use-package paren
116     :config (show-paren-mode)
117     :custom (show-paren-style 'parenthesis))
118 #+end_src
119 ** Modeline
120 *** Show current function
121 #+begin_src emacs-lisp
122   (which-function-mode)
123 #+end_src
124 *** Make position in file more descriptive
125 Show current column and file size.
126 #+begin_src emacs-lisp
127   (column-number-mode)
128   (size-indication-mode)
129 #+end_src
130 *** Hide minor modes
131 #+begin_src emacs-lisp
132   (use-package minions
133     :config (minions-mode))
134 #+end_src
135 ** Word count
136 #+begin_src emacs-lisp
137  (use-package wc-mode
138    :straight (wc-mode :type git :host github :repo "bnbeckwith/wc-mode")
139    :hook (text-mode-hook . wc-mode))
140 #+end_src
141 ** Ruler
142 Show a ruler at a certain number of chars depending on mode.
143 #+begin_src emacs-lisp
144   (global-display-fill-column-indicator-mode)
145 #+end_src
146 ** Keybinding hints
147 Whenever starting a key chord, show possible future steps.
148 #+begin_src emacs-lisp
149   (use-package which-key
150     :config (which-key-mode)
151     :custom (which-key-idle-delay 0.3))
152 #+end_src
153 ** Highlight TODOs in comments
154 #+begin_src emacs-lisp
155   (use-package hl-todo
156     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
157     :config (global-hl-todo-mode 1))
158 #+end_src
159 ** Don't lose cursor
160 #+begin_src emacs-lisp
161   (blink-cursor-mode)
162 #+end_src
163 ** Visual line mode
164 Soft wrap words and do operations by visual lines.
165 #+begin_src emacs-lisp
166   (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
167 #+end_src
168 ** Display number of matches in search
169 #+begin_src emacs-lisp
170   (use-package anzu
171     :config (global-anzu-mode))
172 #+end_src
173 ** Visual bell
174 Inverts modeline instead of audible bell or the standard visual bell.
175 #+begin_src emacs-lisp
176   (setq visible-bell nil
177         ring-bell-function 'flash-mode-line)
178   (defun flash-mode-line ()
179     (invert-face 'mode-line)
180     (run-with-timer 0.1 nil #'invert-face 'mode-line))
181 #+end_src
182 * Evil mode
183 ** General
184 #+begin_src emacs-lisp
185   (use-package evil
186     :custom (select-enable-clipboard nil)
187     :config
188     (evil-mode)
189     (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
190     ;; Use visual line motions even outside of visual-line-mode buffers
191     (evil-global-set-key 'motion "j" 'evil-next-visual-line)
192     (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
193     (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
194 #+end_src
195 ** Evil collection
196 #+begin_src emacs-lisp
197   (use-package evil-collection
198     :after evil
199     :init (evil-collection-init)
200     :custom (evil-collection-setup-minibuffer t))
201 #+end_src
202 ** Surround
203 tpope prevails!
204 #+begin_src emacs-lisp
205   (use-package evil-surround
206     :config (global-evil-surround-mode))
207 #+end_src
208 ** Leader key
209 #+begin_src emacs-lisp
210   (use-package evil-leader
211     :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
212     :config
213     (evil-leader/set-leader "<SPC>")
214     (global-evil-leader-mode))
215 #+end_src
216 ** Nerd commenter
217 #+begin_src emacs-lisp
218   ;; Nerd commenter
219   (use-package evil-nerd-commenter
220     :bind (:map evil-normal-state-map
221                 ("gc" . evilnc-comment-or-uncomment-lines))
222     :custom (evilnc-invert-comment-line-by-line nil))
223 #+end_src
224 ** Undo redo
225 Fix the oopsies!
226 #+begin_src emacs-lisp
227   (evil-set-undo-system 'undo-redo)
228 #+end_src
229 ** Number incrementing
230 Add back C-a/C-x
231 #+begin_src emacs-lisp
232   (use-package evil-numbers
233     :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
234     :bind (:map evil-normal-state-map
235                 ("C-M-a" . evil-numbers/inc-at-pt)
236                 ("C-M-x" . evil-numbers/dec-at-pt)))
237 #+end_src
238 ** Evil org
239 *** Init
240 #+begin_src emacs-lisp
241   (use-package evil-org
242     :after org
243     :hook (org-mode . evil-org-mode)
244     :config
245     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
246   (use-package evil-org-agenda
247     :straight (:type built-in)
248     :after evil-org
249     :config
250     (evil-org-agenda-set-keys))
251 #+end_src
252 *** Leader maps
253 #+begin_src emacs-lisp
254   (evil-leader/set-key-for-mode 'org-mode
255     "T" 'org-show-todo-tree
256     "a" 'org-agenda
257     "c" 'org-archive-subtree)
258 #+end_src
259 * Org mode
260 ** General
261 #+begin_src emacs-lisp
262   (use-package org
263     :straight (:type built-in)
264     :commands (org-capture org-agenda)
265     :custom
266     (org-ellipsis " ▾")
267     (org-agenda-start-with-log-mode t)
268     (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
269     (org-log-done 'time)
270     (org-log-into-drawer t)
271     (org-src-tab-acts-natively t)
272     (org-src-fontify-natively t)
273     (org-startup-indented t)
274     (org-hide-emphasis-markers t)
275     (org-fontify-whole-block-delimiter-line nil)
276     :bind ("C-c a" . org-agenda))
277 #+end_src
278 ** Tempo
279 #+begin_src emacs-lisp
280   (use-package org-tempo
281     :after org
282     :straight (:type built-in)
283     :config
284     ;; TODO: There's gotta be a more efficient way to write this
285     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
286     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
287     (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
288     (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
289     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
290     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
291     (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
292     (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
293     (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
294     (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
295     (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
296     (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")))
297 #+end_src
298 ** Presentations
299 #+begin_src emacs-lisp
300   (use-package org-present
301     :straight (org-present :type git :host github :repo "rlister/org-present"))
302 #+end_src
303 * Autocompletion
304 ** Ivy
305 Simple, but not too simple autocompletion.
306 #+begin_src emacs-lisp
307   (use-package ivy
308     :bind (("C-s" . swiper)
309            :map ivy-minibuffer-map
310            ("TAB" . ivy-alt-done)
311            :map ivy-switch-buffer-map
312            ("M-d" . ivy-switch-buffer-kill))
313     :config (ivy-mode))
314 #+end_src
315 ** Ivy-rich
316 #+begin_src emacs-lisp
317   (use-package ivy-rich
318     :after (ivy counsel)
319     :config (ivy-rich-mode))
320 #+end_src
321 ** Counsel
322 Ivy everywhere.
323 #+begin_src emacs-lisp
324   (use-package counsel
325     :bind (("C-M-j" . 'counsel-switch-buffer)
326            :map minibuffer-local-map
327            ("C-r" . 'counsel-minibuffer-history))
328     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
329     :config (counsel-mode))
330 #+end_src
331 ** Remember frequent commands
332 #+begin_src emacs-lisp
333   (use-package ivy-prescient
334     :after counsel
335     :custom
336     (ivy-prescient-enable-filtering nil)
337     :config
338     (prescient-persist-mode)
339     (ivy-prescient-mode))
340 #+end_src
341 ** Swiper
342 Better search utility.
343 #+begin_src emacs-lisp
344   (use-package swiper)
345 #+end_src
346 * EmacsOS
347 ** RSS
348 Use elfeed for RSS. I have another file with all the feeds in it.
349 #+begin_src emacs-lisp
350   (use-package elfeed
351     :bind (("C-c e" . elfeed))
352     :config
353     (load "~/.emacs.d/feeds.el")
354     (add-hook 'elfeed-new-entry-hook
355               (elfeed-make-tagger :feed-url "youtube\\.com"
356                                   :add '(youtube)))
357     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
358
359   (use-package elfeed-goodies
360     :after elfeed
361     :config (elfeed-goodies/setup))
362 #+end_src
363 ** Email
364 Use mu4e for reading emails.
365
366 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
368 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.
369 #+begin_src emacs-lisp
370   (use-package smtpmail
371     :straight (:type built-in))
372   (use-package mu4e
373     :load-path "/usr/share/emacs/site-lisp/mu4e"
374     :straight (:build nil)
375     :bind (("C-c m" . mu4e))
376     :config
377     (setq user-full-name "Armaan Bhojwani"
378           smtpmail-local-domain "armaanb.net"
379           smtpmail-stream-type 'ssl
380           smtpmail-smtp-service '465
381           mu4e-change-filenames-when-moving 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-completing-read-function 'ivy-completing-read
386           mu4e-confirm-quit nil
387           mail-user-agent 'mu4e-user-agent
388           mu4e-contexts
389           `( ,(make-mu4e-context
390                :name "school"
391                :enter-func (lambda () (mu4e-message "Entering school context"))
392                :leave-func (lambda () (mu4e-message "Leaving school context"))
393                :match-func (lambda (msg)
394                              (when msg
395                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
396                :vars '((user-mail-address . "abhojwani22@nobles.edu")
397                        (mu4e-sent-folder . "/school/Sent")
398                        (mu4e-drafts-folder . "/school/Drafts")
399                        (mu4e-trash-folder . "/school/Trash")
400                        (mu4e-refile-folder . "/school/Archive")
401                        (user-mail-address . "abhojwani22@nobles.edu")
402                        (smtpmail-smtp-user . "abhojwani22@nobles.edu")
403                        (smtpmail-smtp-server . "smtp.gmail.com")))
404              ,(make-mu4e-context
405                :name "personal"
406                :enter-func (lambda () (mu4e-message "Entering personal context"))
407                :leave-func (lambda () (mu4e-message "Leaving personal context"))
408                :match-func (lambda (msg)
409                              (when msg
410                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
411                :vars '((mu4e-sent-folder . "/personal/Sent")
412                        (mu4e-drafts-folder . "/personal/Drafts")
413                        (mu4e-trash-folder . "/personal/Trash")
414                        (mu4e-refile-folder . "/personal/Archive")
415                        (user-mail-address . "me@armaanb.net")
416                        (smtpmail-smtp-user . "me@armaanb.net")
417                        (smtpmail-smtp-server "smtp.mailbox.org")
418                        (mu4e-drafts-folder . "/school/Drafts")
419                        (mu4e-trash-folder . "/school/Trash")))))
420     (add-to-list 'mu4e-bookmarks
421                  '(:name "Unified inbox"
422                          :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
423                          :key ?b))
424     :hook ((mu4e-compose-mode . flyspell-mode)
425            (mu4e-view-mode-hook . turn-on-visual-line-mode)))
426 #+end_src
427 ** Default browser
428 Set EWW as default browser except for videos.
429 #+begin_src emacs-lisp
430   (defun browse-url-mpv (url &optional new-window)
431     "Open URL in MPV."
432     (start-process "mpv" "*mpv*" "mpv" url))
433
434   (setq browse-url-handlers
435         (quote
436          (("youtu\\.?be" . browse-url-mpv)
437           ("peertube.*" . browse-url-mpv)
438           ("vid.*" . browse-url-mpv)
439           ("vid.*" . browse-url-mpv)
440           ("." . eww-browse-url)
441           )))
442 #+end_src
443 ** EWW
444 Some EWW enhancements.
445 *** Give buffer a useful name
446 #+begin_src emacs-lisp
447   ;; From https://protesilaos.com/dotemacs/
448   (defun prot-eww--rename-buffer ()
449     "Rename EWW buffer using page title or URL.
450   To be used by `eww-after-render-hook'."
451     (let ((name (if (eq "" (plist-get eww-data :title))
452                     (plist-get eww-data :url)
453                   (plist-get eww-data :title))))
454       (rename-buffer (format "*%s # eww*" name) t)))
455
456   (add-hook 'eww-after-render-hook #'prot-eww--rename-buffer)
457 #+end_src
458 *** Better entrypoint
459 #+begin_src emacs-lisp
460   ;; From https://protesilaos.com/dotemacs/
461   (defun prot-eww-browse-dwim (url &optional arg)
462     "Visit a URL, maybe from `eww-prompt-history', with completion.
463
464   With optional prefix ARG (\\[universal-argument]) open URL in a
465   new eww buffer.
466
467   If URL does not look like a valid link, run a web query using
468   `eww-search-prefix'.
469
470   When called from an eww buffer, provide the current link as
471   initial input."
472     (interactive
473      (list
474       (completing-read "Query:" eww-prompt-history
475                        nil nil (plist-get eww-data :url) 'eww-prompt-history)
476       current-prefix-arg))
477     (eww url (if arg 4 nil)))
478
479   (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
480 #+end_src
481 ** IRC
482 #+begin_src emacs-lisp
483   (use-package erc
484     :straight (:type built-in)
485     :config
486     (load "~/.emacs.d/irc.el")
487     (acheam-irc)
488     (erc-notifications-enable)
489     (erc-smiley-disable))
490
491   (use-package erc-hl-nicks
492     :config (erc-hl-nicks-mode 1))
493 #+end_src
494 ** Emacs Anywhere
495 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
496 =emacsclient --eval "(emacs-everywhere)"=.
497 #+begin_src emacs-lisp
498   (use-package emacs-everywhere)
499 #+end_src
500 * Emacs IDE
501 ** Code cleanup
502 #+begin_src emacs-lisp
503   (use-package blacken
504     :hook (python-mode . blacken-mode)
505     :config
506     (setq blacken-line-length 79))
507
508   ;; Purge whitespace
509   (use-package ws-butler
510     :config
511     (ws-butler-global-mode))
512 #+end_src
513 ** Flycheck
514 #+begin_src emacs-lisp
515   (use-package flycheck
516     :config
517     (global-flycheck-mode))
518 #+end_src
519 ** Project management
520 #+begin_src emacs-lisp
521   (use-package projectile
522     :config (projectile-mode)
523     :custom ((projectile-completion-system 'ivy))
524     :bind-keymap
525     ("C-c p" . projectile-command-map)
526     :init
527     (when (file-directory-p "~/Code")
528       (setq projectile-project-search-path '("~/Code")))
529     (setq projectile-switch-project-action #'projectile-dired))
530
531   (use-package counsel-projectile
532     :after projectile
533     :config (counsel-projectile-mode))
534 #+end_src
535 ** Dired
536 #+begin_src emacs-lisp
537   (use-package dired
538     :straight (:type built-in)
539     :commands (dired dired-jump)
540     :custom ((dired-listing-switches "-agho --group-directories-first"))
541     :config
542     (evil-collection-define-key 'normal 'dired-mode-map
543       "h" 'dired-single-up-directory
544       "l" 'dired-single-buffer))
545
546   (use-package dired-single
547     :commands (dired dired-jump))
548
549   (use-package dired-open
550     :commands (dired dired-jump)
551     :custom
552     (dired-open-extensions '(("png" . "feh")
553                              ("mkv" . "mpv"))))
554
555   (use-package dired-hide-dotfiles
556     :hook (dired-mode . dired-hide-dotfiles-mode)
557     :config
558     (evil-collection-define-key 'normal 'dired-mode-map
559       "H" 'dired-hide-dotfiles-mode))
560 #+end_src
561 ** Git
562 *** Magit
563 # TODO: Write a command that commits hunk, skipping staging step.
564 #+begin_src emacs-lisp
565   (use-package magit)
566 #+end_src
567 *** Colored diff in line number area
568 #+begin_src emacs-lisp
569   (use-package diff-hl
570     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
571     :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
572            (magit-post-refresh-hook . diff-hl-magit-post-refresh))
573     :config (global-diff-hl-mode))
574 #+end_src
575 * General text editing
576 ** Indentation
577 Indent after every change.
578 #+begin_src emacs-lisp
579   (use-package aggressive-indent
580     :config (global-aggressive-indent-mode))
581 #+end_src
582 ** Spell checking
583 Spell check in text mode, and in prog-mode comments.
584 #+begin_src emacs-lisp
585   (dolist (hook '(text-mode-hook))
586     (add-hook hook (lambda () (flyspell-mode))))
587   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
588     (add-hook hook (lambda () (flyspell-mode -1))))
589   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
590 #+end_src
591 ** Expand tabs to spaces
592 #+begin_src emacs-lisp
593   (setq-default tab-width 2)
594 #+end_src
595 ** Copy kill ring to clipboard
596 #+begin_src emacs-lisp
597   (setq x-select-enable-clipboard t)
598   (defun copy-kill-ring-to-xorg ()
599     "Copy the current kill ring to the xorg clipboard."
600     (interactive)
601     (x-select-text (current-kill 0)))
602 #+end_src
603 ** Browse kill ring
604 #+begin_src emacs-lisp
605   (use-package browse-kill-ring)
606 #+end_src
607 ** Save place
608 Opens file where you left it.
609 #+begin_src emacs-lisp
610   (save-place-mode)
611 #+end_src
612 ** Writing mode
613 Distraction free writing a la junegunn/goyo.
614 #+begin_src emacs-lisp
615   (use-package olivetti
616     :config
617     (evil-leader/set-key "o" 'olivetti-mode))
618 #+end_src
619 ** Abbreviations
620 Abbreviate things!
621 #+begin_src emacs-lisp
622   (setq abbrev-file-name "~/.emacs.d/abbrevs")
623   (setq save-abbrevs 'silent)
624   (setq-default abbrev-mode t)
625 #+end_src
626 ** TRAMP
627 #+begin_src emacs-lisp
628   (setq tramp-default-method "ssh")
629 #+end_src
630 ** Don't ask about following symlinks in vc
631 #+begin_src emacs-lisp
632   (setq vc-follow-symlinks t)
633 #+end_src
634 ** Don't ask to save custom dictionary
635 #+begin_src emacs-lisp
636   (setq ispell-silently-savep t)
637 #+end_src
638 * Functions
639 ** Easily convert splits
640 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
641 #+begin_src emacs-lisp
642   (defun toggle-window-split ()
643     (interactive)
644     (if (= (count-windows) 2)
645         (let* ((this-win-buffer (window-buffer))
646                (next-win-buffer (window-buffer (next-window)))
647                (this-win-edges (window-edges (selected-window)))
648                (next-win-edges (window-edges (next-window)))
649                (this-win-2nd (not (and (<= (car this-win-edges)
650                                            (car next-win-edges))
651                                        (<= (cadr this-win-edges)
652                                            (cadr next-win-edges)))))
653                (splitter
654                 (if (= (car this-win-edges)
655                        (car (window-edges (next-window))))
656                     'split-window-horizontally
657                   'split-window-vertically)))
658           (delete-other-windows)
659           (let ((first-win (selected-window)))
660             (funcall splitter)
661             (if this-win-2nd (other-window 1))
662             (set-window-buffer (selected-window) this-win-buffer)
663             (set-window-buffer (next-window) next-win-buffer)
664             (select-window first-win)
665             (if this-win-2nd (other-window 1))))))
666
667   (define-key ctl-x-4-map "t" 'toggle-window-split)
668 #+end_src
669 ** Insert date
670 #+begin_src emacs-lisp
671   (defun insert-date ()
672     (interactive)
673     (insert (format-time-string "%Y-%m-%d")))
674 #+end_src
675 * Keybindings
676 ** Switch windows
677 #+begin_src emacs-lisp
678   (use-package ace-window
679     :bind ("M-o" . ace-window))
680 #+end_src
681 ** Kill current buffer
682 Makes "C-x k" binding faster.
683 #+begin_src emacs-lisp
684   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
685 #+end_src
686 * Other settings
687 ** OpenSCAD
688 Render OpenSCAD files, and add a preview window.
689
690 Personal fork just merges a PR.
691 #+begin_src emacs-lisp
692   (use-package scad-mode)
693   (use-package scad-preview
694     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
695 #+end_src
696 ** Control backup files
697 Stop backup files from spewing everywhere.
698 #+begin_src emacs-lisp
699   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
700 #+end_src
701 ** Make yes/no easier
702 #+begin_src emacs-lisp
703   (defalias 'yes-or-no-p 'y-or-n-p)
704 #+end_src
705 ** Move customize file
706 No more clogging up init.el.
707 #+begin_src emacs-lisp
708   (setq custom-file "~/.emacs.d/custom.el")
709   (load custom-file)
710 #+end_src
711 ** Better help
712 #+begin_src emacs-lisp
713   (use-package helpful
714     :commands (helpful-callable helpful-variable helpful-command helpful-key)
715     :custom
716     (counsel-describe-function-function #'helpful-callable)
717     (counsel-describe-variable-function #'helpful-variable)
718     :bind
719     ([remap describe-function] . counsel-describe-function)
720     ([remap describe-command] . helpful-command)
721     ([remap describe-variable] . counsel-describe-variable)
722     ([remap describe-key] . helpful-key))
723 #+end_src
724 ** GPG
725 #+begin_src emacs-lisp
726   (use-package epa-file
727     :straight (:type built-in)
728     :custom
729     (epa-file-select-keys nil)
730     (epa-file-encrypt-to '("me@armaanb.net"))
731     (password-cache-expiry (* 60 15)))
732
733   (use-package pinentry
734     :config (pinentry-start))
735 #+end_src
736 ** Pastebin
737 #+begin_src emacs-lisp
738   (use-package 0x0
739     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
740     :custom (0x0-default-service 'envs)
741     :config (evil-leader/set-key
742               "00" '0x0-upload
743               "0f" '0x0-upload-file
744               "0s" '0x0-upload-string
745               "0c" '0x0-upload-kill-ring
746               "0p" '0x0-upload-popup))
747 #+end_src
748 * Tangles
749 ** Spectrwm
750 *** General settings
751 #+begin_src conf :tangle ~/.spectrwm.conf
752   workspace_limit = 5
753   warp_pointer = 1
754   modkey = Mod4
755   autorun = ws[1]:/home/armaa/Code/scripts/autostart
756 #+end_src
757 *** Bar
758 #+begin_src conf :tangle ~/.spectrwm.conf
759   bar_enabled = 0
760   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
761 #+end_src
762 *** Keybindings
763 **** WM actions
764 #+begin_src conf :tangle ~/.spectrwm.conf
765   program[term] = alacritty
766   program[screenshot_all] = flameshot gui
767   program[notif] = /home/armaa/Code/scripts/setter status
768   program[pass] = /home/armaa/Code/scripts/passmenu
769
770   bind[notif] = MOD+n
771   bind[pass] = MOD+Shift+p
772 #+end_src
773 **** Media keys
774 #+begin_src conf :tangle ~/.spectrwm.conf
775   program[paup] = /home/armaa/Code/scripts/setter audio +5
776   program[padown] = /home/armaa/Code/scripts/setter audio -5
777   program[pamute] = /home/armaa/Code/scripts/setter audio
778   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
779   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
780   program[next] = playerctl next
781   program[prev] = playerctl previous
782   program[pause] = playerctl play-pause
783
784   bind[padown] = XF86AudioLowerVolume
785   bind[paup] = XF86AudioRaiseVolume
786   bind[pamute] = XF86AudioMute
787   bind[brigdown] = XF86MonBrightnessDown
788   bind[brigup] = XF86MonBrightnessUp
789   bind[pause] = XF86AudioPlay
790   bind[next] = XF86AudioNext
791   bind[prev] = XF86AudioPrev
792 #+end_src
793 **** HJKL
794 #+begin_src conf :tangle ~/.spectrwm.conf
795   program[h] = xdotool keyup h key --clearmodifiers Left
796   program[j] = xdotool keyup j key --clearmodifiers Down
797   program[k] = xdotool keyup k key --clearmodifiers Up
798   program[l] = xdotool keyup l key --clearmodifiers Right
799
800   bind[h] = MOD + Control + h
801   bind[j] = MOD + Control + j
802   bind[k] = MOD + Control + k
803   bind[l] = MOD + Control + l
804 #+end_src
805 **** Programs
806 #+begin_src conf :tangle ~/.spectrwm.conf
807   program[aerc] = alacritty -e aerc
808   program[catgirl] = alacritty --hold -e sh -c "while : ; do ssh root@armaanb.net -t abduco -A irc catgirl freenode; sleep 2; done"
809   program[emacs] = emacsclient -c
810   program[firefox] = firefox
811   program[calc] = alacritty -e bc
812   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
813
814   bind[aerc] = MOD+Control+1
815   bind[catgirl] = MOD+Control+2
816   bind[firefox] = MOD+Control+3
817   bind[emacs-anywhere] = MOD+Control+4
818   bind[calc] = MOD+Control+5
819   bind[emacs] = MOD+Control+Return
820 #+end_src
821 ** Zsh
822 *** Settings
823 **** Completions
824 #+begin_src shell :tangle ~/.config/zsh/zshrc
825   autoload -Uz compinit
826   compinit
827
828   setopt no_case_glob
829   unsetopt glob_complete
830
831   # Fragment completions
832   zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
833
834   # Menu completions
835   zstyle ':completion:*' menu select
836   zmodload zsh/complist
837   bindkey -M menuselect '^n' expand-or-complete
838   bindkey -M menuselect '^p' reverse-menu-complete
839
840 #+end_src
841 **** Vim bindings
842 #+begin_src shell :tangle ~/.config/zsh/zshrc
843   bindkey -v
844   KEYTIMEOUT=1
845
846   bindkey -M vicmd "^[[3~" delete-char
847   bindkey "^[[3~" delete-char
848
849   autoload edit-command-line
850   zle -N edit-command-line
851   bindkey -M vicmd ^e edit-command-line
852   bindkey ^e edit-command-line
853 #+end_src
854 **** History
855 #+begin_src shell :tangle ~/.config/zsh/zshrc
856   setopt extended_history
857   setopt share_history
858   setopt inc_append_history
859   setopt hist_ignore_dups
860   setopt hist_reduce_blanks
861
862   HISTSIZE=100000
863   SAVEHIST=100000
864   HISTFILE=~/.local/share/zsh/history
865 #+end_src
866 *** Plugins
867 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
868
869 Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition.
870 **** ZPE
871 #+begin_src conf :tangle ~/.config/zpe/repositories
872   https://github.com/zdharma/fast-syntax-highlighting
873 #+end_src
874 **** Zshrc
875 #+begin_src shell :tangle ~/.config/zsh/zshrc
876   source ~/Code/zpe/zpe.sh
877   source ~/Code/admone/admone.zsh
878   source ~/.config/zsh/fzf-bindings.zsh
879
880   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
881 #+end_src
882 *** Functions
883 **** Time Zsh startup
884 #+begin_src shell :tangle ~/.config/zsh/zshrc
885   timer() {
886       for i in $(seq 1 10); do time "$1" -i -c exit; done
887   }
888 #+end_src
889 **** Update all packages
890 #+begin_src shell :tangle ~/.config/zsh/zshrc
891   color=$(tput setaf 5)
892   reset=$(tput sgr0)
893
894   apu() {
895       sudo echo "${color}== upgrading with yay ==${reset}"
896       yay
897       echo ""
898       echo "${color}== checking for pacnew files ==${reset}"
899       sudo pacdiff
900       echo
901       echo "${color}== upgrading flatpaks ==${reset}"
902       flatpak update
903       echo ""
904       echo "${color}== upgrading zsh plugins ==${reset}"
905       zpe-pull
906       echo ""
907       echo "${color}== updating nvim plugins ==${reset}"
908       nvim +PlugUpdate +PlugUpgrade +qall
909       echo "Updated nvim plugins"
910       echo ""
911       echo "${color}You are entirely up to date!${reset}"
912   }
913 #+end_src
914 **** Clean all packages
915 #+begin_src shell :tangle ~/.config/zsh/zshrc
916   apap() {
917       sudo echo "${color}== cleaning pacman orphans ==${reset}"
918       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
919       echo ""
920       echo "${color}== cleaning flatpaks ==${reset}"
921       flatpak remove --unused
922       echo ""
923       echo "${color}== cleaning zsh plugins ==${reset}"
924       zpe-clean
925       echo ""
926       echo "${color}== cleaning nvim plugins ==${reset}"
927       nvim +PlugClean +qall
928       echo "Cleaned nvim plugins"
929       echo ""
930       echo "${color}All orphans cleaned!${reset}"
931   }
932 #+end_src
933 **** Setup anaconda
934 #+begin_src shell :tangle ~/.config/zsh/zshrc
935   zconda() {
936       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
937       if [ $? -eq 0 ]; then
938           eval "$__conda_setup"
939       else
940           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
941               . "/opt/anaconda/etc/profile.d/conda.sh"
942           else
943               export PATH="/opt/anaconda/bin:$PATH"
944           fi
945       fi
946       unset __conda_setup
947   }
948 #+end_src
949 **** Interact with 0x0
950 #+begin_src shell :tangle ~/.config/zsh/zshrc
951   zxz="https://envs.sh"
952   0file() { curl -F"file=@$1" "$zxz" ; }
953   0pb() { curl -F"file=@-;" "$zxz" ; }
954   0url() { curl -F"url=$1" "$zxz" ; }
955   0short() { curl -F"shorten=$1" "$zxz" ; }
956   0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
957 #+end_src
958 **** Finger
959 #+begin_src shell :tangle ~/.config/zsh/zshrc
960   finger() {
961       user=$(echo "$1" | cut -f 1 -d '@')
962       host=$(echo "$1" | cut -f 2 -d '@')
963       echo $user | nc "$host" 79 -N
964   }
965 #+end_src
966 **** Upload to ftp.armaanb.net
967 #+begin_src shell :tangle ~/.config/zsh/zshrc
968   pubup() {
969       rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
970       echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
971   }
972 #+end_src
973 *** Aliases
974 **** SSH
975 #+begin_src shell :tangle ~/.config/zsh/zshrc
976   alias bhoji-drop='ssh -p 23 root@armaanb.net'
977   alias catgirl='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
978   alias union='ssh 192.168.1.18'
979   alias mine='ssh -p 23 root@pickupserver.cc'
980   alias tcf='ssh root@204.48.23.68'
981   alias ngmun='ssh root@157.245.89.25'
982   alias prox='ssh root@192.168.1.224'
983   alias ncq='ssh root@143.198.123.17'
984   alias dock='ssh root@192.168.1.225'
985   alias jenkins='ssh root@192.168.1.226'
986   alias envs='ssh acheam@envs.net'
987 #+end_src
988 **** File management
989 #+begin_src shell :tangle ~/.config/zsh/zshrc
990   alias ls='exa -lh --icons --git --group-directories-first'
991   alias la='exa -lha --icons --git --group-directories-first'
992   alias df='df -h / /boot'
993   alias du='du -h'
994   alias free='free -h'
995   alias cp='cp -riv'
996   alias rm='rm -Iv'
997   alias mv='mv -iv'
998   alias ln='ln -iv'
999   alias grep='grep -in --exclude-dir=.git --color=auto'
1000   alias fname='find -name'
1001   alias mkdir='mkdir -pv'
1002   alias unar='atool -x'
1003   alias wget='wget -e robots=off'
1004   alias lanex='~/.local/share/lxc/lxc'
1005 #+end_src
1006 **** Editing
1007 #+begin_src shell :tangle ~/.config/zsh/zshrc
1008   alias v='nvim'
1009   alias vim='nvim'
1010   alias vw="nvim ~/Documents/vimwiki/index.md"
1011 #+end_src
1012 **** System management
1013 #+begin_src shell :tangle ~/.config/zsh/zshrc
1014   alias jctl='journalctl -p 3 -xb'
1015   alias pkill='pkill -i'
1016   alias cx='chmod +x'
1017   alias redoas='doas $(fc -ln -1)'
1018   alias crontab='crontab-argh'
1019   alias sudo='doas ' # allows aliases to be run with doas
1020   alias pasc='pass -c'
1021   alias pasu='\pass git push'
1022   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1023     yadm push'
1024 #+end_src
1025 **** Networking
1026 #+begin_src shell :tangle ~/.config/zsh/zshrc
1027   alias ping='ping -c 10'
1028   alias speed='speedtest-cli'
1029   alias ip='ip --color=auto'
1030   alias cip='curl https://armaanb.net/ip'
1031   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1032   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1033   alias plan='T=$(mktemp) && \
1034         rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
1035         TT=$(mktemp) && \
1036         head -n -2 $T > $TT && \
1037         vim $TT && \
1038         echo "\nLast updated: $(date -R)" >> "$TT" && \
1039         rsync "$TT" root@armaanb.net:/etc/finger/plan.txt'
1040   alias wttr='curl -s "wttr.in/02445?n" | head -n -3'
1041 #+end_src
1042 **** Other
1043 #+begin_src shell :tangle ~/.config/zsh/zshrc
1044   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1045     iflag=fullblock status=progress'
1046   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1047     iflag=fullblock status=progress'
1048   alias ts='gen-shell -c task'
1049   alias ts='gen-shell -c task'
1050   alias tetris='autoload -Uz tetriscurses && tetriscurses'
1051   alias news='newsboat'
1052   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1053   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1054     --restrict-filenames -o '%(title)s.%(ext)s'"
1055   alias cal="cal -3 --color=auto"
1056   alias bc='bc -l'
1057 #+end_src
1058 **** Virtual machines, chroots
1059 #+begin_src shell :tangle ~/.config/zsh/zshrc
1060   alias ckiss="sudo chrooter ~/Virtual/kiss"
1061   alias cdebian="sudo chrooter ~/Virtual/debian bash"
1062   alias cwindows='devour qemu-system-x86_64 \
1063     -smp 3 \
1064     -cpu host \
1065     -enable-kvm \
1066     -m 3G \
1067     -device VGA,vgamem_mb=64 \
1068     -device intel-hda \
1069     -device hda-duplex \
1070     -net nic \
1071     -net user,smb=/home/armaa/Public \
1072     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1073 #+end_src
1074 **** Python
1075 #+begin_src shell :tangle ~/.config/zsh/zshrc
1076   alias ipy="ipython"
1077   alias zpy="zconda && ipython"
1078   alias math="ipython --profile=math"
1079   alias pypi="python setup.py sdist && twine upload dist/*"
1080   alias pip="python -m pip"
1081   alias black="black -l 79"
1082 #+end_src
1083 **** Latin
1084 #+begin_src shell :tangle ~/.config/zsh/zshrc
1085   alias words='gen-shell -c "words"'
1086   alias words-e='gen-shell -c "words ~E"'
1087 #+end_src
1088 **** Devour
1089 #+begin_src shell :tangle ~/.config/zsh/zshrc
1090   alias zathura='devour zathura'
1091   alias mpv='devour mpv'
1092   alias sql='devour sqlitebrowser'
1093   alias cad='devour openscad'
1094   alias feh='devour feh'
1095 #+end_src
1096 **** Package management (Pacman)
1097 #+begin_src shell :tangle ~/.config/zsh/zshrc
1098   alias aps='yay -Ss'
1099   alias api='yay -Syu'
1100   alias apii='sudo pacman -S'
1101   alias app='yay -Rns'
1102   alias apc='yay -Sc'
1103   alias apo='yay -Qttd'
1104   alias azf='pacman -Q | fzf'
1105   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1106   alias ufetch='ufetch-arch'
1107   alias reflect='reflector --verbose --sort rate --save \
1108      ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1109 #+end_src
1110 **** Package management (KISS)
1111 #+begin_src shell :tangle ~/.config/zsh/zshrc
1112   alias kzf="kiss s \* | xargs -l basename | \
1113     fzf --preview 'kiss search {} | xargs -l dirname'"
1114 #+end_src
1115 *** Exports
1116 #+begin_src shell :tangle ~/.config/zsh/zshrc
1117   export EDITOR="emacsclient -c"
1118   export VISUAL="$EDITOR"
1119   export TERM=xterm-256color # for compatability
1120
1121   export GPG_TTY="$(tty)"
1122   export MANPAGER='nvim +Man!'
1123   export PAGER='less'
1124
1125   export GTK_USE_PORTAL=1
1126
1127   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1128   export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
1129   export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
1130   export PATH="$PATH:/home/armaa/.cargo/bin"
1131   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1132   export PATH="$PATH:/usr/sbin"
1133   export PATH="$PATH:/opt/FreeTube/freetube"
1134
1135   export LC_ALL="en_US.UTF-8"
1136   export LC_CTYPE="en_US.UTF-8"
1137   export LANGUAGE="en_US.UTF-8"
1138
1139   export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
1140   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1141   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1142   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1143   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1144   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1145 #+end_src
1146 ** Alacritty
1147 *** Appearance
1148 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1149 font:
1150   normal:
1151     family: JetBrains Mono Nerd Font
1152     style: Medium
1153   italic:
1154     style: Italic
1155   Bold:
1156     style: Bold
1157   size: 7
1158   ligatures: true # Requires ligature patch
1159
1160 window:
1161   padding:
1162     x: 5
1163     y: 5
1164
1165 background_opacity: 1
1166 #+end_src
1167 *** Color scheme
1168 Modus vivendi. Source: https://github.com/ishan9299/Nixos/blob/d4bbb7536be95b59466bb9cca4d671be46e04e81/user/alacritty/alacritty.yml#L30-L118
1169 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1170 colors:
1171   # Default colors
1172   primary:
1173     background: '#000000'
1174     foreground: '#ffffff'
1175
1176   cursor:
1177     text: '#000000'
1178     background: '#ffffff'
1179
1180   # Normal colors (except green it is from intense colors)
1181   normal:
1182     black:   '#000000'
1183     red:     '#ff8059'
1184     green:   '#00fc50'
1185     yellow:  '#eecc00'
1186     blue:    '#29aeff'
1187     magenta: '#feacd0'
1188     cyan:    '#00d3d0'
1189     white:   '#eeeeee'
1190
1191   # Bright colors [all the faint colors in the modus theme]
1192   bright:
1193     black:   '#555555'
1194     red:     '#ffa0a0'
1195     green:   '#88cf88'
1196     yellow:  '#d2b580'
1197     blue:    '#92baff'
1198     magenta: '#e0b2d6'
1199     cyan:    '#a0bfdf'
1200     white:   '#ffffff'
1201
1202   # dim [all the intense colors in modus theme]
1203   dim:
1204     black:   '#222222'
1205     red:     '#fb6859'
1206     green:   '#00fc50'
1207     yellow:  '#ffdd00'
1208     blue:    '#00a2ff'
1209     magenta: '#ff8bd4'
1210     cyan:    '#30ffc0'
1211     white:   '#dddddd'
1212 #+end_src
1213 ** IPython
1214 *** General
1215 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1216 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1217   c.TerminalInteractiveShell.editing_mode = 'vi'
1218   c.InteractiveShell.colors = 'linux'
1219   c.TerminalInteractiveShell.confirm_exit = False
1220 #+end_src
1221 *** Math
1222 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1223   from math import *
1224
1225   def deg(x):
1226       return x * (180 /  pi)
1227
1228   def rad(x):
1229       return x * (pi / 180)
1230
1231   def rad(x, unit):
1232       return (x * (pi / 180)) / unit
1233
1234   def csc(x):
1235       return 1 / sin(x)
1236
1237   def sec(x):
1238       return 1 / cos(x)
1239
1240   def cot(x):
1241       return 1 / tan(x)
1242 #+end_src
1243 ** MPV
1244 Make MPV play a little bit smoother.
1245 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1246   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1247   hwdec=auto-copy
1248 #+end_src
1249 ** Inputrc
1250 For any GNU Readline programs
1251 #+begin_src conf :tangle ~/.inputrc
1252   set editing-mode vi
1253 #+end_src
1254 ** Git
1255 *** User
1256 #+begin_src conf :tangle ~/.gitconfig
1257 [user]
1258   name = Armaan Bhojwani
1259   email = me@armaanb.net
1260   signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1261 #+end_src
1262 *** Init
1263 #+begin_src conf :tangle ~/.gitconfig
1264 [init]
1265   defaultBranch = main
1266 #+end_src
1267 *** GPG
1268 #+begin_src conf :tangle ~/.gitconfig
1269 [gpg]
1270   program = gpg
1271 #+end_src
1272 *** Sendemail
1273 #+begin_src conf :tangle ~/.gitconfig
1274 [sendemail]
1275   smtpserver = smtp.mailbox.org
1276   smtpuser = me@armaanb.net
1277   smtpencryption = ssl
1278   smtpserverport = 465
1279   confirm = auto
1280 #+end_src
1281 *** Submodules
1282 #+begin_src conf :tangle ~/.gitconfig
1283 [submodule]
1284   recurse = true
1285 #+end_src
1286 *** Aliases
1287 #+begin_src conf :tangle ~/.gitconfig
1288 [alias]
1289   stat = diff --stat
1290   sclone = clone --depth 1
1291   sclean = clean -dfX
1292   a = add
1293   aa = add .
1294   c = commit
1295   p = push
1296   subup = submodule update --remote
1297   loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1298   mirror = git config --global alias.mirrormirror
1299 #+end_src
1300 *** Commits
1301 #+begin_src conf :tangle ~/.gitconfig
1302 [commit]
1303   gpgsign = true
1304   verbose = true
1305 #+end_src
1306 ** Dunst
1307 Lightweight notification daemon.
1308 *** General
1309 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1310   [global]
1311   font = "JetBrains Mono Medium Nerd Font 11"
1312   allow_markup = yes
1313   format = "<b>%s</b>\n%b"
1314   sort = no
1315   indicate_hidden = yes
1316   alignment = center
1317   bounce_freq = 0
1318   show_age_threshold = 60
1319   word_wrap = yes
1320   ignore_newline = no
1321   geometry = "400x5-10+10"
1322   transparency = 0
1323   idle_threshold = 120
1324   monitor = 0
1325   sticky_history = yes
1326   line_height = 0
1327   separator_height = 1
1328   padding = 8
1329   horizontal_padding = 8
1330   max_icon_size = 32
1331   separator_color = "#ffffff"
1332   startup_notification = false
1333 #+end_src
1334 *** Modes
1335 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1336   [frame]
1337   width = 1
1338   color = "#ffffff"
1339
1340   [shortcuts]
1341   close = mod4+c
1342   close_all = mod4+shift+c
1343   history = mod4+ctrl+c
1344
1345   [urgency_low]
1346   background = "#222222"
1347   foreground = "#ffffff"
1348   highlight = "#ffffff"
1349   timeout = 5
1350
1351   [urgency_normal]
1352   background = "#222222"
1353   foreground = "#ffffff"
1354   highlight = "#ffffff"
1355   timeout = 15
1356
1357   [urgency_critical]
1358   background = "#222222"
1359   foreground = "#a60000"
1360   highlight = "#ffffff"
1361   timeout = 0
1362 #+end_src
1363 ** Zathura
1364 *** Options
1365 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1366   map <C-i> recolor
1367   map <A-b> toggle_statusbar
1368   set selection-clipboard clipboard
1369   set scroll-step 200
1370
1371   set window-title-basename "true"
1372   set selection-clipboard "clipboard"
1373 #+end_src
1374 *** Colors
1375 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1376   set default-bg         "#000000"
1377   set default-fg         "#ffffff"
1378   set render-loading     true
1379   set render-loading-bg  "#000000"
1380   set render-loading-fg  "#ffffff"
1381
1382   set recolor-lightcolor "#000000" # bg
1383   set recolor-darkcolor  "#ffffff" # fg
1384   set recolor            "true"
1385 #+end_src
1386 ** Firefox
1387 *** Swap tab and URL bars
1388 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1389   #nav-bar {
1390       -moz-box-ordinal-group: 1 !important;
1391   }
1392
1393   #PersonalToolbar {
1394       -moz-box-ordinal-group: 2 !important;
1395   }
1396
1397   #titlebar {
1398       -moz-box-ordinal-group: 3 !important;
1399   }
1400 #+end_src
1401 *** Hide URL bar when not focused.
1402 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1403   #navigator-toolbox:not(:focus-within):not(:hover) {
1404       margin-top: -30px;
1405   }
1406
1407   #navigator-toolbox {
1408       transition: 0.1s margin-top ease-out;
1409   }
1410 #+end_src
1411 ** Black screen by default
1412 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1413   #main-window,
1414   #browser,
1415   #browser vbox#appcontent tabbrowser,
1416   #content,
1417   #tabbrowser-tabpanels,
1418   #tabbrowser-tabbox,
1419   browser[type="content-primary"],
1420   browser[type="content"] > html,
1421   .browserContainer {
1422       background: black !important;
1423       color: #fff !important;
1424   }
1425 #+end_src
1426 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1427   @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1428       body {
1429           background: black !important;
1430       }
1431   }
1432 #+end_src
1433 ** Xresources
1434 *** Font
1435 #+begin_src conf :tangle ~/.Xresources
1436   XTerm.vt100.translations: #override \n\
1437     Ctrl <Key> minus: smaller-vt-font() \n\
1438     Ctrl <Key> plus: larger-vt-font()
1439 #+end_src
1440 *** Color scheme
1441 Modus operandi.
1442 #+begin_src conf :tangle ~/.Xresources
1443   ! special
1444   ,*.foreground:   #ffffff
1445   ,*.background:   #000000
1446   ,*.cursorColor:  #ffffff
1447
1448   ! black
1449   ,*.color0:       #000000
1450   ,*.color8:       #555555
1451
1452   ! red
1453   ,*.color1:       #ff8059
1454   ,*.color9:       #ffa0a0
1455
1456   ! green
1457   ,*.color2:       #00fc50
1458   ,*.color10:      #88cf88
1459
1460   ! yellow
1461   ,*.color3:       #eecc00
1462   ,*.color11:      #d2b580
1463
1464   ! blue
1465   ,*.color4:       #29aeff
1466   ,*.color12:      #92baff
1467
1468   ! magenta
1469   ,*.color5:       #feacd0
1470   ,*.color13:      #e0b2d6
1471
1472   ! cyan
1473   ,*.color6:       #00d3d0
1474   ,*.color14:      #a0bfdf
1475
1476   ! white
1477   ,*.color7:       #eeeeee
1478   ,*.color15:      #dddddd
1479 #+end_src
1480 *** Copy paste
1481 #+begin_src conf :tangle ~/.Xresources
1482   xterm*VT100.Translations: #override \
1483     Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
1484     Ctrl Shift <Key>V:    insert-selection(CLIPBOARD) \n\
1485     Ctrl Shift <Key>C:    copy-selection(CLIPBOARD) \n\
1486     Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
1487 #+end_src
1488 *** Blink cursor
1489 #+begin_src conf :tangle ~/.Xresources
1490   xterm*cursorBlink: true
1491 #+end_src
1492 *** Alt keys
1493 #+begin_src conf :tangle ~/.Xresources
1494   XTerm*eightBitInput:   false
1495   XTerm*eightBitOutput:  true
1496 #+end_src