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