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