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