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