]> git.armaanb.net Git - config.org.git/blob - config.org
Change browse-url alist variable
[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 counsel)
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-handlers
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     :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
592            (magit-post-refresh-hook . diff-hl-magit-post-refresh))
593     :config (global-diff-hl-mode))
594 #+end_src
595 * General text editing
596 ** Indentation
597 Indent after every change.
598 #+begin_src emacs-lisp
599   (use-package aggressive-indent
600     :config (global-aggressive-indent-mode))
601 #+end_src
602 ** Spell checking
603 Spell check in text mode, and in prog-mode comments.
604 #+begin_src emacs-lisp
605   (dolist (hook '(text-mode-hook))
606     (add-hook hook (lambda () (flyspell-mode))))
607   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
608     (add-hook hook (lambda () (flyspell-mode -1))))
609   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
610 #+end_src
611 ** Expand tabs to spaces
612 #+begin_src emacs-lisp
613   (setq-default tab-width 2)
614 #+end_src
615 ** Copy kill ring to clipboard
616 #+begin_src emacs-lisp
617   (setq x-select-enable-clipboard t)
618   (defun copy-kill-ring-to-xorg ()
619     "Copy the current kill ring to the xorg clipboard."
620     (interactive)
621     (x-select-text (current-kill 0)))
622 #+end_src
623 ** Browse kill ring
624 #+begin_src emacs-lisp
625   (use-package browse-kill-ring)
626 #+end_src
627 ** Save place
628 Opens file where you left it.
629 #+begin_src emacs-lisp
630   (save-place-mode)
631 #+end_src
632 ** Writing mode
633 Distraction free writing a la junegunn/goyo.
634 #+begin_src emacs-lisp
635   (use-package olivetti
636     :config
637     (evil-leader/set-key "o" 'olivetti-mode))
638 #+end_src
639 ** Abbreviations
640 Abbreviate things!
641 #+begin_src emacs-lisp
642   (setq abbrev-file-name "~/.emacs.d/abbrevs")
643   (setq save-abbrevs 'silent)
644   (setq-default abbrev-mode t)
645 #+end_src
646 * Functions
647 ** Easily convert splits
648 Converts splits from horizontal to vertical and vice versa. Lifted from EmacsWiki.
649 #+begin_src emacs-lisp
650   (defun toggle-window-split ()
651     (interactive)
652     (if (= (count-windows) 2)
653         (let* ((this-win-buffer (window-buffer))
654                (next-win-buffer (window-buffer (next-window)))
655                (this-win-edges (window-edges (selected-window)))
656                (next-win-edges (window-edges (next-window)))
657                (this-win-2nd (not (and (<= (car this-win-edges)
658                                            (car next-win-edges))
659                                        (<= (cadr this-win-edges)
660                                            (cadr next-win-edges)))))
661                (splitter
662                 (if (= (car this-win-edges)
663                        (car (window-edges (next-window))))
664                     'split-window-horizontally
665                   'split-window-vertically)))
666           (delete-other-windows)
667           (let ((first-win (selected-window)))
668             (funcall splitter)
669             (if this-win-2nd (other-window 1))
670             (set-window-buffer (selected-window) this-win-buffer)
671             (set-window-buffer (next-window) next-win-buffer)
672             (select-window first-win)
673             (if this-win-2nd (other-window 1))))))
674
675   (define-key ctl-x-4-map "t" 'toggle-window-split)
676 #+end_src
677 ** Insert date
678 #+begin_src emacs-lisp
679   (defun insert-date ()
680     (interactive)
681     (insert (format-time-string "%Y-%m-%d")))
682 #+end_src
683 * Keybindings
684 ** Switch windows
685 #+begin_src emacs-lisp
686   (use-package ace-window
687     :bind ("M-o" . ace-window))
688 #+end_src
689 ** Kill current buffer
690 Makes "C-x k" binding faster.
691 #+begin_src emacs-lisp
692   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
693 #+end_src
694 * Other settings
695 ** OpenSCAD
696 Render OpenSCAD files, and add a preview window.
697
698 Personal fork just merges a PR.
699 #+begin_src emacs-lisp
700   (use-package scad-mode)
701   (use-package scad-preview
702     :straight (scad-preview :type git :host github :repo "Armaanb/scad-preview"))
703 #+end_src
704 ** Control backup files
705 Stop backup files from spewing everywhere.
706 #+begin_src emacs-lisp
707   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
708 #+end_src
709 ** Make yes/no easier
710 #+begin_src emacs-lisp
711   (defalias 'yes-or-no-p 'y-or-n-p)
712 #+end_src
713 ** Move customize file
714 No more clogging up init.el.
715 #+begin_src emacs-lisp
716   (setq custom-file "~/.emacs.d/custom.el")
717   (load custom-file)
718 #+end_src
719 ** Better help
720 #+begin_src emacs-lisp
721   (use-package helpful
722     :commands (helpful-callable helpful-variable helpful-command helpful-key)
723     :custom
724     (counsel-describe-function-function #'helpful-callable)
725     (counsel-describe-variable-function #'helpful-variable)
726     :bind
727     ([remap describe-function] . counsel-describe-function)
728     ([remap describe-command] . helpful-command)
729     ([remap describe-variable] . counsel-describe-variable)
730     ([remap describe-key] . helpful-key))
731 #+end_src
732 ** GPG
733 #+begin_src emacs-lisp
734   (use-package epa-file
735     :straight (:type built-in))
736   (setq epa-file-select-keys nil
737         epa-file-encrypt-to '("me@armaanb.net")
738         password-cache-expiry (* 60 15))
739
740   (use-package pinentry)
741 #+end_src
742 ** Pastebin
743 #+begin_src emacs-lisp
744   (use-package 0x0
745     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
746     :custom (0x0-default-service 'envs)
747     :config (evil-leader/set-key
748               "00" '0x0-upload
749               "0f" '0x0-upload-file
750               "0s" '0x0-upload-string
751               "0c" '0x0-upload-kill-ring
752               "0p" '0x0-upload-popup))
753 #+end_src
754 * Tangles
755 ** Spectrwm
756 *** General settings
757 #+begin_src conf :tangle ~/.spectrwm.conf
758   workspace_limit = 5
759   warp_pointer = 1
760   modkey = Mod4
761   border_width = 4
762   tile_gap = 10
763   autorun = ws[1]:/home/armaa/Code/scripts/autostart
764 #+end_src
765 *** Apprearance
766 Gruvbox colors
767 #+begin_src conf :tangle ~/.spectrwm.conf
768   color_focus = rgb:83/a5/98
769   color_focus_maximized = rgb:d6/5d/0e
770   color_unfocus = rgb:58/58/58
771 #+end_src
772 *** Bar
773 #+begin_src conf :tangle ~/.spectrwm.conf
774   bar_enabled = 0
775   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
776 #+end_src
777 *** Keybindings
778 **** WM actions
779 #+begin_src conf :tangle ~/.spectrwm.conf
780   program[lock] = i3lock -c 000000 -ef
781   program[term] = alacritty
782   program[screenshot_all] = flameshot gui
783   program[menu] = rofi -show run # `rofi-dmenu` handles the rest
784   program[switcher] = rofi -show window
785   program[notif] = /home/armaa/Code/scripts/setter status
786
787   bind[notif] = MOD+n
788   bind[switcher] = MOD+Tab
789 #+end_src
790 **** Media keys
791 #+begin_src conf :tangle ~/.spectrwm.conf
792   program[paup] = /home/armaa/Code/scripts/setter audio +5
793   program[padown] = /home/armaa/Code/scripts/setter audio -5
794   program[pamute] = /home/armaa/Code/scripts/setter audio
795   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
796   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
797   program[next] = playerctl next
798   program[prev] = playerctl previous
799   program[pause] = playerctl play-pause
800
801   bind[padown] = XF86AudioLowerVolume
802   bind[paup] = XF86AudioRaiseVolume
803   bind[pamute] = XF86AudioMute
804   bind[brigdown] = XF86MonBrightnessDown
805   bind[brigup] = XF86MonBrightnessUp
806   bind[pause] = XF86AudioPlay
807   bind[next] = XF86AudioNext
808   bind[prev] = XF86AudioPrev
809 #+end_src
810 **** HJKL
811 #+begin_src conf :tangle ~/.spectrwm.conf
812   program[h] = xdotool keyup h key --clearmodifiers Left
813   program[j] = xdotool keyup j key --clearmodifiers Down
814   program[k] = xdotool keyup k key --clearmodifiers Up
815   program[l] = xdotool keyup l key --clearmodifiers Right
816
817   bind[h] = MOD + Control + h
818   bind[j] = MOD + Control + j
819   bind[k] = MOD + Control + k
820   bind[l] = MOD + Control + l
821 #+end_src
822 **** Programs
823 #+begin_src conf :tangle ~/.spectrwm.conf
824   program[aerc] = alacritty -e aerc
825   program[weechat] = alacritty --hold -e sh -c "while : ; do ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat; sleep 2; done"
826   program[emacs] = emacsclient -c
827   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
828   program[firefox] = firefox
829   program[thunderbird] = thunderbird
830   program[slack] = slack
831
832   bind[aerc] = MOD+Control+s
833   bind[weechat] = MOD+Control+d
834   bind[emacs] = MOD+Control+f
835   bind[emacs-anywhere] = MOD+f
836   bind[firefox] = MOD+Control+u
837   bind[thunderbird] = MOD+Control+i
838   bind[slack] = MOD+Control+o
839 #+end_src
840 ** Zsh
841 *** Settings
842 **** Completions
843 #+begin_src shell :tangle ~/.config/zsh/zshrc
844   autoload -Uz compinit
845   compinit
846
847   setopt no_case_glob
848   unsetopt glob_complete
849 #+end_src
850 **** Vim bindings
851 #+begin_src shell :tangle ~/.config/zsh/zshrc
852   bindkey -v
853   KEYTIMEOUT=1
854
855   bindkey -M vicmd "^[[3~" delete-char
856   bindkey "^[[3~" delete-char
857
858   autoload edit-command-line
859   zle -N edit-command-line
860   bindkey -M vicmd ^e edit-command-line
861   bindkey ^e edit-command-line
862 #+end_src
863 **** History
864 #+begin_src shell :tangle ~/.config/zsh/zshrc
865   setopt extended_history
866   setopt share_history
867   setopt inc_append_history
868   setopt hist_ignore_dups
869   setopt hist_reduce_blanks
870
871   HISTSIZE=10000
872   SAVEHIST=10000
873   HISTFILE=~/.local/share/zsh/history
874 #+end_src
875 *** Plugins
876 I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe
877 **** ZPE
878 #+begin_src plain :tangle ~/.config/zpe/repositories
879     https://github.com/Aloxaf/fzf-tab
880     https://github.com/zdharma/fast-syntax-highlighting
881     https://github.com/rupa/z
882 #+end_src
883 **** Zshrc
884 #+begin_src shell :tangle ~/.config/zsh/zshrc
885   source ~/Code/zpe/zpe.sh
886   source ~/Code/admone/admone.zsh
887   source ~/.config/zsh/fzf-bindings.zsh
888
889   zpe-source fzf-tab/fzf-tab.zsh
890   zstyle ':completion:*:descriptions' format '[%d]'
891   zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
892   zstyle ':completion:*' completer _complete
893   zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
894          'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'
895   enable-fzf-tab
896   zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
897   export _Z_DATA="/home/armaa/.local/share/z"
898   zpe-source z/z.sh
899 #+end_src
900 *** Functions
901 **** Alert after long command
902 #+begin_src shell :tangle ~/.config/zsh/zshrc
903   alert() {
904       notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \
905                   ${history[$HISTCMD]%[;&|][[:space:]]##alert}
906   }
907 #+end_src
908 **** Time Zsh startup
909 #+begin_src shell :tangle ~/.config/zsh/zshrc
910   timezsh() {
911       for i in $(seq 1 10); do
912           time "zsh" -i -c exit;
913       done
914   }
915 #+end_src
916 **** Update all packages
917 #+begin_src shell :tangle ~/.config/zsh/zshrc
918   color=$(tput setaf 5)
919   reset=$(tput sgr0)
920
921   apu() {
922       sudo echo "${color}== upgrading with yay ==${reset}"
923       yay
924       echo ""
925       echo "${color}== checking for pacnew files ==${reset}"
926       sudo pacdiff
927       echo
928       echo "${color}== upgrading flatpaks ==${reset}"
929       flatpak update
930       echo ""
931       echo "${color}== upgrading zsh plugins ==${reset}"
932       zpe-pull
933       echo ""
934       echo "${color}== updating nvim plugins ==${reset}"
935       nvim +PlugUpdate +PlugUpgrade +qall
936       echo "Updated nvim plugins"
937       echo ""
938       echo "${color}You are entirely up to date!${reset}"
939   }
940 #+end_src
941 **** Clean all packages
942 #+begin_src shell :tangle ~/.config/zsh/zshrc
943   apap() {
944       sudo echo "${color}== cleaning pacman orphans ==${reset}"
945       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
946       echo ""
947       echo "${color}== cleaning flatpaks ==${reset}"
948       flatpak remove --unused
949       echo ""
950       echo "${color}== cleaning zsh plugins ==${reset}"
951       zpe-clean
952       echo ""
953       echo "${color}== cleaning nvim plugins ==${reset}"
954       nvim +PlugClean +qall
955       echo "Cleaned nvim plugins"
956       echo ""
957       echo "${color}All orphans cleaned!${reset}"
958   }
959 #+end_src
960 **** ls every cd
961 #+begin_src shell :tangle ~/.config/zsh/zshrc
962   chpwd() {
963       emulate -L zsh
964       exa -lh --icons --git --group-directories-first
965   }
966 #+end_src
967 **** Setup anaconda
968 #+begin_src shell :tangle ~/.config/zsh/zshrc
969   zconda() {
970       __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
971       if [ $? -eq 0 ]; then
972           eval "$__conda_setup"
973       else
974           if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
975               . "/opt/anaconda/etc/profile.d/conda.sh"
976           else
977               export PATH="/opt/anaconda/bin:$PATH"
978           fi
979       fi
980       unset __conda_setup
981   }
982 #+end_src
983 **** Interact with 0x0
984 #+begin_src shell :tangle ~/.config/zsh/zshrc
985   zxz="https://envs.sh"
986   0file() { curl -F"file=@$1" "$zxz" ; }
987   0pb() { curl -F"file=@-;" "$zxz" ; }
988   0url() { curl -F"url=$1" "$zxz" ; }
989   0short() { curl -F"shorten=$1" "$zxz" ; }
990   0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
991 #+end_src
992 **** Swap two files
993 #+begin_src shell :tangle ~/.config/zsh/zshrc
994   sw() {
995       mv $1 $1.tmp
996       mv $2 $1
997       mv $1.tmp $2
998   }
999 #+end_src
1000 *** Aliases
1001 **** SSH
1002 #+begin_src shell :tangle ~/.config/zsh/zshrc
1003   alias bhoji-drop='ssh -p 23 root@armaanb.net'
1004   alias weechat='ssh -p 23 -t root@armaanb.net tmux attach-session -t weechat'
1005   alias tcf='ssh root@204.48.23.68'
1006   alias ngmun='ssh root@157.245.89.25'
1007   alias prox='ssh root@192.168.1.224'
1008   alias dock='ssh root@192.168.1.225'
1009   alias jenkins='ssh root@192.168.1.226'
1010   alias envs='ssh acheam@envs.net'
1011 #+end_src
1012 **** File management
1013 #+begin_src shell :tangle ~/.config/zsh/zshrc
1014   alias ls='exa -lh --icons --git --group-directories-first'
1015   alias la='exa -lha --icons --git --group-directories-first'
1016   alias df='df -h / /boot'
1017   alias du='du -h'
1018   alias free='free -h'
1019   alias cp='cp -riv'
1020   alias rm='rm -Iv'
1021   alias mv='mv -iv'
1022   alias ln='ln -iv'
1023   alias grep='grep -in --exclude-dir=.git --color=auto'
1024   alias mkdir='mkdir -pv'
1025   alias unar='atool -x'
1026   alias wget='wget -e robots=off'
1027   alias lanex='~/.local/share/lxc/lxc'
1028 #+end_src
1029 **** Dotfiles
1030 #+begin_src shell :tangle ~/.config/zsh/zshrc
1031   alias padm='yadm --yadm-repo ~/Code/dotfiles/repo.git'
1032   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
1033     yadm push'
1034   alias padu='padm add -u && padm commit && padm push && yadu'
1035 #+end_src
1036 **** Editing
1037 #+begin_src shell :tangle ~/.config/zsh/zshrc
1038   alias v='nvim'
1039   alias vim='nvim'
1040   alias vw="nvim ~/Documents/vimwiki/index.md"
1041 #+end_src
1042 **** System management
1043 #+begin_src shell :tangle ~/.config/zsh/zshrc
1044   alias jctl='journalctl -p 3 -xb'
1045   alias pkill='pkill -i'
1046   alias cx='chmod +x'
1047   alias please='sudo $(fc -ln -1)'
1048   alias sudo='sudo ' # allows aliases to be run with sudo
1049 #+end_src
1050 **** Networking
1051 #+begin_src shell :tangle ~/.config/zsh/zshrc
1052   alias ping='ping -c 10'
1053   alias speed='speedtest-cli'
1054   alias ip='ip --color=auto'
1055   alias cip='curl https://armaanb.net/ip'
1056   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
1057   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
1058 #+end_src
1059 **** Docker
1060 #+begin_src shell :tangle ~/.config/zsh/zshrc
1061   alias dc='docker-compose'
1062   alias dcdu='docker-compose down && docker-compose up -d'
1063 #+end_src
1064 **** Other
1065 #+begin_src shell :tangle ~/.config/zsh/zshrc
1066   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
1067     iflag=fullblock status=progress'
1068   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
1069     iflag=fullblock status=progress'
1070   alias ts='gen-shell -c task'
1071   alias ts='gen-shell -c task'
1072   alias tetris='autoload -Uz tetriscurses && tetriscurses'
1073   alias news='newsboat'
1074   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
1075   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
1076     --restrict-filenames -o '%(title)s.%(ext)s'"
1077   alias cal="cal -3 --color=auto"
1078 #+end_src
1079 **** Virtual machines, chroots
1080 #+begin_src shell :tangle ~/.config/zsh/zshrc
1081   alias ckiss="sudo chrooter ~/Virtual/kiss"
1082   alias cdebian="sudo chrooter ~/Virtual/debian bash"
1083   alias cwindows='devour qemu-system-x86_64 \
1084     -smp 3 \
1085     -cpu host \
1086     -enable-kvm \
1087     -m 3G \
1088     -device VGA,vgamem_mb=64 \
1089     -device intel-hda \
1090     -device hda-duplex \
1091     -net nic \
1092     -net user,smb=/home/armaa/Public \
1093     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
1094 #+end_src
1095 **** Python
1096 #+begin_src shell :tangle ~/.config/zsh/zshrc
1097   alias ipy="ipython"
1098   alias zpy="zconda && ipython"
1099   alias math="ipython --profile=math"
1100   alias pypi="python setup.py sdist && twine upload dist/*"
1101   alias pip="python -m pip"
1102   alias black="black -l 79"
1103 #+end_src
1104 **** Latin
1105 #+begin_src shell :tangle ~/.config/zsh/zshrc
1106   alias words='gen-shell -c "words"'
1107   alias words-e='gen-shell -c "words ~E"'
1108 #+end_src
1109 **** Devour
1110 #+begin_src shell :tangle ~/.config/zsh/zshrc
1111   alias zathura='devour zathura'
1112   alias mpv='devour mpv'
1113   alias sql='devour sqlitebrowser'
1114   alias cad='devour openscad'
1115   alias feh='devour feh'
1116 #+end_src
1117 **** Package management (Pacman)
1118 #+begin_src shell :tangle ~/.config/zsh/zshrc
1119   alias aps='yay -Ss'
1120   alias api='yay -Syu'
1121   alias app='yay -Rns'
1122   alias apc='yay -Sc'
1123   alias apo='yay -Qttd'
1124   alias azf='pacman -Q | fzf'
1125   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
1126   alias ufetch='ufetch-arch'
1127   alias reflect='reflector --verbose --sort rate --save \
1128     ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
1129 #+end_src
1130 *** Exports
1131 #+begin_src shell :tangle ~/.config/zsh/zshrc
1132   export EDITOR="emacsclient -c"                  # $EDITOR opens in terminal
1133   export VISUAL="emacsclient -c -a emacs"         # $VISUAL opens in GUI mode
1134   export TERM=xterm-256color # for compatability
1135
1136   export GPG_TTY="$(tty)"
1137   export MANPAGER='nvim +Man!'
1138   export PAGER='less'
1139
1140   # generated with "vivid generate gruvbox"
1141   export LS_COLORS="$(cat ~/.local/share/zsh/gruvbox)"
1142
1143   export GTK_USE_PORTAL=1
1144
1145   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
1146   export PATH="$PATH:/home/armaa/Code/scripts"
1147   export PATH="$PATH:/home/armaa/.cargo/bin"
1148   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
1149   export PATH="$PATH:/usr/sbin"
1150   export PATH="$PATH:/opt/FreeTube/freetube"
1151
1152   export LC_ALL="en_US.UTF-8"
1153   export LC_CTYPE="en_US.UTF-8"
1154   export LANGUAGE="en_US.UTF-8"
1155
1156   export KISS_PATH="/home/armaa/kiss/home/armaa/kiss-repo"
1157   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
1158   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
1159   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
1160   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
1161   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
1162 #+end_src
1163 ** Alacritty
1164 *** Appearance
1165 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1166 font:
1167   normal:
1168     family: JetBrains Mono Nerd Font
1169     style: Medium
1170   italic:
1171     style: Italic
1172   Bold:
1173     style: Bold
1174   size: 7
1175   ligatures: true # Requires ligature patch
1176
1177 window:
1178   padding:
1179     x: 5
1180     y: 5
1181
1182 background_opacity: 0.6
1183 #+end_src
1184 *** Keybindings
1185 Send <RET> + modifier through
1186 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1187 key_bindings:
1188   - {
1189     key: Return,
1190     mods: Shift,
1191     chars: "\x1b[13;2u"
1192   }
1193   - {
1194     key: Return,
1195     mods: Control,
1196     chars: "\x1b[13;5u"
1197   }
1198 #+end_src
1199 *** Color scheme
1200 Gruvbox
1201 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1202 colors:
1203   # Default colors
1204   primary:
1205     background: '#000000'
1206     foreground: '#ebdbb2'
1207
1208   # Normal colors
1209   normal:
1210     black:   '#282828'
1211     red:     '#cc241d'
1212     green:   '#98971a'
1213     yellow:  '#d79921'
1214     blue:    '#458588'
1215     magenta: '#b16286'
1216     cyan:    '#689d6a'
1217     white:   '#a89984'
1218
1219   # Bright colors
1220   bright:
1221     black:   '#928374'
1222     red:     '#fb4934'
1223     green:   '#b8bb26'
1224     yellow:  '#fabd2f'
1225     blue:    '#83a598'
1226     magenta: '#d3869b'
1227     cyan:    '#8ec07c'
1228     white:   '#ebdbb2'
1229 #+end_src
1230 ** IPython
1231 *** General
1232 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1233 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1234   c.TerminalInteractiveShell.editing_mode = 'vi'
1235   c.InteractiveShell.colors = 'linux'
1236   c.TerminalInteractiveShell.confirm_exit = False
1237 #+end_src
1238 *** Math
1239 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1240   from math import *
1241
1242   def deg(x):
1243       return x * (180 /  pi)
1244
1245   def rad(x):
1246       return x * (pi / 180)
1247
1248   def rad(x, unit):
1249       return (x * (pi / 180)) / unit
1250
1251   def csc(x):
1252       return 1 / sin(x)
1253
1254   def sec(x):
1255       return 1 / cos(x)
1256
1257   def cot(x):
1258       return 1 / tan(x)
1259 #+end_src
1260 ** MPV
1261 Make MPV play a little bit smoother.
1262 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1263   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1264   hwdec=auto-copy
1265 #+end_src
1266 ** Picom
1267 *** Shadows
1268 #+begin_src conf :tangle ~/.config/picom/picom.conf
1269   shadow = true;
1270   shadow-radius = 10;
1271   shadow-offset-x = -5;
1272   shadow-offset-y = -5;
1273 #+end_src
1274 *** Fading
1275 #+begin_src conf :tangle ~/.config/picom/picom.conf
1276   fading = true
1277   fade-delta = 5
1278 #+end_src
1279 *** Blur
1280 #+begin_src conf :tangle ~/.config/picom/picom.conf
1281   blur:
1282   {
1283   method = "gaussian";
1284   size = 5;
1285   deviation = 5;
1286   };
1287 #+end_src
1288 *** Backend
1289 Needs picom to be run with "--experimental-backends"
1290 #+begin_src conf :tangle ~/.config/picom/picom.conf
1291   backend = "glx";
1292 #+end_src
1293 ** Inputrc
1294 For any GNU Readline programs
1295 #+begin_src plain :tangle ~/.inputrc
1296   set editing-mode vi
1297 #+end_src
1298 ** Vivid
1299 https://github.com/sharkdp/vivid
1300 *** Colors
1301 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1302   colors:
1303     background_color: '282A36'
1304     black: '21222C'
1305     orange: 'd65d0e'
1306     purple: 'b16286'
1307     red: 'cc241d'
1308     blue: '458588'
1309     pink: 'd3869b'
1310     lime: '689d6a'
1311
1312     gray: '928374'
1313 #+end_src
1314 *** Core
1315 #+begin_src yml :tangle ~/.config/vivid/gruvbox.yml
1316   core:
1317     regular_file: {}
1318
1319     directory:
1320       foreground: blue
1321
1322     executable_file:
1323       foreground: red
1324       font-style: bold
1325
1326     symlink:
1327       foreground: pink
1328
1329     broken_symlink:
1330       foreground: black
1331       background: red
1332     missing_symlink_target:
1333       foreground: black
1334       background: red
1335
1336     fifo:
1337       foreground: black
1338       background: blue
1339
1340     socket:
1341       foreground: black
1342       background: pink
1343
1344     character_device:
1345       foreground: black
1346       background: lime
1347
1348     block_device:
1349       foreground: black
1350       background: red
1351
1352     normal_text:
1353       {}
1354
1355     sticky:
1356       {}
1357
1358     sticky_other_writable:
1359       {}
1360
1361     other_writable:
1362       {}
1363
1364   text:
1365     special:
1366       foreground: black
1367       background: orange
1368
1369     todo:
1370       font-style: bold
1371
1372     licenses:
1373       foreground: gray
1374
1375     configuration:
1376       foreground: orange
1377
1378     other:
1379       foreground: orange
1380
1381   markup:
1382     foreground: orange
1383
1384   programming:
1385     source:
1386       foreground: purple
1387
1388     tooling:
1389       foreground: purple
1390
1391       continuous-integration:
1392         foreground: purple
1393
1394   media:
1395     foreground: pink
1396
1397   office:
1398     foreground: red
1399
1400   archives:
1401     foreground: lime
1402     font-style: underline
1403
1404   executable:
1405     foreground: red
1406     font-style: bold
1407
1408   unimportant:
1409     foreground: gray
1410 #+end_src
1411 ** Git
1412 *** User
1413 #+begin_src plain :tangle ~/.gitconfig
1414 [user]
1415   name = Armaan Bhojwani
1416   email = me@armaanb.net
1417   signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1418 #+end_src
1419 *** Init
1420 #+begin_src plain :tangle ~/.gitconfig
1421 [init]
1422   defaultBranch = main
1423 #+end_src
1424 *** GPG
1425 #+begin_src plain :tangle ~/.gitconfig
1426 [gpg]
1427   program = gpg
1428 #+end_src
1429 *** Sendemail
1430 #+begin_src plain :tangle ~/.gitconfig
1431 [sendemail]
1432   smtpserver = smtp.mailbox.org
1433   smtpuser = me@armaanb.net
1434   smtpencryption = ssl
1435   smtpserverport = 465
1436   confirm = auto
1437 #+end_src
1438 *** Submodules
1439 #+begin_src plain :tangle ~/.gitconfig
1440 [submodule]
1441   recurse = true
1442 #+end_src
1443 *** Aliases
1444 #+begin_src plain :tangle ~/.gitconfig
1445 [alias]
1446   stat = diff --stat
1447   sclone = clone --depth 1
1448   sclean = clean -dfX
1449   a = add
1450   aa = add .
1451   c = commit
1452   p = push
1453   subup = submodule update --remote
1454   loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1455   mirror = git config --global alias.mirrormirror
1456 #+end_src
1457 *** Commits
1458 #+begin_src plain :tangle ~/.gitconfig
1459 [commit]
1460   gpgsign = true
1461 #+end_src
1462 ** Dunst
1463 Lightweight notification daemon. Gruvbox colors, based on https://github.com/a-schaefers/i3-wm-gruvbox-theme/
1464 *** General
1465 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1466   [global]
1467   font = "JetBrains Mono Medium Nerd Font 11"
1468   allow_markup = yes
1469   format = "<b>%s</b>\n%b"
1470   sort = no
1471   indicate_hidden = yes
1472   alignment = center
1473   bounce_freq = 0
1474   show_age_threshold = 60
1475   word_wrap = yes
1476   ignore_newline = no
1477   geometry = "400x5-20+20"
1478   transparency = 0
1479   idle_threshold = 120
1480   monitor = 0
1481   sticky_history = yes
1482   line_height = 0
1483   separator_height = 4
1484   padding = 8
1485   horizontal_padding = 8
1486   max_icon_size = 32
1487   separator_color = "#585858"
1488   startup_notification = false
1489 #+end_src
1490 *** Modes
1491 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1492   [frame]
1493   width = 4
1494   color = "#585858"
1495
1496   [shortcuts]
1497   close = mod4+c
1498   close_all = mod4+shift+c
1499   history = mod4+ctrl+c
1500
1501   [urgency_low]
1502   background = "#282828"
1503   foreground = "#ebdbb2"
1504   highlight = "#ebdbb2"
1505   timeout = 5
1506
1507   [urgency_normal]
1508   background = "#282828"
1509   foreground = "#ebdbb2"
1510   highlight = "#ebdbb2"
1511   timeout = 15
1512
1513   [urgency_critical]
1514   background = "#282828"
1515   foreground = "#cc241d"
1516   highlight = "#ebdbb2"
1517   timeout = 0
1518 #+end_src