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