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