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