]> git.armaanb.net Git - config.org.git/blob - config.org
Tangle dunst config
[config.org.git] / config.org
1 #+TITLE: System Configuration
2 #+DESCRIPTION: Armaan's system configuration.
3
4 * Welcome
5 Welcome to my system configuration! This file contains my Emacs configuration, but also my config files for many of the other programs on my system!
6 ** Compatability
7 I am currently using GCCEmacs 28 from the feature/native-comp branch, so some settings may not be available for older versions of Emacs. This is a purely personal configuration, so while I can garuntee that it works on my setup, I can't for anything else.
8 ** Choices
9 I chose to create a powerful, yet not overly heavy Emacs configuration. Things like LSP mode are important to my workflow and help me be productive, so despite its weight, it is kept. Things like a fancy modeline or icons on the other hand, do not increase my productivity, and create visual clutter, and thus have been excluded.
10
11 Another important choice has been to integrate Emacs into a large part of my computing environment (see [[*EmacsOS]]). I use Email, IRC, et cetera, all through Emacs which simplifies my workflow.
12
13 Lastly, I use Evil mode. I think modal keybindings are simple and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
14 ** TODOs
15 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
16 *** TODO Put configs with passwords in here with some kind of authentication
17 - Offlineimap
18 - irc.el
19 ** License
20 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work at the snippet.
21 * Package management
22 ** Bootstrap straight.el
23 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
24 #+begin_src emacs-lisp
25   (defvar bootstrap-version)
26   (let ((bootstrap-file
27          (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
28         (bootstrap-version 5))
29     (unless (file-exists-p bootstrap-file)
30       (with-current-buffer
31           (url-retrieve-synchronously
32            "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
33            'silent 'inhibit-cookies)
34         (goto-char (point-max))
35         (eval-print-last-sexp)))
36     (load bootstrap-file nil 'nomessage))
37 #+end_src
38 ** Replace use-package with straight
39 #+begin_src emacs-lisp
40   (straight-use-package 'use-package)
41   (setq straight-use-package-by-default t)
42 #+end_src
43 * Visual options
44 ** Theme
45 Very nice high contrast theme.
46
47 Its fine to set this here because I run Emacs in daemon mode, but if I were not, then putting it in early-init.el would be a better choice to eliminate the window being white before the theme is loaded.
48 #+begin_src emacs-lisp
49   (setq modus-themes-slanted-constructs t
50         modus-themes-bold-constructs t
51         modus-themes-org-blocks 'rainbow
52         modus-themes-mode-line '3d
53         modus-themes-scale-headings t
54         modus-themes-region 'no-extend
55         modus-themes-diffs 'desaturated)
56   (load-theme 'modus-vivendi t)
57 #+end_src
58 ** Typography
59 *** Font
60 Great programming font with ligatures.
61 #+begin_src emacs-lisp
62   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
63 #+end_src
64 *** Ligatures
65 #+begin_src emacs-lisp
66   (use-package ligature
67     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
68     :config
69     (ligature-set-ligatures
70      '(prog-mode text-mode)
71      '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" "/=="
72        "/>" "//" "/*" "*>" "***" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
73        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>" "<-|"
74        "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>" "</" "<*"
75        "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>" ":=" "::=" "=>>"
76        "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!==" "!!" "!=" ">]" ">:"
77        ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]"
78        "|}" "|=>" "|->" "|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<"
79        "..." "+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" "##"
80        "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_"
81        "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
82     (global-ligature-mode t))
83 #+end_src
84 *** Emoji
85 #+begin_src emacs-lisp
86   (use-package emojify
87     :config (global-emojify-mode))
88
89   ;; http://ergoemacs.org/emacs/emacs_list_and_set_font.html
90   (set-fontset-font
91    t
92    '(#x1f300 . #x1fad0)
93    (cond
94     ((member "Twitter Color Emoji" (font-family-list)) "Twitter Color Emoji")
95     ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
96     ((member "Noto Emoji" (font-family-list)) "Noto Emoji")))
97 #+end_src
98 ** Line numbers
99 Display relative line numbers except in some modes
100 #+begin_src emacs-lisp
101   (global-display-line-numbers-mode)
102   (setq display-line-numbers-type 'relative)
103   (dolist (no-line-num '(term-mode-hook
104                          pdf-view-mode-hook
105                          shell-mode-hook
106                          org-mode-hook
107                          eshell-mode-hook))
108     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
109 #+end_src
110 ** Highlight matching parenthesis
111 #+begin_src emacs-lisp
112   (use-package paren
113     :config (show-paren-mode)
114     :custom (show-paren-style 'parenthesis))
115 #+end_src
116 ** Modeline
117 *** Show current function
118 #+begin_src emacs-lisp
119   (which-function-mode)
120 #+end_src
121 *** Make position in file more descriptive
122 Show current column and file size.
123 #+begin_src emacs-lisp
124   (column-number-mode)
125   (size-indication-mode)
126 #+end_src
127 *** Hide minor modes
128 #+begin_src emacs-lisp
129   (use-package minions
130     :config (minions-mode))
131 #+end_src
132 ** Ruler
133 Show a ruler at a certain number of chars depending on mode.
134 #+begin_src emacs-lisp
135   (global-display-fill-column-indicator-mode)
136 #+end_src
137 ** Keybinding hints
138 Whenever starting a key chord, show possible future steps.
139 #+begin_src emacs-lisp
140   (use-package which-key
141     :config (which-key-mode)
142     :custom (which-key-idle-delay 0.3))
143 #+end_src
144 ** Visual highlights of changes
145 Highlight when changes are made.
146 #+begin_src emacs-lisp
147   (use-package evil-goggles
148     :config (evil-goggles-mode)
149     (evil-goggles-use-diff-faces))
150 #+end_src
151 ** Highlight "TODO" comments
152 #+begin_src emacs-lisp
153   (use-package hl-todo
154     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
155     :config (global-hl-todo-mode))
156 #+end_src
157 ** Don't lose cursor
158 #+begin_src emacs-lisp
159   (blink-cursor-mode)
160 #+end_src
161 ** Visual line mode
162 Soft wrap words and do operations by visual lines.
163 #+begin_src emacs-lisp
164   (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
165 #+end_src
166 ** Display number of matches in search
167 #+begin_src emacs-lisp
168   (use-package anzu
169     :config (global-anzu-mode))
170 #+end_src
171 ** Visual bell
172 Inverts modeline instead of audible bell or the standard visual bell.
173 #+begin_src emacs-lisp
174   (setq visible-bell nil
175         ring-bell-function 'flash-mode-line)
176   (defun flash-mode-line ()
177     (invert-face 'mode-line)
178     (run-with-timer 0.1 nil #'invert-face 'mode-line))
179 #+end_src
180 * Evil mode
181 ** General
182 #+begin_src emacs-lisp
183   (use-package evil
184     :custom (select-enable-clipboard nil)
185     :config
186     (evil-mode)
187     (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
188     ;; Use visual line motions even outside of visual-line-mode buffers
189     (evil-global-set-key 'motion "j" 'evil-next-visual-line)
190     (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
191     (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
192 #+end_src
193 ** Evil collection
194 #+begin_src emacs-lisp
195   (use-package evil-collection
196     :after evil
197     :init (evil-collection-init)
198     :custom (evil-collection-setup-minibuffer t))
199 #+end_src
200 ** Surround
201 tpope prevails!
202 #+begin_src emacs-lisp
203   (use-package evil-surround
204     :config (global-evil-surround-mode))
205 #+end_src
206 ** Leader key
207 #+begin_src emacs-lisp
208   (use-package evil-leader
209     :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
210     :config
211     (evil-leader/set-leader "<SPC>")
212     (global-evil-leader-mode))
213 #+end_src
214 ** Nerd commenter
215 #+begin_src emacs-lisp
216   ;; Nerd commenter
217   (use-package evil-nerd-commenter
218     :bind (:map evil-normal-state-map
219                 ("gc" . evilnc-comment-or-uncomment-lines))
220     :custom (evilnc-invert-comment-line-by-line nil))
221 #+end_src
222 ** Undo tree
223 Fix the oopsies!
224 #+begin_src emacs-lisp
225   (use-package undo-tree
226     :custom
227     (undo-tree-auto-save-history t)
228     (undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree")))
229     :config
230     (global-undo-tree-mode)
231     (evil-set-undo-system 'undo-tree))
232 #+end_src
233 ** Number incrementing
234 Add back C-a/C-x
235 #+begin_src emacs-lisp
236   (use-package evil-numbers
237     :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
238     :bind (:map evil-normal-state-map
239                 ("C-M-a" . evil-numbers/inc-at-pt)
240                 ("C-M-x" . evil-numbers/dec-at-pt)))
241 #+end_src
242 ** Evil org
243 *** Init
244 #+begin_src emacs-lisp
245   (use-package evil-org
246     :after org
247     :hook (org-mode . evil-org-mode)
248     :config
249     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
250   (use-package evil-org-agenda
251     :straight (:type built-in)
252     :after evil-org
253     :config
254     (evil-org-agenda-set-keys))
255 #+end_src
256 *** Leader maps
257 #+begin_src emacs-lisp
258   (evil-leader/set-key-for-mode 'org-mode
259     "T" 'org-show-todo-tree
260     "a" 'org-agenda
261     "c" 'org-archive-subtree)
262 #+end_src
263 * Org mode
264 ** General
265 #+begin_src emacs-lisp
266   (use-package org
267     :straight (:type built-in)
268     :commands (org-capture org-agenda)
269     :custom
270     (org-ellipsis " â–¾")
271     (org-agenda-start-with-log-mode t)
272     (org-log-done 'time)
273     (org-log-into-drawer t)
274     (org-src-tab-acts-natively t)
275     (org-src-fontify-natively t)
276     (org-startup-indented t)
277     (org-hide-emphasis-markers t)
278     (org-fontify-whole-block-delimiter-line nil))
279 #+end_src
280 ** Automatically tangle
281 #+begin_src emacs-lisp
282   (add-hook 'org-mode-hook
283             (lambda () (add-hook 'after-save-hook #'org-babel-tangle
284                                  :append :local)))
285 #+end_src
286 ** Tempo
287 #+begin_src emacs-lisp
288   (use-package org-tempo
289     :after org
290     :straight (:type built-in)
291     :config
292     ;; TODO: There's gotta be a more efficient way to write this
293     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
294     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
295     (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc"))
296     (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
297     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
298     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
299     (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
300     (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc")))
301 #+end_src
302 * Autocompletion
303 ** Ivy
304 Simple, but not too simple autocompletion.
305 #+begin_src emacs-lisp
306   (use-package ivy
307     :bind (("C-s" . swiper)
308            :map ivy-minibuffer-map
309            ("TAB" . ivy-alt-done)
310            :map ivy-switch-buffer-map
311            ("C-d" . ivy-switch-buffer-kill))
312     :config (ivy-mode))
313 #+end_src
314 ** Ivy-rich
315 #+begin_src emacs-lisp
316   (use-package ivy-rich
317     :after ivy
318     :config (ivy-rich-mode))
319 #+end_src
320 ** Counsel
321 Ivy everywhere.
322 #+begin_src emacs-lisp
323   (use-package counsel
324     :bind (("C-M-j" . 'counsel-switch-buffer)
325            :map minibuffer-local-map
326            ("C-r" . 'counsel-minibuffer-history))
327     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
328     :config (counsel-mode))
329 #+end_src
330 ** Remember frequent commands
331 #+begin_src emacs-lisp
332   (use-package ivy-prescient
333     :after counsel
334     :custom
335     (ivy-prescient-enable-filtering nil)
336     :config
337     (prescient-persist-mode)
338     (ivy-prescient-mode))
339 #+end_src
340 ** Swiper
341 Better search utility.
342 #+begin_src emacs-lisp
343   (use-package swiper)
344 #+end_src
345 * EmacsOS
346 ** RSS
347 Use elfeed for RSS. I have another file with all the feeds in it.
348 #+begin_src emacs-lisp
349   (use-package elfeed
350     :bind (("C-c e" . elfeed))
351     :config
352     (load "~/.emacs.d/feeds.el")
353     (add-hook 'elfeed-new-entry-hook
354               (elfeed-make-tagger :feed-url "youtube\\.com"
355                                   :add '(youtube)))
356     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
357
358   (use-package elfeed-goodies
359     :after elfeed
360     :config (elfeed-goodies/setup))
361 #+end_src
362 ** Email
363 Use mu4e for reading emails.
364
365 I use `offlineimap` to sync my maildirs. It is slower than mbsync, but is fast enough for me, especially when ran with the =-q= option.
366
367 Contexts are a not very well known feature of mu4e that makes it super easy to manage multiple accounts. Much better than some of the hacky methods and external packages that I've seen.
368 #+begin_src emacs-lisp
369   (use-package smtpmail
370     :straight (:type built-in))
371   (use-package mu4e
372     :load-path "/usr/share/emacs/site-lisp/mu4e"
373     :bind (("C-c m" . mu4e))
374     :config
375
376     (setq user-full-name "Armaan Bhojwani"
377           smtpmail-local-domain "armaanb.net"
378           smtpmail-stream-type 'ssl
379           smtpmail-smtp-service '465
380           mu4e-change-filenames-when-moving t
381           message-kill-buffer-on-exit t
382           mu4e-get-mail-command "offlineimap -q"
383           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
384           message-citation-line-function 'message-insert-formatted-citation-line
385           mu4e-context-policy "pick-first"
386           mu4e-contexts
387           `( ,(make-mu4e-context
388                :name "school"
389                :enter-func (lambda () (mu4e-message "Entering school context"))
390                :leave-func (lambda () (mu4e-message "Leaving school context"))
391                :match-func (lambda (msg)
392                              (when msg
393                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
394                :vars '( (user-mail-address . "abhojwani22@nobles.edu")
395                         (mu4e-sent-folder . "/school/Sent")
396                         (mu4e-drafts-folder . "/school/Drafts")
397                         (mu4e-trash-folder . "/school/Trash")
398                         (mu4e-refile-folder . "/school/Archive")
399                         (user-mail-address . "abhojwani22@nobles.edu")
400                         (smtpmail-smtp-user . "abhojwani22@nobles.edu")
401                         (smtpmail-smtp-server . "smtp.gmail.com")))
402              ,(make-mu4e-context
403                :name "personal"
404                :enter-func (lambda () (mu4e-message "Entering personal context"))
405                :leave-func (lambda () (mu4e-message "Leaving personal context"))
406                :match-func (lambda (msg)
407                              (when msg
408                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
409                :vars '(
410                        (mu4e-sent-folder . "/personal/Sent")
411                        (mu4e-drafts-folder . "/personal/Drafts")
412                        (mu4e-trash-folder . "/personal/Trash")
413                        (mu4e-refile-folder . "/personal/Archive")
414                        (user-mail-address . "me@armaanb.net")
415                        (smtpmail-smtp-user . "me@armaanb.net")
416                        (smtpmail-smtp-server "smtp.mailbox.org")
417                        (mu4e-drafts-folder . "/school/Drafts")
418                        (mu4e-trash-folder . "/school/Trash")))))
419
420     (add-to-list 'mu4e-bookmarks
421                  '(
422                    :name  "Unified inbox"
423                    :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
424                    :key   ?b)))
425 #+end_src
426 ** Calendar
427 #+begin_src emacs-lisp
428   (use-package calfw)
429   (use-package calfw-org)
430   (use-package calfw-ical)
431
432   (defun acheam-calendar ()
433     "Open a calendar."
434     (interactive)
435     (shell-command "vdirsyncer sync")
436     (let ((default-directory "~/.local/share/vdirsyncer/"))
437       (cfw:open-calendar-buffer
438        :contents-sources
439        (list
440         (cfw:ical-create-source "School" (expand-file-name "school/abhojwani22@nobles.edu.ics") "Green")
441         (cfw:ical-create-source "Personal" (expand-file-name "mailbox/Y2FsOi8vMC8zMQ.ics") "Blue")
442         (cfw:ical-create-source "Birthdays" (expand-file-name "mailbox/Y2FsOi8vMS8w.ics") "Gray")
443         ))))
444 #+end_src
445 ** IRC
446 Another file has more specific network configuration.
447 #+begin_src emacs-lisp
448   (use-package circe
449     :config
450     (load "~/.emacs.d/irc.el"))
451   (use-package circe-color-nicks
452     :after circe
453     :straight (:type built-in))
454   (use-package circe-chanop
455     :after circe
456     :straight (:type built-in))
457 #+end_src
458 ** Default browser
459 Set EWW as default browser except for videos
460 #+begin_src emacs-lisp
461   (defun browse-url-mpv (url &optional new-window)
462     "Open URL in MPV."
463     (start-process "mpv" "*mpv*" "mpv" url))
464
465   (setq browse-url-browser-function
466         (quote
467          (("youtu\\.?be" . browse-url-mpv)
468           ("." . eww-browse-url))))
469 #+end_src
470 ** Emacs Anywhere
471 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to
472 "emacsclient --eval "(emacs-everywhere)".
473 #+begin_src emacs-lisp
474   (use-package emacs-everywhere)
475 #+end_src
476 * Emacs IDE
477 ** LSP
478 *** General
479 #+begin_src emacs-lisp
480   (use-package lsp-mode
481     :commands (lsp lsp-deferred)
482     :custom (lsp-keymap-prefix "C-c l")
483     :hook ((lsp-mode . lsp-enable-which-key-integration)))
484
485   (use-package lsp-ivy)
486
487   (use-package lsp-ui
488     :commands lsp-ui-mode
489     :custom (lsp-ui-doc-position 'bottom))
490   (use-package lsp-ui-flycheck
491     :after lsp-ui
492     :straight (:type built-in))
493 #+end_src
494 *** Company
495 Company-box adds icons.
496 #+begin_src emacs-lisp
497   (use-package company
498     :after lsp-mode
499     :hook (lsp-mode . company-mode)
500     :bind (:map company-active-map
501                 ("<tab>" . company-complete-selection))
502     (:map lsp-mode-map
503           ("<tab>" . company-indent-or-complete-common))
504     :custom
505     (company-minimum-prefix-length 1)
506     (setq company-dabbrev-downcase 0)
507     (company-idle-delay 0.0))
508
509   (use-package company-box
510     :hook (company-mode . company-box-mode))
511 #+end_src
512 *** Language servers
513 **** Python
514 #+begin_src emacs-lisp
515   (use-package lsp-pyright
516     :hook (python-mode . (lambda ()
517                            (use-package lsp-pyright
518                              :straight (:type built-in))
519                            (lsp-deferred))))
520 #+end_src
521 ** Code cleanup
522 #+begin_src emacs-lisp
523   (use-package blacken
524     :hook (python-mode . blacken-mode)
525     :config
526     (setq blacken-line-length 79))
527
528   ;; Purge whitespace
529   (use-package ws-butler
530     :config
531     (ws-butler-global-mode))
532 #+end_src
533 ** Flycheck
534 #+begin_src emacs-lisp
535   (use-package flycheck
536     :config
537     (global-flycheck-mode))
538 #+end_src
539 ** Project management
540 #+begin_src emacs-lisp
541   (use-package projectile
542     :config (projectile-mode)
543     :custom ((projectile-completion-system 'ivy))
544     :bind-keymap
545     ("C-c p" . projectile-command-map)
546     :init
547     (when (file-directory-p "~/Code")
548       (setq projectile-project-search-path '("~/Code")))
549     (setq projectile-switch-project-action #'projectile-dired))
550
551   (use-package counsel-projectile
552     :after projectile
553     :config (counsel-projectile-mode))
554 #+end_src
555 ** Dired
556 #+begin_src emacs-lisp
557   (use-package dired
558     :straight (:type built-in)
559     :commands (dired dired-jump)
560     :custom ((dired-listing-switches "-agho --group-directories-first"))
561     :config
562     (evil-collection-define-key 'normal 'dired-mode-map
563       "h" 'dired-single-up-directory
564       "l" 'dired-single-buffer))
565
566   (use-package dired-single
567     :commands (dired dired-jump))
568
569   (use-package dired-open
570     :commands (dired dired-jump)
571     :custom
572     (dired-open-extensions '(("png" . "feh")
573                              ("mkv" . "mpv"))))
574
575   (use-package dired-hide-dotfiles
576     :hook (dired-mode . dired-hide-dotfiles-mode)
577     :config
578     (evil-collection-define-key 'normal 'dired-mode-map
579       "H" 'dired-hide-dotfiles-mode))
580 #+end_src
581 ** Git
582 *** Magit
583 #+begin_src emacs-lisp
584   (use-package magit
585     :hook (git-commit-setup-hook . pinentry-start))
586 #+end_src
587 *** Colored diff in line number area
588 #+begin_src emacs-lisp
589   (use-package diff-hl
590     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
591     :config (global-diff-hl-mode))
592 #+end_src
593 ** Indentation
594 Indent after every change.
595 #+begin_src emacs-lisp
596   (use-package aggressive-indent
597     :config (global-aggressive-indent-mode))
598 #+end_src
599 * Functions
600 ** Easily convert splits
601 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
602 #+begin_src emacs-lisp
603   (defun toggle-window-split ()
604     (interactive)
605     (if (= (count-windows) 2)
606         (let* ((this-win-buffer (window-buffer))
607                (next-win-buffer (window-buffer (next-window)))
608                (this-win-edges (window-edges (selected-window)))
609                (next-win-edges (window-edges (next-window)))
610                (this-win-2nd (not (and (<= (car this-win-edges)
611                                            (car next-win-edges))
612                                        (<= (cadr this-win-edges)
613                                            (cadr next-win-edges)))))
614                (splitter
615                 (if (= (car this-win-edges)
616                        (car (window-edges (next-window))))
617                     'split-window-horizontally
618                   'split-window-vertically)))
619           (delete-other-windows)
620           (let ((first-win (selected-window)))
621             (funcall splitter)
622             (if this-win-2nd (other-window 1))
623             (set-window-buffer (selected-window) this-win-buffer)
624             (set-window-buffer (next-window) next-win-buffer)
625             (select-window first-win)
626             (if this-win-2nd (other-window 1))))))
627
628   (define-key ctl-x-4-map "t" 'toggle-window-split)
629 #+end_src
630 ** Insert date
631 #+begin_src emacs-lisp
632   (defun insert-date ()
633     (interactive)
634     (insert (format-time-string "%Y-%m-%d")))
635 #+end_src
636 * Keybindings
637 ** Switch windows
638 #+begin_src emacs-lisp
639   (use-package ace-window
640     :bind ("M-o" . ace-window))
641 #+end_src
642 ** Kill current buffer
643 Makes "C-x k" binding faster.
644 #+begin_src emacs-lisp
645   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
646 #+end_src
647 * Other settings
648 ** Save place
649 Opens file where you left it.
650 #+begin_src emacs-lisp
651   (save-place-mode)
652 #+end_src
653 ** OpenSCAD
654 Render OpenSCAD files, and add a preview window.
655
656 Personal fork just merges a PR.
657 #+begin_src emacs-lisp
658   (use-package scad-mode)
659   (use-package scad-preview
660     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
661 #+end_src
662 ** Writing mode
663 Distraction free writing a la junegunn/goyo.
664 #+begin_src emacs-lisp
665   (use-package olivetti
666     :config
667     (evil-leader/set-key "o" 'olivetti-mode))
668 #+end_src
669 ** Control backup files
670 Stop backup files from spewing everywhere.
671 #+begin_src emacs-lisp
672   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
673 #+end_src
674 ** Abbreviations
675 Abbreviate things!
676 #+begin_src emacs-lisp
677   (setq abbrev-file-name "~/.emacs.d/abbrevs")
678   (setq save-abbrevs 'silent)
679   (setq-default abbrev-mode t)
680 #+end_src
681 ** Expand tabs to spaces
682 #+begin_src emacs-lisp
683   (setq-default tab-width 2)
684 #+end_src
685 ** Make yes/no easier
686 #+begin_src emacs-lisp
687   (defalias 'yes-or-no-p 'y-or-n-p)
688 #+end_src
689 ** Move customize file
690 No more clogging up init.el.
691 #+begin_src emacs-lisp
692   (setq custom-file "~/.emacs.d/custom.el")
693   (load custom-file)
694 #+end_src
695 ** Better help
696 #+begin_src emacs-lisp
697   (use-package helpful
698     :commands (helpful-callable helpful-variable helpful-command helpful-key)
699     :custom
700     (counsel-describe-function-function #'helpful-callable)
701     (counsel-describe-variable-function #'helpful-variable)
702     :bind
703     ([remap describe-function] . counsel-describe-function)
704     ([remap describe-command] . helpful-command)
705     ([remap describe-variable] . counsel-describe-variable)
706     ([remap describe-key] . helpful-key))
707 #+end_src
708 ** GPG
709 #+begin_src emacs-lisp
710   (use-package epa-file
711     :straight (:type built-in))
712   (setq epa-file-select-keys nil
713         epa-file-encrypt-to '("me@armaanb.net")
714         password-cache-expiry (* 60 15))
715
716   (use-package pinentry)
717 #+end_src
718 ** Pastebin
719 #+begin_src emacs-lisp
720   (use-package 0x0
721     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
722     :custom (0x0-default-service 'envs)
723     :config (evil-leader/set-key
724               "00" '0x0-upload
725               "0f" '0x0-upload-file
726               "0s" '0x0-upload-string
727               "0c" '0x0-upload-kill-ring
728               "0p" '0x0-upload-popup))
729 #+end_src
730 ** Copy kill ring to clipboard
731 #+begin_src emacs-lisp
732   (setq x-select-enable-clipboard t)
733   (defun copy-kill-ring-to-xorg ()
734     "Copy the current kill ring to the xorg clipboard."
735     (interactive)
736     (x-select-text (current-kill 0)))
737 #+end_src
738 ** Browse kill ring
739 #+begin_src emacs-lisp
740   (use-package browse-kill-ring)
741 #+end_src
742 * Tangles
743 ** Spectrwm
744 *** General settings
745 #+begin_src conf :tangle ~/.spectrwm.conf
746   workspace_limit = 5
747   warp_pointer = 1
748   modkey = Mod4
749   border_width = 4
750   tile_gap = 10
751   autorun = ws[1]:/home/armaa/Code/scripts/autostart
752 #+end_src
753 *** Apprearance
754 Gruvbox colors
755 #+begin_src conf :tangle ~/.spectrwm.conf
756   color_focus = rgb:83/a5/98
757   color_focus_maximized = rgb:d6/5d/0e
758   color_unfocus = rgb:58/58/58
759
760   bar_enabled = 0
761   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
762 #+end_src
763 *** Keybindings
764 **** WM actions
765 #+begin_src conf :tangle ~/.spectrwm.conf
766   program[lock] = i3lock -c 000000 -ef
767   program[term] = alacritty
768   program[screenshot_all] = flameshot gui
769   program[menu] = rofi -show run # `rofi-dmenu` handles the rest
770   program[switcher] = rofi -show window
771   program[notif] = /home/armaa/Code/scripts/setter status
772
773   bind[notif] = MOD+n
774   bind[switcher] = MOD+Tab
775 #+end_src
776 **** Media keys
777 #+begin_src conf :tangle ~/.spectrwm.conf
778   program[paup] = /home/armaa/Code/scripts/setter audio +5
779   program[padown] = /home/armaa/Code/scripts/setter audio -5
780   program[pamute] = /home/armaa/Code/scripts/setter audio
781   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
782   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
783   program[next] = playerctl next
784   program[prev] = playerctl previous
785   program[pause] = playerctl play-pause
786
787   bind[padown] = XF86AudioLowerVolume
788   bind[paup] = XF86AudioRaiseVolume
789   bind[pamute] = XF86AudioMute
790   bind[brigdown] = XF86MonBrightnessDown
791   bind[brigup] = XF86MonBrightnessUp
792   bind[pause] = XF86AudioPlay
793   bind[next] = XF86AudioNext
794   bind[prev] = XF86AudioPrev
795 #+end_src
796 **** HJKL
797 #+begin_src conf :tangle ~/.spectrwm.conf
798   program[h] = xdotool keyup h key --clearmodifiers Left
799   program[j] = xdotool keyup j key --clearmodifiers Down
800   program[k] = xdotool keyup k key --clearmodifiers Up
801   program[l] = xdotool keyup l key --clearmodifiers Right
802
803   bind[h] = MOD + Control + h
804   bind[j] = MOD + Control + j
805   bind[k] = MOD + Control + k
806   bind[l] = MOD + Control + l
807 #+end_src
808 **** Programs
809 #+begin_src conf :tangle ~/.spectrwm.conf
810   program[aerc] = alacritty -e aerc
811   program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
812   program[emacs] = emacsclient -c
813   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
814   program[firefox] = firefox
815   program[thunderbird] = thunderbird
816   program[slack] = slack
817
818   bind[aerc] = MOD+Control+s
819   bind[weechat] = MOD+Control+d
820   bind[emacs] = MOD+Control+f
821   bind[emacs-anywhere] = MOD+f
822   bind[firefox] = MOD+Control+u
823   bind[thunderbird] = MOD+Control+i
824   bind[slack] = MOD+Control+o
825 #+end_src
826 ** Zsh
827 *** Settings
828 **** Completions
829 #+begin_src shell :tangle ~/.config/zsh/zshrc
830   autoload -Uz compinit
831   compinit
832
833   setopt no_case_glob
834   unsetopt glob_complete
835 #+end_src
836 **** Vim bindings
837 #+begin_src shell :tangle ~/.config/zsh/zshrc
838   bindkey -v
839   KEYTIMEOUT=1
840
841   bindkey -M vicmd "^[[3~" delete-char
842   bindkey "^[[3~" delete-char
843
844   autoload edit-command-line
845   zle -N edit-command-line
846   bindkey -M vicmd ^e edit-command-line
847   bindkey ^e edit-command-line
848 #+end_src
849 **** History
850 #+begin_src shell :tangle ~/.config/zsh/zshrc
851   setopt extended_history
852   setopt share_history
853   setopt inc_append_history
854   setopt hist_ignore_dups
855   setopt hist_reduce_blanks
856
857   HISTSIZE=10000
858   SAVEHIST=10000
859   HISTFILE=~/.local/share/zsh/history
860 #+end_src
861 *** Plugins
862 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
863 **** ZPE
864 #+begin_src plain :tangle ~/.config/zpe/repositories
865     https://github.com/Aloxaf/fzf-tab
866     https://github.com/zdharma/fast-syntax-highlighting
867     https://github.com/rupa/z
868 #+end_src
869 **** Zshrc
870 #+begin_src shell :tangle ~/.config/zsh/zshrc
871   source ~/Code/zpe/zpe.sh
872   source ~/Code/admone/admone.zsh
873   source ~/.config/zsh/fzf-bindings.zsh
874
875   zpe-source fzf-tab/fzf-tab.zsh
876   zstyle ':completion:*:descriptions' format '[%d]'
877   zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
878   zstyle ':completion:*' completer _complete
879   zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
880          'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
881   enable-fzf-tab
882   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
883   export _Z_DATA="/home/armaa/.local/share/z"
884   zpe-source z/z.sh
885 #+end_src
886 *** Functions
887 **** Alert after long command
888 #+begin_src shell :tangle ~/.config/zsh/zshrc
889   alert() {
890       notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
891                   ${history[$HISTCMD]%[;&|][[:space:]]##alert}
892   }
893 #+end_src
894 **** Time Zsh startup
895 #+begin_src shell :tangle ~/.config/zsh/zshrc
896   timezsh() {
897       for i in $(seq 1 10); do
898           time "zsh" -i -c exit;
899       done
900   }
901 #+end_src
902 **** Update all packages
903 #+begin_src shell :tangle ~/.config/zsh/zshrc
904   color=$(tput setaf 5)
905   reset=$(tput sgr0)
906
907   apu() {
908       sudo echo "${color}== upgrading with yay ==${reset}"
909       yay
910       echo ""
911       echo "${color}== checking for pacnew files ==${reset}"
912       sudo pacdiff
913       echo
914       echo "${color}== upgrading flatpaks ==${reset}"
915       flatpak update
916       echo ""
917       echo "${color}== upgrading zsh plugins ==${reset}"
918       zpe-pull
919       echo ""
920       echo "${color}== updating nvim plugins ==${reset}"
921       nvim +PlugUpdate +PlugUpgrade +qall
922       echo "Updated nvim plugins"
923       echo ""
924       echo "${color}You are entirely up to date!${reset}"
925   }
926 #+end_src
927 **** Clean all packages
928 #+begin_src shell :tangle ~/.config/zsh/zshrc
929   apap() {
930       sudo echo "${color}== cleaning pacman orphans ==${reset}"
931       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
932       echo ""
933       echo "${color}== cleaning flatpaks ==${reset}"
934       flatpak remove --unused
935       echo ""
936       echo "${color}== cleaning zsh plugins ==${reset}"
937       zpe-clean
938       echo ""
939       echo "${color}== cleaning nvim plugins ==${reset}"
940       nvim +PlugClean +qall
941       echo "Cleaned nvim plugins"
942       echo ""
943       echo "${color}All orphans cleaned!${reset}"
944   }
945 #+end_src
946 **** ls every cd
947 #+begin_src shell :tangle ~/.config/zsh/zshrc
948   chpwd() {
949       emulate -L zsh
950       exa -lh --icons --git --group-directories-first
951   }
952 #+end_src
953 **** Setup anaconda
954 #+begin_src shell :tangle ~/.config/zsh/zshrc
955   zconda() {
956       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
957       if [ $? -eq 0 ]; then
958           eval "$__conda_setup"
959       else
960           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
961               . "/opt/anaconda/etc/profile.d/conda.sh"
962           else
963               export PATH="/opt/anaconda/bin:$PATH"
964           fi
965       fi
966       unset __conda_setup
967   }
968 #+end_src
969 **** Interact with 0x0
970 #+begin_src shell :tangle ~/.config/zsh/zshrc
971   zxz="https://envs.sh"
972   0file() { curl -F"file=@$1" "$zxz" ; }
973   0pb() { curl -F"file=@-;" "$zxz" ; }
974   0url() { curl -F"url=$1" "$zxz" ; }
975   0short() { curl -F"shorten=$1" "$zxz" ; }
976   0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
977 #+end_src
978 **** Swap two files
979 #+begin_src shell :tangle ~/.config/zsh/zshrc
980   sw() {
981       mv $1 $1.tmp
982       mv $2 $1
983       mv $1.tmp $2
984   }
985 #+end_src
986 *** Aliases
987 **** SSH
988 #+begin_src shell :tangle ~/.config/zsh/zshrc
989   alias bhoji-drop='ssh -p 23 root@armaanb.net'
990   alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
991   alias tcf='ssh root@204.48.23.68'
992   alias ngmun='ssh root@157.245.89.25'
993   alias prox='ssh root@192.168.1.224'
994   alias dock='ssh root@192.168.1.225'
995   alias jenkins='ssh root@192.168.1.226'
996   alias envs='ssh acheam@envs.net'
997 #+end_src
998 **** File management
999 #+begin_src shell :tangle ~/.config/zsh/zshrc
1000   alias ls='exa -lh --icons --git --group-directories-first'
1001   alias la='exa -lha --icons --git --group-directories-first'
1002   alias df='df -h / /boot'
1003   alias du='du -h'
1004   alias free='free -h'
1005   alias cp='cp -riv'
1006   alias rm='rm -Iv'
1007   alias mv='mv -iv'
1008   alias ln='ln -iv'
1009   alias grep='grep -in --exclude-dir=.git --color=auto'
1010   alias mkdir='mkdir -pv'
1011   alias unar='atool -x'
1012   alias wget='wget -e robots=off'
1013   alias lanex='~/.local/share/lxc/lxc'
1014 #+end_src
1015 **** Dotfiles
1016 #+begin_src shell :tangle ~/.config/zsh/zshrc
1017   alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1018   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1019     yadm push'
1020   alias padu='padm add -u && padm commit && padm push && yadu'
1021 #+end_src
1022 **** Editing
1023 #+begin_src shell :tangle ~/.config/zsh/zshrc
1024   alias v='nvim'
1025   alias vim='nvim'
1026   alias vw="nvim ~/Documents/vimwiki/index.md"
1027 #+end_src
1028 **** System management
1029 #+begin_src shell :tangle ~/.config/zsh/zshrc
1030   alias jctl='journalctl -p 3 -xb'
1031   alias pkill='pkill -i'
1032   alias cx='chmod +x'
1033   alias please='sudo $(fc -ln -1)'
1034   alias sudo='sudo ' # allows aliases to be run with sudo
1035 #+end_src
1036 **** Networking
1037 #+begin_src shell :tangle ~/.config/zsh/zshrc
1038   alias ping='ping -c 10'
1039   alias speed='speedtest-cli'
1040   alias ip='ip --color=auto'
1041   alias cip='curl https://armaanb.net/ip'
1042   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1043   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1044 #+end_src
1045 **** Docker
1046 #+begin_src shell :tangle ~/.config/zsh/zshrc
1047   alias dc='docker-compose'
1048   alias dcdu='docker-compose down && docker-compose up -d'
1049 #+end_src
1050 **** Other
1051 #+begin_src shell :tangle ~/.config/zsh/zshrc
1052   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1053     iflag=fullblock status=progress'
1054   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1055     iflag=fullblock status=progress'
1056   alias ts='gen-shell -c task'
1057   alias ts='gen-shell -c task'
1058   alias tetris='autoload -Uz tetriscurses && tetriscurses'
1059   alias news='newsboat'
1060   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1061   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1062     --restrict-filenames -o '%(title)s.%(ext)s'"
1063   alias cal="cal -3 --color=auto"
1064 #+end_src
1065 **** Virtual machines, chroots
1066 #+begin_src shell :tangle ~/.config/zsh/zshrc
1067   alias ckiss="sudo chrooter ~/Virtual/kiss"
1068   alias cdebian="sudo chrooter ~/Virtual/debian bash"
1069   alias cwindows='devour qemu-system-x86_64 \
1070     -smp 3 \
1071     -cpu host \
1072     -enable-kvm \
1073     -m 3G \
1074     -device VGA,vgamem_mb=64 \
1075     -device intel-hda \
1076     -device hda-duplex \
1077     -net nic \
1078     -net user,smb=/home/armaa/Public \
1079     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1080 #+end_src
1081 **** Python
1082 #+begin_src shell :tangle ~/.config/zsh/zshrc
1083   alias ipy="ipython"
1084   alias zpy="zconda && ipython"
1085   alias math="ipython --profile=math"
1086   alias pypi="python setup.py sdist && twine upload dist/*"
1087   alias pip="python -m pip"
1088   alias black="black -l 79"
1089 #+end_src
1090 **** Latin
1091 #+begin_src shell :tangle ~/.config/zsh/zshrc
1092   alias words='gen-shell -c "words"'
1093   alias words-e='gen-shell -c "words ~E"'
1094 #+end_src
1095 **** Devour
1096 #+begin_src shell :tangle ~/.config/zsh/zshrc
1097   alias zathura='devour zathura'
1098   alias mpv='devour mpv'
1099   alias sql='devour sqlitebrowser'
1100   alias cad='devour openscad'
1101   alias feh='devour feh'
1102 #+end_src
1103 **** Package management (Pacman)
1104 #+begin_src shell :tangle ~/.config/zsh/zshrc
1105   alias aps='yay -Ss'
1106   alias api='yay -Syu'
1107   alias app='yay -Rns'
1108   alias apc='yay -Sc'
1109   alias apo='yay -Qttd'
1110   alias azf='pacman -Q | fzf'
1111   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1112   alias ufetch='ufetch-arch'
1113   alias reflect='reflector --verbose --sort rate --save \
1114     ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1115 #+end_src
1116 *** Exports
1117 #+begin_src shell :tangle ~/.config/zsh/zshrc
1118   export EDITOR="emacsclient -c"                  # $EDITOR opens in terminal
1119   export VISUAL="emacsclient -c -a emacs"         # $VISUAL opens in GUI mode
1120   export TERM=xterm-256color # for compatability
1121
1122   export GPG_TTY="$(tty)"
1123   export MANPAGER='nvim +Man!'
1124   export PAGER='less'
1125
1126   # generated with "vivid generate gruvbox"
1127   export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1128
1129   export GTK_USE_PORTAL=1
1130
1131   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1132   export PATH="$PATH:/home/armaa/Code/scripts"
1133   export PATH="$PATH:/home/armaa/.cargo/bin"
1134   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1135   export PATH="$PATH:/usr/sbin"
1136   export PATH="$PATH:/opt/FreeTube/freetube"
1137
1138   export LC_ALL="en_US.UTF-8"
1139   export LC_CTYPE="en_US.UTF-8"
1140   export LANGUAGE="en_US.UTF-8"
1141
1142   export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1143   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1144   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1145   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1146   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1147   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1148 #+end_src
1149 ** Alacritty
1150 *** Appearance
1151 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1152 font:
1153   normal:
1154     family: JetBrains Mono Nerd Font
1155     style: Medium
1156   italic:
1157     style: Italic
1158   Bold:
1159     style: Bold
1160   size: 7
1161   ligatures: true # Requires ligature patch
1162
1163 window:
1164   padding:
1165     x: 5
1166     y: 5
1167
1168 background_opacity: 0.6
1169 #+end_src
1170 *** Keybindings
1171 Send <RET> + modifier through
1172 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1173 key_bindings:
1174   - {
1175     key: Return,
1176     mods: Shift,
1177     chars: "\x1b[13;2u"
1178   }
1179   - {
1180     key: Return,
1181     mods: Control,
1182     chars: "\x1b[13;5u"
1183   }
1184 #+end_src
1185 *** Color scheme
1186 Gruvbox
1187 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1188 colors:
1189   # Default colors
1190   primary:
1191     background: '#000000'
1192     foreground: '#ebdbb2'
1193
1194   # Normal colors
1195   normal:
1196     black:   '#282828'
1197     red:     '#cc241d'
1198     green:   '#98971a'
1199     yellow:  '#d79921'
1200     blue:    '#458588'
1201     magenta: '#b16286'
1202     cyan:    '#689d6a'
1203     white:   '#a89984'
1204
1205   # Bright colors
1206   bright:
1207     black:   '#928374'
1208     red:     '#fb4934'
1209     green:   '#b8bb26'
1210     yellow:  '#fabd2f'
1211     blue:    '#83a598'
1212     magenta: '#d3869b'
1213     cyan:    '#8ec07c'
1214     white:   '#ebdbb2'
1215 #+end_src
1216 ** IPython
1217 *** General
1218 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1219 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1220   c.TerminalInteractiveShell.editing_mode = 'vi'
1221   c.InteractiveShell.colors = 'linux'
1222   c.TerminalInteractiveShell.confirm_exit = False
1223 #+end_src
1224 *** Math
1225 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1226   from math import *
1227
1228   def deg(x):
1229       return x * (180 /  pi)
1230
1231   def rad(x):
1232       return x * (pi / 180)
1233
1234   def rad(x, unit):
1235       return (x * (pi / 180)) / unit
1236
1237   def csc(x):
1238       return 1 / sin(x)
1239
1240   def sec(x):
1241       return 1 / cos(x)
1242
1243   def cot(x):
1244       return 1 / tan(x)
1245 #+end_src
1246 ** MPV
1247 Make MPV play a little bit smoother.
1248 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1249   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1250   hwdec=auto-copy
1251 #+end_src
1252 ** Picom
1253 *** Shadows
1254 #+begin_src conf :tangle ~/.config/picom/picom.conf
1255   shadow = true;
1256   shadow-radius = 10;
1257   shadow-offset-x = -5;
1258   shadow-offset-y = -5;
1259 #+end_src
1260 *** Fading
1261 #+begin_src conf :tangle ~/.config/picom/picom.conf
1262   fading = true
1263   fade-delta = 5
1264 #+end_src
1265 *** Blur
1266 #+begin_src conf :tangle ~/.config/picom/picom.conf
1267   blur:
1268   {
1269   method = "gaussian";
1270   size = 5;
1271   deviation = 5;
1272   };
1273 #+end_src
1274 *** Backend
1275 Needs picom to be run with "--experimental-backends"
1276 #+begin_src conf :tangle ~/.config/picom/picom.conf
1277   backend = "glx";
1278 #+end_src
1279 ** Inputrc
1280 For any GNU Readline programs
1281 #+begin_src plain :tangle ~/.inputrc
1282   set editing-mode vi
1283 #+end_src
1284 ** Vivid
1285 https://github.com/sharkdp/vivid
1286 *** Colors
1287 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1288   colors:
1289     background_color: '282A36'
1290     black: '21222C'
1291     orange: 'd65d0e'
1292     purple: 'b16286'
1293     red: 'cc241d'
1294     blue: '458588'
1295     pink: 'd3869b'
1296     lime: '689d6a'
1297
1298     gray: '928374'
1299 #+end_src
1300 *** Core
1301 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1302   core:
1303     regular_file: {}
1304
1305     directory:
1306       foreground: blue
1307
1308     executable_file:
1309       foreground: red
1310       font-style: bold
1311
1312     symlink:
1313       foreground: pink
1314
1315     broken_symlink:
1316       foreground: black
1317       background: red
1318     missing_symlink_target:
1319       foreground: black
1320       background: red
1321
1322     fifo:
1323       foreground: black
1324       background: blue
1325
1326     socket:
1327       foreground: black
1328       background: pink
1329
1330     character_device:
1331       foreground: black
1332       background: lime
1333
1334     block_device:
1335       foreground: black
1336       background: red
1337
1338     normal_text:
1339       {}
1340
1341     sticky:
1342       {}
1343
1344     sticky_other_writable:
1345       {}
1346
1347     other_writable:
1348       {}
1349
1350   text:
1351     special:
1352       foreground: black
1353       background: orange
1354
1355     todo:
1356       font-style: bold
1357
1358     licenses:
1359       foreground: gray
1360
1361     configuration:
1362       foreground: orange
1363
1364     other:
1365       foreground: orange
1366
1367   markup:
1368     foreground: orange
1369
1370   programming:
1371     source:
1372       foreground: purple
1373
1374     tooling:
1375       foreground: purple
1376
1377       continuous-integration:
1378         foreground: purple
1379
1380   media:
1381     foreground: pink
1382
1383   office:
1384     foreground: red
1385
1386   archives:
1387     foreground: lime
1388     font-style: underline
1389
1390   executable:
1391     foreground: red
1392     font-style: bold
1393
1394   unimportant:
1395     foreground: gray
1396 #+end_src
1397 ** Git
1398 *** User
1399 #+begin_src plain :tangle ~/.gitconfig
1400 [user]
1401         name = Armaan Bhojwani
1402         email = me@armaanb.net
1403         signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1404 #+end_src
1405 *** Init
1406 #+begin_src plain :tangle ~/.gitconfig
1407 [init]
1408         defaultBranch = main
1409 #+end_src
1410 *** GPG
1411 #+begin_src plain :tangle ~/.gitconfig
1412 [gpg]
1413         program = gpg
1414 #+end_src
1415 *** Sendemail
1416 #+begin_src plain :tangle ~/.gitconfig
1417 [sendemail]
1418         smtpserver = smtp.mailbox.org
1419         smtpuser = me@armaanb.net
1420         smtpencryption = ssl
1421         smtpserverport = 465
1422         confirm = auto
1423 #+end_src
1424 *** Submodules
1425 #+begin_src plain :tangle ~/.gitconfig
1426 [submodule]
1427         recurse = true
1428 #+end_src
1429 *** Aliases
1430 #+begin_src plain :tangle ~/.gitconfig
1431 [alias]
1432         stat = diff --stat
1433         sclone = clone --depth 1
1434         sclean = clean -dfX
1435         a = add
1436         aa = add .
1437         c = commit
1438         p = push
1439         subup = submodule update --remote
1440         loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1441         mirror = git config --global alias.mirrormirror
1442 #+end_src
1443 *** Commits
1444 #+begin_src plain :tangle ~/.gitconfig
1445 [commit]
1446         gpgsign = true
1447 #+end_src
1448 ** Dunst
1449 Lightweight notification daemon. Gruvbox colors, based on https://github.com/a-schaefers/i3-wm-gruvbox-theme/
1450 *** General
1451 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1452   [global]
1453   font = "JetBrains Mono Medium Nerd Font 11"
1454   allow_markup = yes
1455   format = "<b>%s</b>\n%b"
1456   sort = no
1457   indicate_hidden = yes
1458   alignment = center
1459   bounce_freq = 0
1460   show_age_threshold = 60
1461   word_wrap = yes
1462   ignore_newline = no
1463   geometry = "400x5-20+20"
1464   transparency = 0
1465   idle_threshold = 120
1466   monitor = 0
1467   sticky_history = yes
1468   line_height = 0
1469   separator_height = 4
1470   padding = 8
1471   horizontal_padding = 8
1472   max_icon_size = 32
1473   separator_color = "#585858"
1474   startup_notification = false
1475 #+end_src
1476 *** Modes
1477 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1478   [frame]
1479   width = 4
1480   color = "#585858"
1481
1482   [shortcuts]
1483   close = mod4+c
1484   close_all = mod4+shift+c
1485   history = mod4+ctrl+c
1486
1487   [urgency_low]
1488   background = "#282828"
1489   foreground = "#ebdbb2"
1490   highlight = "#ebdbb2"
1491   timeout = 5
1492
1493   [urgency_normal]
1494   background = "#282828"
1495   foreground = "#ebdbb2"
1496   highlight = "#ebdbb2"
1497   timeout = 15
1498
1499   [urgency_critical]
1500   background = "#282828"
1501   foreground = "#cc241d"
1502   highlight = "#ebdbb2"
1503   timeout = 0
1504 #+end_src