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