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