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