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