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