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