dotfiles/config/dot_config/doom/config.org

361 lines
11 KiB
Org Mode
Raw Normal View History

2024-02-10 18:17:29 +01:00
#+TITLE: Emacs Config
#+AUTHOR: Jonathan Jenne / Inhji
2024-02-14 05:44:20 +01:00
#+PROPERTY: header-args :tangle config.el
2024-02-10 18:17:29 +01:00
#+auto_tangle: t
2024-03-03 11:48:20 +01:00
#+STARTUP: overview
2024-02-28 19:57:03 +01:00
2024-03-11 06:21:39 +01:00
This config file is built on doom-emacs ~3.0.0-pre~ and emacs ~29.2~.
2024-02-15 07:20:45 +01:00
* Table of Contents :toc:
2024-03-03 11:48:20 +01:00
:PROPERTIES:
:VISIBILITY: all
:END:
2024-02-28 19:57:03 +01:00
- [[#header][Header]]
2024-02-15 07:20:45 +01:00
- [[#keybindings][Keybindings]]
- [[#base-config][Base Config]]
2024-03-11 06:21:39 +01:00
- [[#appearance][Appearance]]
2024-02-15 07:20:45 +01:00
- [[#org-mode][Org Mode]]
- [[#general-settings][General Settings]]
2024-02-26 18:47:58 +01:00
- [[#org-export][Org Export]]
2024-02-15 07:20:45 +01:00
- [[#org-capture][Org Capture]]
- [[#org-agenda][Org Agenda]]
- [[#packages][Packages]]
2024-03-11 06:21:39 +01:00
- [[#doom-modeline][doom-modeline]]
- [[#evil-snipe][evil-snipe]]
2024-02-15 07:20:45 +01:00
- [[#hl-todo][hl-todo]]
2024-03-11 06:21:39 +01:00
- [[#notmuch][notmuch]]
2024-03-03 11:48:20 +01:00
- [[#novel][nov.el]]
- [[#olivetti][olivetti]]
2024-02-15 07:20:45 +01:00
- [[#org-auto-tangle][org-auto-tangle]]
2024-02-26 18:47:58 +01:00
- [[#org-drill][org-drill]]
2024-03-03 11:48:20 +01:00
- [[#org-noter][org-noter]]
- [[#org-roam][org-roam]]
2024-03-11 06:21:39 +01:00
- [[#drag-stuff][drag-stuff]]
2024-03-03 11:48:20 +01:00
* Header
2024-03-11 06:21:39 +01:00
This header will be the first codeblock in the config file.
2024-03-03 11:48:20 +01:00
#+begin_src emacs-lisp
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
#+end_src
2024-02-15 07:20:45 +01:00
* Keybindings
2024-02-26 18:47:58 +01:00
These keybindings extend the default doom bindings, either because the defaults were confusing to me or because the binding did not yet exist.
2024-02-15 07:20:45 +01:00
| Key | Description | State |
|------------+-------------------------+-------|
| F12 | Show Org-Agenda | N |
| Ctrl-Alt-+ | Increase Font Size | |
| Ctrl-# | Toggle Line Comment | |
| DEL | Up Directory | Dired |
| F6 | Toggle Light/Dark Theme | |
| F7 | Start Org-Drill | |
2024-03-04 16:23:48 +01:00
| SPC m g s | Go to habit stats | Org |
2024-03-11 06:21:39 +01:00
| M-UP | Move line up | |
| M-DOWN | Move line down | |
| M-LEFT | Move region left | |
2024-02-15 07:20:45 +01:00
2024-02-28 19:57:03 +01:00
#+begin_src emacs-lisp
(map! :n "<f12>" #'org-agenda-list)
(map! :n "<f7>" #'org-drill)
(map! "C-M-+" #'doom/increase-font-size)
(map! "C-#" #'comment-line)
2024-03-11 06:21:39 +01:00
(map! :n "<f8>" #'emms-playlist-mode-go)
2024-02-28 19:57:03 +01:00
(evil-define-key 'normal dired-mode-map
(kbd "DEL") 'dired-up-directory)
#+end_src
2024-02-15 07:20:45 +01:00
* Base Config
2024-02-10 18:17:29 +01:00
#+begin_src emacs-lisp
;; Basic User Settings
(setq user-full-name "Jonathan Jenne"
user-mail-address "johnnie@posteo.de")
;; Default Shell
;; Useful if default system shell is not bash
(setq shell-file-name (executable-find "bash"))
2024-03-11 06:21:39 +01:00
;; Display Line numbers
(setq display-line-numbers-type t)
#+end_src
* Appearance
#+begin_src emacs-lisp
2024-03-03 11:48:20 +01:00
;; Fonts
(setq doom-font
(font-spec :family "IBM Plex Mono" :size 18 :weight 'medium))
(setq doom-variable-pitch-font
(font-spec :family "IBM Plex Serif" :size 18 :weight 'medium))
(setq variable-pitch
(font-spec :family "IBM Plex Serif" :size 18 :weight 'medium))
2024-03-11 06:21:39 +01:00
;; Dashboard
(defun my-weebery-is-always-greater ()
(let* ((banner '("EMACS "
"███▄ ▄███▓ ▒█████ ▒█████ ▓█████▄ "
"▓██▒▀█▀ ██▒▒██▒ ██▒▒██▒ ██▒▒██▀ ██▌"
"▓██ ▓██░▒██░ ██▒▒██░ ██▒░██ █▌"
"▒██ ▒██ ▒██ ██░▒██ ██░░▓█▄ ▌"
"▒██▒ ░██▒░ ████▓▒░░ ████▓▒░░▒████▓ "
"░ ▒░ ░ ░░ ▒░▒░▒░ ░ ▒░▒░▒░ ▒▒▓ ▒ "
"░ ░ ░ ░ ▒ ▒░ ░ ▒ ▒░ ░ ▒ ▒ "
"░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ░ ░ ░ "
" ░ ░ ░ ░ ░ ░ "
" ░ "))
(longest-line (apply #'max (mapcar #'length banner))))
(put-text-property
(point)
(dolist (line banner (point))
(insert (+doom-dashboard--center
+doom-dashboard--width
(concat line (make-string (max 0 (- longest-line (length line))) 32)))
"\n"))
'face 'doom-dashboard-banner)))
(setq +doom-dashboard-ascii-banner-fn #'my-weebery-is-always-greater)
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-shortmenu)
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-footer)
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-loaded)
;; Themes
2024-02-15 07:20:45 +01:00
(use-package! heaven-and-hell
:ensure t
:config
(setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default
(setq heaven-and-hell-themes
'((light . doom-gruvbox-light)
(dark . doom-gruvbox))) ;; Themes can be the list: (dark . (tsdh-dark wombat))
2024-02-15 07:20:45 +01:00
;; Optionall, load themes without asking for confirmation.
(setq heaven-and-hell-load-theme-no-confirm t)
:hook (after-init . heaven-and-hell-init-hook)
:bind (("<f6>" . heaven-and-hell-toggle-theme)))
2024-02-15 07:20:45 +01:00
#+end_src
2024-02-14 05:44:20 +01:00
2024-02-15 07:20:45 +01:00
* Org Mode
** General Settings
#+begin_src emacs-lisp
2024-02-14 05:44:20 +01:00
(setq +user-org-path "~/Notes/Org")
(defun org-path (filename) (expand-file-name filename +user-org-path))
2024-02-10 18:17:29 +01:00
2024-03-03 11:48:20 +01:00
(after! org
2024-03-04 16:23:48 +01:00
(map! :map org-mode-map :localleader "g s" #'org-habit-stats-view-habit-at-point)
2024-03-03 11:48:20 +01:00
(setq org-directory +user-org-path
2024-03-11 06:21:39 +01:00
org-src-tab-acts-natively t
org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)")
(sequence "THIS(T)" "EXAMPLE"))))
2024-03-03 11:48:20 +01:00
(add-hook! 'org-mode-hook '(olivetti-mode (lambda () (display-line-numbers-mode -1))))
(add-hook! 'org-after-todo-state-change-hook '(org-habit-stats-update-properties))
2024-02-10 18:17:29 +01:00
2024-02-15 07:20:45 +01:00
(add-to-list 'org-modules 'org-habit)
2024-02-26 18:47:58 +01:00
#+end_src
** Org Export
#+begin_src emacs-lisp
(after! org (;; TOC Links will lead to errors when attempting
2024-02-26 18:47:58 +01:00
;; to export to HTML
setq org-export-exclude-tags '("toc")))
(defun my-org-inline-css-hook (exporter)
"Insert custom inline css"
(when (eq exporter 'html)
(let* ((dir (ignore-errors (file-name-directory (buffer-file-name))))
(path (concat dir "style.css"))
(fallback-style (or (null dir) (null (file-exists-p path))))
(final (if fallback-style "~/.config/doom/style.css" path))) ;; <- set your own style file path
(setq org-html-head-include-default-style t)
(setq org-html-head (concat
"<style type=\"text/css\">\n"
"<!--/*--><![CDATA[/*><!--*/\n"
(with-temp-buffer
(insert-file-contents final)
(buffer-string))
"/*]]>*/-->\n"
"</style>\n")))))
;; Org Export
2024-03-03 11:48:20 +01:00
(add-hook 'org-export-before-processing-functions 'my-org-inline-css-hook)
2024-02-26 18:47:58 +01:00
2024-02-15 07:20:45 +01:00
#+end_src
2024-03-03 11:48:20 +01:00
** Org Capture
2024-02-15 07:20:45 +01:00
#+begin_src emacs-lisp
2024-02-10 18:17:29 +01:00
(after! org (setq +org-capture-notes-file (org-path "Notes.org")
+org-capture-todo-file (org-path "Todo.org")
+org-capture-journal-file (org-path "Journal.org")
2024-02-28 19:57:03 +01:00
+org-capture-cooking-file (org-path "Cooking.org")
+org-capture-nepali-file (org-path "Nepali.org")))
2024-02-10 18:17:29 +01:00
(after! org (setq org-capture-templates
'(("t" "Personal Todo" entry
2024-03-11 06:21:39 +01:00
(file +org-capture-todo-file)
2024-02-14 05:44:20 +01:00
"* TODO %?\n" :prepend t)
2024-02-10 18:17:29 +01:00
2024-02-28 19:57:03 +01:00
("r" "Recipe" entry
(file+headline +org-capture-cooking-file "Unsorted")
"* NEVERMADE %?
:PROPERTIES:
:Author:
:Source:
:Sent_by:
:Yield:
:Prep_Time:
:Cook_Time:
:Total_Time:
:Cost:
:Description:
:URL:
:Added: %u
:END:
- [ ] Ingredient 1
1. First Step")
("n" "Nepali")
2024-02-10 18:17:29 +01:00
("nw" "Nepali Word" entry
(file+headline +org-capture-nepali-file "Nepali Words")
"* %^{Nepali Word} :drill:\n%\\1\n** Answer\n%^{Translation}" :prepend t :immediate-finish t)
2024-02-26 18:47:58 +01:00
2024-03-03 11:48:20 +01:00
("j" "Daily Journal" entry
2024-02-14 05:44:20 +01:00
(file+olp+datetree +org-capture-journal-file)
"* %U %?\n" :prepend t))))
2024-03-03 11:48:20 +01:00
2024-02-15 07:20:45 +01:00
#+end_src
** Org Agenda
#+begin_src emacs-lisp
2024-02-10 18:17:29 +01:00
(after! org (setq
2024-03-11 06:21:39 +01:00
;; org-agenda-spillover-skip-function '(org-agenda-skip-entry-if 'todo 'done)
org-agenda-show-all-dates t
2024-02-14 06:10:47 +01:00
org-agenda-span 4
org-agenda-start-day "+0d"
2024-03-11 06:21:39 +01:00
org-agenda-tag-filter-preset '("-drill")
2024-02-14 06:10:47 +01:00
org-agenda-time-grid
'((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
org-agenda-current-time-string
"◀── now ──────────────────────────────────────────────── \\o/"
org-agenda-block-separator ?─
;; Consider all org files part of the org-agenda
org-agenda-files (list +user-org-path)))
2024-02-15 07:20:45 +01:00
#+end_src
2024-02-18 18:02:37 +01:00
2024-02-15 07:20:45 +01:00
* Packages
2024-03-11 06:21:39 +01:00
** doom-modeline
The doom modeline can be configured to show different information like time and date, battery info and more.
#+begin_src emacs-lisp
(after! doom-modeline
(setq doom-modeline-battery t)
(setq doom-modeline-major-mode-icon t))
(add-hook 'doom-after-init-hook #'display-battery-mode)
(add-hook 'doom-after-init-hook #'display-time-mode)
#+end_src
** evil-snipe
#+begin_src emacs-lisp
(after! evil-snipe (setq evil-snipe-scope 'whole-visible))
#+end_src
2024-02-15 07:20:45 +01:00
** hl-todo
2024-03-03 11:48:20 +01:00
2024-02-15 07:20:45 +01:00
#+begin_src emacs-lisp
2024-02-28 19:57:03 +01:00
(add-hook 'org-mode-hook #'hl-todo-mode)
2024-03-11 06:21:39 +01:00
(after! hl-todo
(setq hl-todo-keyword-faces
'(("TODO" warning bold)
("EXAMPLE" font-lock-keyword-face bold)
("HACK" font-lock-constant-face bold)
("DEPRECATED" font-lock-doc-face bold)
("NOTE" success bold)
("BUG" error bold)
("THIS" font-lock-constant-face bold))))
2024-03-03 11:48:20 +01:00
#+end_src
2024-03-11 06:21:39 +01:00
** notmuch
#+begin_src emacs-lisp
(setq +notmuch-home-function (lambda () (notmuch-search "folder:INBOX")))
(setq +notmuch-sync-backend 'offlineimap)
#+end_src
2024-03-03 11:48:20 +01:00
** nov.el
#+begin_src emacs-lisp
(use-package! nov
:mode ("\\.epub\\'" . nov-mode)
:config
2024-03-11 06:21:39 +01:00
(setq nov-text-width 70))
2024-03-03 11:48:20 +01:00
(add-hook! 'nov-mode-hook '(olivetti-mode))
#+end_src
** olivetti
2024-03-11 06:21:39 +01:00
Centers the text. This is used for reading books in
2024-03-03 11:48:20 +01:00
2024-03-11 06:21:39 +01:00
#+begin_src emacs-lisp
(after! olivetti (setq olivetti-body-width 70))
2024-02-15 07:20:45 +01:00
#+end_src
2024-02-18 18:02:37 +01:00
2024-02-15 07:20:45 +01:00
** org-auto-tangle
2024-03-11 06:21:39 +01:00
This package automatically tangles all sourceblocks in an org file whenever that file is saved. It is very handy to not have to call the tangle command everytime you save.
2024-02-15 07:20:45 +01:00
#+begin_src emacs-lisp
2024-02-10 18:17:29 +01:00
(use-package! org-auto-tangle
:defer t
2024-02-15 07:20:45 +01:00
:config (setq org-auto-tangle-default nil)
2024-02-10 18:17:29 +01:00
:hook (org-mode . org-auto-tangle-mode))
#+end_src
2024-03-11 06:21:39 +01:00
2024-02-26 18:47:58 +01:00
** org-drill
2024-03-11 06:21:39 +01:00
A package for learning and memorizing using *spaced repetition*, inspired by applications like Anki.
2024-02-26 18:47:58 +01:00
#+begin_src emacs-lisp
(after! org-drill
(setq org-drill-scope 'agenda))
#+end_src
2024-02-28 19:57:03 +01:00
2024-03-03 11:48:20 +01:00
** org-noter
2024-03-11 06:21:39 +01:00
2024-03-03 11:48:20 +01:00
#+begin_src emacs-lisp
(after! org-noter
(setq org-noter-notes-search-path '("~/Notes/Org"))
(setq org-noter-always-create-frame nil)
(setq org-noter-doc-split-fraction '(0.75 . 0.75))
(setq org-noter-default-notes-file-names '()))
#+end_src
** org-roam
#+begin_src emacs-lisp
(after! org-roam
(setq org-roam-directory "~/Notes/Org/Roam")
(setq org-roam-dailies-directory "Daily"))
#+end_src
2024-03-11 06:21:39 +01:00
** drag-stuff
With drag stuff you can use ~M-UP~ and ~M-DOWN~ to move lines. You can also mark a region and use ~M-LEFT~ and ~M-RIGHT~ to move it left and right.
2024-03-04 16:22:50 +01:00
#+begin_src emacs-lisp
2024-03-11 06:21:39 +01:00
(drag-stuff-global-mode t)
2024-03-04 16:22:50 +01:00
#+end_src