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