]> git.armaanb.net Git - config.org.git/blob - config.org
Don't build mu4e
[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 ** Tree-sitter
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))
66 #+end_src
67 ** Typography
68 *** Font
69 Great programming font with ligatures.
70 #+begin_src emacs-lisp
71   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
72 #+end_src
73 *** Ligatures
74 #+begin_src emacs-lisp
75   (use-package ligature
76     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
77     :config
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))
93 #+end_src
94 *** Emoji
95 #+begin_src emacs-lisp
96   (use-package emojify
97     :config (global-emojify-mode))
98
99   ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
100   (set-fontset-font
101    t
102    '(#x1f300 . #x1fad0)
103    (cond
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")))
107 #+end_src
108 ** Line numbers
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
114                          pdf-view-mode-hook
115                          shell-mode-hook
116                          org-mode-hook
117                          eshell-mode-hook))
118     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
119 #+end_src
120 ** Highlight matching parenthesis
121 #+begin_src emacs-lisp
122   (use-package paren
123     :config (show-paren-mode)
124     :custom (show-paren-style 'parenthesis))
125 #+end_src
126 ** Modeline
127 *** Show current function
128 #+begin_src emacs-lisp
129   (which-function-mode)
130 #+end_src
131 *** Make position in file more descriptive
132 Show current column and file size.
133 #+begin_src emacs-lisp
134   (column-number-mode)
135   (size-indication-mode)
136 #+end_src
137 *** Hide minor modes
138 #+begin_src emacs-lisp
139   (use-package minions
140     :config (minions-mode))
141 #+end_src
142 ** Word count
143 #+begin_src emacs-lisp
144  (use-package wc-mode
145    :straight (wc-mode :type git :host github :repo "bnbeckwith/wc-mode")
146    :hook (text-mode-hook . wc-mode))
147 #+end_src
148 ** Ruler
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)
152 #+end_src
153 ** Keybinding hints
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))
159 #+end_src
160 ** Highlight TODOs in comments
161 #+begin_src emacs-lisp
162   (use-package hl-todo
163     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
164     :config (global-hl-todo-mode 1))
165 #+end_src
166 ** Don't lose cursor
167 #+begin_src emacs-lisp
168   (blink-cursor-mode)
169 #+end_src
170 ** Visual line mode
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)
174 #+end_src
175 ** Display number of matches in search
176 #+begin_src emacs-lisp
177   (use-package anzu
178     :config (global-anzu-mode))
179 #+end_src
180 ** Visual bell
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))
188 #+end_src
189 * Evil mode
190 ** General
191 #+begin_src emacs-lisp
192   (use-package evil
193     :custom (select-enable-clipboard nil)
194     :config
195     (evil-mode)
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))
201 #+end_src
202 ** Evil collection
203 #+begin_src emacs-lisp
204   (use-package evil-collection
205     :after evil
206     :init (evil-collection-init)
207     :custom (evil-collection-setup-minibuffer t))
208 #+end_src
209 ** Surround
210 tpope prevails!
211 #+begin_src emacs-lisp
212   (use-package evil-surround
213     :config (global-evil-surround-mode))
214 #+end_src
215 ** Leader key
216 #+begin_src emacs-lisp
217   (use-package evil-leader
218     :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
219     :config
220     (evil-leader/set-leader "<SPC>")
221     (global-evil-leader-mode))
222 #+end_src
223 ** Nerd commenter
224 #+begin_src emacs-lisp
225   ;; Nerd commenter
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))
230 #+end_src
231 ** Undo redo
232 Fix the oopsies!
233 #+begin_src emacs-lisp
234   (evil-set-undo-system 'undo-redo)
235 #+end_src
236 ** Number incrementing
237 Add back C-a/C-x
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)))
244 #+end_src
245 ** Evil org
246 *** Init
247 #+begin_src emacs-lisp
248   (use-package evil-org
249     :after org
250     :hook (org-mode . evil-org-mode)
251     :config
252     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
253   (use-package evil-org-agenda
254     :straight (:type built-in)
255     :after evil-org
256     :config
257     (evil-org-agenda-set-keys))
258 #+end_src
259 *** Leader maps
260 #+begin_src emacs-lisp
261   (evil-leader/set-key-for-mode 'org-mode
262     "T" 'org-show-todo-tree
263     "a" 'org-agenda
264     "c" 'org-archive-subtree)
265 #+end_src
266 * Org mode
267 ** General
268 #+begin_src emacs-lisp
269   (use-package org
270     :straight (:type built-in)
271     :commands (org-capture org-agenda)
272     :custom
273     (org-ellipsis " ▾")
274     (org-agenda-start-with-log-mode t)
275     (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
276     (org-log-done 'time)
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))
284 #+end_src
285 ** Tempo
286 #+begin_src emacs-lisp
287   (use-package org-tempo
288     :after org
289     :straight (:type built-in)
290     :config
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 #+end_src
305 ** Presentations
306 #+begin_src emacs-lisp
307   (use-package org-present
308     :straight (org-present :type git :host github :repo "rlister/org-present"))
309 #+end_src
310 * Autocompletion
311 ** Ivy
312 Simple, but not too simple autocompletion.
313 #+begin_src emacs-lisp
314   (use-package ivy
315     :bind (("C-s" . swiper)
316            :map ivy-minibuffer-map
317            ("TAB" . ivy-alt-done)
318            :map ivy-switch-buffer-map
319            ("M-d" . ivy-switch-buffer-kill))
320     :config (ivy-mode))
321 #+end_src
322 ** Ivy-rich
323 #+begin_src emacs-lisp
324   (use-package ivy-rich
325     :after (ivy counsel)
326     :config (ivy-rich-mode))
327 #+end_src
328 ** Counsel
329 Ivy everywhere.
330 #+begin_src emacs-lisp
331   (use-package counsel
332     :bind (("C-M-j" . 'counsel-switch-buffer)
333            :map minibuffer-local-map
334            ("C-r" . 'counsel-minibuffer-history))
335     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
336     :config (counsel-mode))
337 #+end_src
338 ** Remember frequent commands
339 #+begin_src emacs-lisp
340   (use-package ivy-prescient
341     :after counsel
342     :custom
343     (ivy-prescient-enable-filtering nil)
344     :config
345     (prescient-persist-mode)
346     (ivy-prescient-mode))
347 #+end_src
348 ** Swiper
349 Better search utility.
350 #+begin_src emacs-lisp
351   (use-package swiper)
352 #+end_src
353 * EmacsOS
354 ** RSS
355 Use elfeed for RSS. I have another file with all the feeds in it.
356 #+begin_src emacs-lisp
357   (use-package elfeed
358     :bind (("C-c e" . elfeed))
359     :config
360     (load "~/.emacs.d/feeds.el")
361     (add-hook 'elfeed-new-entry-hook
362               (elfeed-make-tagger :feed-url "youtube\\.com"
363                                   :add '(youtube)))
364     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
365
366   (use-package elfeed-goodies
367     :after elfeed
368     :config (elfeed-goodies/setup))
369 #+end_src
370 ** Email
371 Use mu4e for reading emails.
372
373 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.
374
375 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.
376 #+begin_src emacs-lisp
377   (use-package smtpmail
378     :straight (:type built-in))
379   (use-package mu4e
380     :load-path "/usr/share/emacs/site-lisp/mu4e"
381     :straight (:build nil)
382     :bind (("C-c m" . mu4e))
383     :config
384     (setq user-full-name "Armaan Bhojwani"
385           smtpmail-local-domain "armaanb.net"
386           smtpmail-stream-type 'ssl
387           smtpmail-smtp-service '465
388           mu4e-change-filenames-when-moving t
389           mu4e-get-mail-command "offlineimap -q"
390           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
391           message-citation-line-function 'message-insert-formatted-citation-line
392           mu4e-completing-read-function 'ivy-completing-read
393           mu4e-confirm-quit nil
394           mail-user-agent 'mu4e-user-agent
395           mu4e-contexts
396           `( ,(make-mu4e-context
397                :name "school"
398                :enter-func (lambda () (mu4e-message "Entering school context"))
399                :leave-func (lambda () (mu4e-message "Leaving school context"))
400                :match-func (lambda (msg)
401                              (when msg
402                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
403                :vars '((user-mail-address . "abhojwani22@nobles.edu")
404                        (mu4e-sent-folder . "/school/Sent")
405                        (mu4e-drafts-folder . "/school/Drafts")
406                        (mu4e-trash-folder . "/school/Trash")
407                        (mu4e-refile-folder . "/school/Archive")
408                        (user-mail-address . "abhojwani22@nobles.edu")
409                        (smtpmail-smtp-user . "abhojwani22@nobles.edu")
410                        (smtpmail-smtp-server . "smtp.gmail.com")))
411              ,(make-mu4e-context
412                :name "personal"
413                :enter-func (lambda () (mu4e-message "Entering personal context"))
414                :leave-func (lambda () (mu4e-message "Leaving personal context"))
415                :match-func (lambda (msg)
416                              (when msg
417                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
418                :vars '((mu4e-sent-folder . "/personal/Sent")
419                        (mu4e-drafts-folder . "/personal/Drafts")
420                        (mu4e-trash-folder . "/personal/Trash")
421                        (mu4e-refile-folder . "/personal/Archive")
422                        (user-mail-address . "me@armaanb.net")
423                        (smtpmail-smtp-user . "me@armaanb.net")
424                        (smtpmail-smtp-server "smtp.mailbox.org")
425                        (mu4e-drafts-folder . "/school/Drafts")
426                        (mu4e-trash-folder . "/school/Trash")))))
427     (add-to-list 'mu4e-bookmarks
428                  '(:name "Unified inbox"
429                          :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
430                          :key ?b))
431     :hook ((mu4e-compose-mode . flyspell-mode)
432            (mu4e-view-mode-hook . turn-on-visual-line-mode)))
433 #+end_src
434 ** Default browser
435 Set EWW as default browser except for videos.
436 #+begin_src emacs-lisp
437   (defun browse-url-mpv (url &optional new-window)
438     "Open URL in MPV."
439     (start-process "mpv" "*mpv*" "mpv" url))
440
441   (setq browse-url-handlers
442         (quote
443          (("youtu\\.?be" . browse-url-mpv)
444           ("peertube.*" . browse-url-mpv)
445           ("vid.*" . browse-url-mpv)
446           ("vid.*" . browse-url-mpv)
447           ("." . eww-browse-url)
448           )))
449 #+end_src
450 ** EWW
451 Some EWW enhancements.
452 *** Give buffer a useful name
453 #+begin_src emacs-lisp
454   ;; From https://protesilaos.com/dotemacs/
455   (defun prot-eww--rename-buffer ()
456     "Rename EWW buffer using page title or URL.
457   To be used by `eww-after-render-hook'."
458     (let ((name (if (eq "" (plist-get eww-data :title))
459                     (plist-get eww-data :url)
460                   (plist-get eww-data :title))))
461       (rename-buffer (format "*%s # eww*" name) t)))
462
463   (add-hook 'eww-after-render-hook #'prot-eww--rename-buffer)
464 #+end_src
465 *** Better entrypoint
466 #+begin_src emacs-lisp
467   ;; From https://protesilaos.com/dotemacs/
468   (defun prot-eww-browse-dwim (url &optional arg)
469     "Visit a URL, maybe from `eww-prompt-history', with completion.
470
471   With optional prefix ARG (\\[universal-argument]) open URL in a
472   new eww buffer.
473
474   If URL does not look like a valid link, run a web query using
475   `eww-search-prefix'.
476
477   When called from an eww buffer, provide the current link as
478   initial input."
479     (interactive
480      (list
481       (completing-read "Query:" eww-prompt-history
482                        nil nil (plist-get eww-data :url) 'eww-prompt-history)
483       current-prefix-arg))
484     (eww url (if arg 4 nil)))
485
486   (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
487 #+end_src
488 ** IRC
489 #+begin_src emacs-lisp
490   (use-package erc
491     :straight (:type built-in)
492     :config
493     (load "~/.emacs.d/irc.el")
494     (acheam-irc)
495     (erc-notifications-enable)
496     (erc-smiley-disable))
497
498   (use-package erc-hl-nicks
499     :config (erc-hl-nicks-mode 1))
500 #+end_src
501 ** Emacs Anywhere
502 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
503 =emacsclient --eval "(emacs-everywhere)"=.
504 #+begin_src emacs-lisp
505   (use-package emacs-everywhere)
506 #+end_src
507 * Emacs IDE
508 ** Code cleanup
509 #+begin_src emacs-lisp
510   (use-package blacken
511     :hook (python-mode . blacken-mode)
512     :config
513     (setq blacken-line-length 79))
514
515   ;; Purge whitespace
516   (use-package ws-butler
517     :config
518     (ws-butler-global-mode))
519 #+end_src
520 ** Flycheck
521 #+begin_src emacs-lisp
522   (use-package flycheck
523     :config
524     (global-flycheck-mode))
525 #+end_src
526 ** Project management
527 #+begin_src emacs-lisp
528   (use-package projectile
529     :config (projectile-mode)
530     :custom ((projectile-completion-system 'ivy))
531     :bind-keymap
532     ("C-c p" . projectile-command-map)
533     :init
534     (when (file-directory-p "~/Code")
535       (setq projectile-project-search-path '("~/Code")))
536     (setq projectile-switch-project-action #'projectile-dired))
537
538   (use-package counsel-projectile
539     :after projectile
540     :config (counsel-projectile-mode))
541 #+end_src
542 ** Dired
543 #+begin_src emacs-lisp
544   (use-package dired
545     :straight (:type built-in)
546     :commands (dired dired-jump)
547     :custom ((dired-listing-switches "-agho --group-directories-first"))
548     :config
549     (evil-collection-define-key 'normal 'dired-mode-map
550       "h" 'dired-single-up-directory
551       "l" 'dired-single-buffer))
552
553   (use-package dired-single
554     :commands (dired dired-jump))
555
556   (use-package dired-open
557     :commands (dired dired-jump)
558     :custom
559     (dired-open-extensions '(("png" . "feh")
560                              ("mkv" . "mpv"))))
561
562   (use-package dired-hide-dotfiles
563     :hook (dired-mode . dired-hide-dotfiles-mode)
564     :config
565     (evil-collection-define-key 'normal 'dired-mode-map
566       "H" 'dired-hide-dotfiles-mode))
567 #+end_src
568 ** Git
569 *** Magit
570 # TODO: Write a command that commits hunk, skipping staging step.
571 #+begin_src emacs-lisp
572   (use-package magit)
573 #+end_src
574 *** Colored diff in line number area
575 #+begin_src emacs-lisp
576   (use-package diff-hl
577     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
578     :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
579            (magit-post-refresh-hook . diff-hl-magit-post-refresh))
580     :config (global-diff-hl-mode))
581 #+end_src
582 * General text editing
583 ** Indentation
584 Indent after every change.
585 #+begin_src emacs-lisp
586   (use-package aggressive-indent
587     :config (global-aggressive-indent-mode))
588 #+end_src
589 ** Spell checking
590 Spell check in text mode, and in prog-mode comments.
591 #+begin_src emacs-lisp
592   (dolist (hook '(text-mode-hook))
593     (add-hook hook (lambda () (flyspell-mode))))
594   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
595     (add-hook hook (lambda () (flyspell-mode -1))))
596   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
597 #+end_src
598 ** Expand tabs to spaces
599 #+begin_src emacs-lisp
600   (setq-default tab-width 2)
601 #+end_src
602 ** Copy kill ring to clipboard
603 #+begin_src emacs-lisp
604   (setq x-select-enable-clipboard t)
605   (defun copy-kill-ring-to-xorg ()
606     "Copy the current kill ring to the xorg clipboard."
607     (interactive)
608     (x-select-text (current-kill 0)))
609 #+end_src
610 ** Browse kill ring
611 #+begin_src emacs-lisp
612   (use-package browse-kill-ring)
613 #+end_src
614 ** Save place
615 Opens file where you left it.
616 #+begin_src emacs-lisp
617   (save-place-mode)
618 #+end_src
619 ** Writing mode
620 Distraction free writing a la junegunn/goyo.
621 #+begin_src emacs-lisp
622   (use-package olivetti
623     :config
624     (evil-leader/set-key "o" 'olivetti-mode))
625 #+end_src
626 ** Abbreviations
627 Abbreviate things!
628 #+begin_src emacs-lisp
629   (setq abbrev-file-name "~/.emacs.d/abbrevs")
630   (setq save-abbrevs 'silent)
631   (setq-default abbrev-mode t)
632 #+end_src
633 ** TRAMP
634 #+begin_src emacs-lisp
635   (setq tramp-default-method "ssh")
636 #+end_src
637 ** Don't ask about following symlinks in vc
638 #+begin_src emacs-lisp
639   (setq vc-follow-symlinks t)
640 #+end_src
641 * Functions
642 ** Easily convert splits
643 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
644 #+begin_src emacs-lisp
645   (defun toggle-window-split ()
646     (interactive)
647     (if (= (count-windows) 2)
648         (let* ((this-win-buffer (window-buffer))
649                (next-win-buffer (window-buffer (next-window)))
650                (this-win-edges (window-edges (selected-window)))
651                (next-win-edges (window-edges (next-window)))
652                (this-win-2nd (not (and (<= (car this-win-edges)
653                                            (car next-win-edges))
654                                        (<= (cadr this-win-edges)
655                                            (cadr next-win-edges)))))
656                (splitter
657                 (if (= (car this-win-edges)
658                        (car (window-edges (next-window))))
659                     'split-window-horizontally
660                   'split-window-vertically)))
661           (delete-other-windows)
662           (let ((first-win (selected-window)))
663             (funcall splitter)
664             (if this-win-2nd (other-window 1))
665             (set-window-buffer (selected-window) this-win-buffer)
666             (set-window-buffer (next-window) next-win-buffer)
667             (select-window first-win)
668             (if this-win-2nd (other-window 1))))))
669
670   (define-key ctl-x-4-map "t" 'toggle-window-split)
671 #+end_src
672 ** Insert date
673 #+begin_src emacs-lisp
674   (defun insert-date ()
675     (interactive)
676     (insert (format-time-string "%Y-%m-%d")))
677 #+end_src
678 * Keybindings
679 ** Switch windows
680 #+begin_src emacs-lisp
681   (use-package ace-window
682     :bind ("M-o" . ace-window))
683 #+end_src
684 ** Kill current buffer
685 Makes "C-x k" binding faster.
686 #+begin_src emacs-lisp
687   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
688 #+end_src
689 * Other settings
690 ** OpenSCAD
691 Render OpenSCAD files, and add a preview window.
692
693 Personal fork just merges a PR.
694 #+begin_src emacs-lisp
695   (use-package scad-mode)
696   (use-package scad-preview
697     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
698 #+end_src
699 ** Control backup files
700 Stop backup files from spewing everywhere.
701 #+begin_src emacs-lisp
702   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
703 #+end_src
704 ** Make yes/no easier
705 #+begin_src emacs-lisp
706   (defalias 'yes-or-no-p 'y-or-n-p)
707 #+end_src
708 ** Move customize file
709 No more clogging up init.el.
710 #+begin_src emacs-lisp
711   (setq custom-file "~/.emacs.d/custom.el")
712   (load custom-file)
713 #+end_src
714 ** Better help
715 #+begin_src emacs-lisp
716   (use-package helpful
717     :commands (helpful-callable helpful-variable helpful-command helpful-key)
718     :custom
719     (counsel-describe-function-function #'helpful-callable)
720     (counsel-describe-variable-function #'helpful-variable)
721     :bind
722     ([remap describe-function] . counsel-describe-function)
723     ([remap describe-command] . helpful-command)
724     ([remap describe-variable] . counsel-describe-variable)
725     ([remap describe-key] . helpful-key))
726 #+end_src
727 ** GPG
728 #+begin_src emacs-lisp
729   (use-package epa-file
730     :straight (:type built-in)
731     :custom
732     (epa-file-select-keys nil)
733     (epa-file-encrypt-to '("me@armaanb.net"))
734     (password-cache-expiry (* 60 15)))
735
736   (use-package pinentry
737     :config (pinentry-start))
738 #+end_src
739 ** Pastebin
740 #+begin_src emacs-lisp
741   (use-package 0x0
742     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
743     :custom (0x0-default-service 'envs)
744     :config (evil-leader/set-key
745               "00" '0x0-upload
746               "0f" '0x0-upload-file
747               "0s" '0x0-upload-string
748               "0c" '0x0-upload-kill-ring
749               "0p" '0x0-upload-popup))
750 #+end_src
751 * Tangles
752 ** Spectrwm
753 *** General settings
754 #+begin_src conf :tangle ~/.spectrwm.conf
755   workspace_limit = 5
756   warp_pointer = 1
757   modkey = Mod4
758   autorun = ws[1]:/home/armaa/Code/scripts/autostart
759 #+end_src
760 *** Bar
761 #+begin_src conf :tangle ~/.spectrwm.conf
762   bar_enabled = 0
763   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
764 #+end_src
765 *** Keybindings
766 **** WM actions
767 #+begin_src conf :tangle ~/.spectrwm.conf
768   program[lock] = i3lock -c 000000 -ef
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
774
775   bind[notif] = MOD+n
776   bind[switcher] = MOD+Tab
777 #+end_src
778 **** Media keys
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
788
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
797 #+end_src
798 **** HJKL
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
804
805   bind[h] = MOD + Control + h
806   bind[j] = MOD + Control + j
807   bind[k] = MOD + Control + k
808   bind[l] = MOD + Control + l
809 #+end_src
810 **** Programs
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
819
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
827 #+end_src
828 ** Zsh
829 *** Settings
830 **** Completions
831 #+begin_src shell :tangle ~/.config/zsh/zshrc
832   autoload -Uz compinit
833   compinit
834
835   setopt no_case_glob
836   unsetopt glob_complete
837
838   # Fragment completions
839   zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
840
841   # Menu completions
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
846
847 #+end_src
848 **** Vim bindings
849 #+begin_src shell :tangle ~/.config/zsh/zshrc
850   bindkey -v
851   KEYTIMEOUT=1
852
853   bindkey -M vicmd "^[[3~" delete-char
854   bindkey "^[[3~" delete-char
855
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
860 #+end_src
861 **** History
862 #+begin_src shell :tangle ~/.config/zsh/zshrc
863   setopt extended_history
864   setopt share_history
865   setopt inc_append_history
866   setopt hist_ignore_dups
867   setopt hist_reduce_blanks
868
869   HISTSIZE=100000
870   SAVEHIST=100000
871   HISTFILE=~/.local/share/zsh/history
872 #+end_src
873 *** Plugins
874 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
875
876 Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition.
877 **** ZPE
878 #+begin_src conf :tangle ~/.config/zpe/repositories
879   https://github.com/zdharma/fast-syntax-highlighting
880 #+end_src
881 **** Zshrc
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
886
887   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
888 #+end_src
889 *** Functions
890 **** Time Zsh startup
891 #+begin_src shell :tangle ~/.config/zsh/zshrc
892   timer() {
893       for i in $(seq 1 10); do time "$1" -i -c exit; done
894   }
895 #+end_src
896 **** Update all packages
897 #+begin_src shell :tangle ~/.config/zsh/zshrc
898   color=$(tput setaf 5)
899   reset=$(tput sgr0)
900
901   apu() {
902       sudo echo "${color}== upgrading with yay ==${reset}"
903       yay
904       echo ""
905       echo "${color}== checking for pacnew files ==${reset}"
906       sudo pacdiff
907       echo
908       echo "${color}== upgrading flatpaks ==${reset}"
909       flatpak update
910       echo ""
911       echo "${color}== upgrading zsh plugins ==${reset}"
912       zpe-pull
913       echo ""
914       echo "${color}== updating nvim plugins ==${reset}"
915       nvim +PlugUpdate +PlugUpgrade +qall
916       echo "Updated nvim plugins"
917       echo ""
918       echo "${color}You are entirely up to date!${reset}"
919   }
920 #+end_src
921 **** Clean all packages
922 #+begin_src shell :tangle ~/.config/zsh/zshrc
923   apap() {
924       sudo echo "${color}== cleaning pacman orphans ==${reset}"
925       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
926       echo ""
927       echo "${color}== cleaning flatpaks ==${reset}"
928       flatpak remove --unused
929       echo ""
930       echo "${color}== cleaning zsh plugins ==${reset}"
931       zpe-clean
932       echo ""
933       echo "${color}== cleaning nvim plugins ==${reset}"
934       nvim +PlugClean +qall
935       echo "Cleaned nvim plugins"
936       echo ""
937       echo "${color}All orphans cleaned!${reset}"
938   }
939 #+end_src
940 **** Setup anaconda
941 #+begin_src shell :tangle ~/.config/zsh/zshrc
942   zconda() {
943       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
944       if [ $? -eq 0 ]; then
945           eval "$__conda_setup"
946       else
947           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
948               . "/opt/anaconda/etc/profile.d/conda.sh"
949           else
950               export PATH="/opt/anaconda/bin:$PATH"
951           fi
952       fi
953       unset __conda_setup
954   }
955 #+end_src
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" ; }
964 #+end_src
965 **** Finger
966 #+begin_src shell :tangle ~/.config/zsh/zshrc
967   finger() {
968       user=$(echo "$1" | cut -f 1 -d '@')
969       host=$(echo "$1" | cut -f 2 -d '@')
970       echo $user | nc "$host" 79 -N
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 ** Rofi
1364 Modus vivendi theme that extends DarkBlue.
1365 #+begin_src javascript :tangle ~/.config/rofi/config.rasi
1366   @import "/usr/share/rofi/themes/DarkBlue.rasi"
1367       ,* {
1368           white:                        rgba ( 255, 255, 255, 100 % );
1369           foreground:                   @white;
1370           selected-normal-background:   @white;
1371           separatorcolor:               @white;
1372           background:                   rgba ( 34, 34, 34, 100 % );
1373       }
1374 #+end_src
1375 ** Zathura
1376 *** Options
1377 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1378   map <C-i> recolor
1379   map <A-b> toggle_statusbar
1380   set selection-clipboard clipboard
1381   set scroll-step 200
1382
1383   set window-title-basename "true"
1384   set selection-clipboard "clipboard"
1385 #+end_src
1386 *** Colors
1387 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1388   set default-bg         "#000000"
1389   set default-fg         "#ffffff"
1390   set render-loading     true
1391   set render-loading-bg  "#000000"
1392   set render-loading-fg  "#ffffff"
1393
1394   set recolor-lightcolor "#000000" # bg
1395   set recolor-darkcolor  "#ffffff" # fg
1396   set recolor            "true"
1397 #+end_src
1398 ** Firefox
1399 *** Swap tab and URL bars
1400 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1401   #nav-bar {
1402       -moz-box-ordinal-group: 1 !important;
1403   }
1404
1405   #PersonalToolbar {
1406       -moz-box-ordinal-group: 2 !important;
1407   }
1408
1409   #titlebar {
1410       -moz-box-ordinal-group: 3 !important;
1411   }
1412 #+end_src
1413 *** Hide URL bar when not focused.
1414 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1415   #navigator-toolbox:not(:focus-within):not(:hover) {
1416       margin-top: -30px;
1417   }
1418
1419   #navigator-toolbox {
1420       transition: 0.1s margin-top ease-out;
1421   }
1422 #+end_src
1423 ** Black screen by default
1424 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1425   #main-window,
1426   #browser,
1427   #browser vbox#appcontent tabbrowser,
1428   #content,
1429   #tabbrowser-tabpanels,
1430   #tabbrowser-tabbox,
1431   browser[type="content-primary"],
1432   browser[type="content"] > html,
1433   .browserContainer {
1434       background: black !important;
1435       color: #fff !important;
1436   }
1437 #+end_src
1438 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1439   @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1440       body {
1441           background: black !important;
1442       }
1443   }
1444 #+end_src