dot/.config/doom/README.org

581 lines
17 KiB
Org Mode
Raw Normal View History

2023-08-12 17:25:26 +02:00
#+title: Phil's Doom Emacs Config
* Intro
This is my personal [[https://github.com/doomemacs/doomemacs][Doom Emacs]] config. The important bit is that I have some additional keybinds. This file is a catch-all for all the files in $DOOMDIR - you can use ~org-babel-tangle~ to tangle them into their respective files.
Some of the comments are from the default config.el file that ships with Doom Emacs.
You can extract all the source/ config files from here by running Emacs and hitting ~C-c C-v t~.
A lot of these are swiped from [[https://gitlab.com/dwt1/configuring-emacs/][DT's Configuring Emacs config files.]]
2023-08-12 17:25:26 +02:00
* config.el
** Basic settings, Theme and Display
#+begin_src emacs-lisp :tangle config.el
(setq user-full-name "Phil Bajsicki")
(setq global-auto-revert-mode t)
(setq auth-sources '("~/.authinfo"))
(setq straight-repository-branch "develop")
2023-08-12 17:25:26 +02:00
(after! counsel
(setq counsel-outline-display-style 'title))
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light)
doom-variable-pitch-font (font-spec :family "Iosevka" :size 13))
(load-theme 'doom-one t)
(doom-themes-neotree-config)
(doom-themes-org-config)
(set-frame-parameter nil 'alpha-background 70)
(add-to-list 'default-frame-alist '(alpha-background . 70))
2023-08-12 17:25:26 +02:00
(setq display-line-numbers-type 'relative)
(setq next-screen-context-lines 4)
(after! persp-mode
(setq persp-emacsclient-init-frame-behaviour-override "main"))
(setq doom-modeline-persp-name t)
2023-08-13 17:12:50 +02:00
2023-08-12 17:25:26 +02:00
#+end_src
** org-mode
2023-08-12 17:25:26 +02:00
If you use `org' and don't want your org files in the default location below, change `org-directory'. It must be set before org loads!
Make .org file automatically open in org-mode.
#+begin_src emacs-lisp :tangle config.el
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(setq org-directory "~/enc/org/")
(setq org-contacts-files
(file-expand-wildcards "~/enc/org/*.org"))
(setq-default org-enforce-todo-dependencies t)
(setq org-superstar-headline-bullets-list
'("⁖" "◉" "○" "✸" "✿"))
#+end_src
Ensure that hitting ~M-<return>~ splits the line it's on. This is useful when I'm typing something long, and then decide to turn a paragraph into a li
#+begin_src emacs-lisp :tangle config.el
(setq org-M-RET-may-split-line '((default . t)))
#+end_src
*** org-contacts
#+begin_src emacs-lisp :tangle config.el
(setq org-contacts-files '("~/enc/org/people.org"))
2023-08-12 17:25:26 +02:00
#+end_src
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ch" 'counsel-org-link)
(global-set-key "\C-cne" 'elgantt-open)
(global-set-key "\C-cnn" 'org-capture)
2023-08-12 17:25:26 +02:00
#+end_src
*** Timestamp keybinds
Inserts timestamps in the proper format. ~'(16)~ stands for two universal arguments, keeping the command from prompting for the time. Two keybinds here, which insert an active or inactive timestamp.
#+begin_src emacs-lisp :tangle config.el
(global-set-key "\C-cia" '(lambda ()(interactive)
(org-timestamp '(16))))
(global-set-key "\C-cii" '(lambda () (interactive)
(org-timestamp-inactive '(16))))
#+end_src
*** Automated timestamps in headings
I need this because hitting the above is tedious, as I keep my journals, expenses and therapy notes in org-roam.
For the files whose paths match the strings in the function, it will advise the org-insert-heading function to insert an inactive timestamp into the new heading.
This turns making new entries from ~C-<return> C-i i~ into just ~C-<return>~. Much easier, and I don't have to think about this any more.
#+begin_src emacs-lisp :tangle config.el
(add-hook 'org-insert-heading-hook
(lambda ()
(if
(or
(string-match "journal" buffer-file-name)
(string-match "money" buffer-file-name)
(string-match "therapy" buffer-file-name))
((lambda ()
(interactive)
(org-timestamp-inactive '(16))))
(setq 'org-insert-heading-hook nil)
)))
#+end_src
2023-08-12 17:25:26 +02:00
*** Theming.
#+begin_src emacs-lisp config.el
(setq org-fontify-todo-headline t)
(setq org-footnote-section nil)
(setq org-table-duration-hour-zero-padding nil)
#+end_src
2023-08-12 17:25:26 +02:00
*** Todo keywords
#+begin_src emacs-lisp :tangle config.el
(setq org-todo-keywords
'((sequence
"INBOX(i)"
"TASK(t)" ; A task that needs doing & is ready to do
"PROJ(p)" ; A project, which usually contains other tasks
"LOOP(r)" ; A recurring task
"WAIT(w)" ; Something external is holding up this task
"HOLD(h)" ; This task is paused/on hold because of me
"|"
"DONE(d)" ; Task successfully completed
"KILL(k)") ; Task was cancelled, aborted or is no longer applicable
(sequence
"DECIDE()" ; for making decisions
"|"
"OKAY(o)" ; okay as-is
"YES(y)" ; take action
"NO(n)")) ; don't take action
org-todo-keyword-faces
'(("[-]" . +org-todo-active)
("STRT" . +org-todo-active)
("[?]" . +org-todo-onhold)
("WAIT" . +org-todo-onhold)
("HOLD" . +org-todo-onhold)
("PROJ" . +org-todo-project)
("NO" . +org-todo-cancel)
("KILL" . +org-todo-cancel)))
(setq hl-todo-keyword-faces
'(("HOLD" . "#d0bf8f")
("TODO" . "#cc9393")
("NEXT" . "#dca3a3")
("THEM" . "#dc8cc3")
("PROG" . "#7cb8bb")
("OKAY" . "#7cb8bb")
("DONT" . "#5f7f5f")
("FAIL" . "#8c5353")
("DONE" . "#afd8af")
("NOTE" . "#d0bf8f")
("KLUDGE" . "#d0bf8f")
("HACK" . "#d0bf8f")
("TEMP" . "#d0bf8f")
("FIXME" . "#cc9393")
("XXXX*" . "#cc9393")))
#+end_src
*** Capture templates
#+begin_src emacs-lisp :tangle config.el
(setq org-capture-templates '(("t" "inbox" entry (file+headline "~/enc/org/phil.org" "Inbox") "* TODO %i%?")
("i" "idea" entry (file+headline "~/enc/org/phil.org" "Ideas") "* %?")
("d" "reminder" entry (file+headline "~/enc/org/phil.org" "Reminders") "* %i%? \n %U")
("p" "person" entry (file+headline "~/enc/org/people.org" "People")
"* %(org-contacts-template-name)
2023-08-12 17:25:26 +02:00
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
:PHONE: %(org-contacts-template-phone)
:ALIAS:
:NICKNAME:
:IGNORE:
:ICON:
:NOTE:
:ADDRESS:
:BIRTHDAY:
:END:")))
#+end_src
*** Org-wild-notifier
This lets me get desktop notifications for TODO items.
#+begin_src emacs-lisp :tangle config.el
(org-wild-notifier-mode)
(setq org-wild-notifier-alert-time '(10))
(setq org-wild-notifier-notification-title "Emacs org-mode agenda")
(setq org-wild-notifier-keyword-whitelist '("TODO"))
#+end_src
*** Org-refile
#+begin_src emacs-lisp :tangle config.el
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
(setq org-outline-path-complete-in-steps nil)
(setq org-refile-use-outline-path t)
#+end_src
(setq find-file-visit-truename t)
** org-roam
2023-08-12 17:25:26 +02:00
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(define-prefix-command 'org-roam-map)
(global-set-key "\C-r" 'org-roam-map)
(define-key org-roam-map "o" 'org-roam-buffer-toggle)
(define-key org-roam-map "f" 'org-roam-node-find)
(define-key org-roam-map "i" 'org-roam-node-insert)
(define-key org-roam-map "n" 'org-roam-capture)
#+end_src
*** org-roam
2023-08-12 17:25:26 +02:00
#+begin_src emacs-lisp :tangle config.el
(setq org-roam-v2-ack t)
(setq org-roam-completion-everywhere t)
(setq org-roam-directory
(file-truename "~/enc/org/roam"))
(org-roam-db-autosync-mode)
(org-roam-db-autosync-enable)
(setq org-roam-capture-templates
'(("n" "default" plain
2023-08-12 17:25:26 +02:00
"%?"
:if-new (file+head "%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("j" "journal" plain
"%?"
:if-new (file+head "journal/journal-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
:empty-lines 1
:unnarrowed t)
("t" "Therapy" plain
"
,* Sytuacja
,** Myśli
,** Emocje
,** Zachowania
,** Argumenty potwierdzające myśli
,** Argumenty podważające
,** Myśli alternatywne
,** Emocje alternatywne-
,** Zachowania alternatywne
"
:if-new (file+head "therapy/therapy-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
:empty-lines 1
:unnarrowed)))
#+end_src
** org-roam-ui
#+begin_src emacs-lisp :tangle config.el
(use-package! websocket
:after org-roam)
(use-package! org-roam-ui
:after org-roam ;; or :after org
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;; a hookable mode anymore, you're advised to pick something yourself
;; if you don't care about startup time, use
;; :hook (after-init . org-roam-ui-mode)
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
#+end_src
** org-elgantt
2023-08-12 17:25:26 +02:00
#+begin_src emacs-lisp :tangle config.el
(add-to-list 'load-path "~/.emacs.d/.local/straight/repos/elgantt/")
(setq elgantt-header-type 'outline
elgantt-draw-overarching-headers t
elgantt-insert-header-even-if-no-timestamp nil
elgantt-scroll-to-current-month-at-startup t)
(setq elgantt-user-set-color-priority-counter 0)
(setq elgantt-custom-header-line
'((:left ((:prop date-at-point
:padding 25)
(:prop todo
:padding 30)))
(:center ((:prop headline)))
(:right ((:prop hashtag
:padding 40
:text-props (face (:background "red")))))))
#+end_src
** org-agenda
2023-08-12 17:25:26 +02:00
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(global-set-key "\C-ca" 'org-agenda)
(define-prefix-command 'org-agenda-map)
(global-set-key "\C-a" 'org-agenda-map)
(define-key org-agenda-map "n" 'org-agenda-capture)
(define-key org-agenda-map "a" 'org-agenda)
#+end_src
*** Settings
#+begin_src emacs-lisp :tangle config.el
(setq org-agenda-files (directory-files-recursively "~/enc/org" "org$"))
2023-08-12 17:25:26 +02:00
(setq org-agenda-start-day nil
org-agenda-span '14
org-agenda-dim-blocked-tasks 'invisible
org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep)
(todo priority-down category-keep)
(search category-keep))
org-deadline-warning-days 3
org-agenda-insert-diary-extract-time t
org-log-into-drawer t
org-clock-into-drawer t
org-agenda-log-mode-items '(closed clock state))
(setq org-agenda-custom-commands
(quote (("x" "Phil's view" agenda ""
((org-agenda-prefix-format " %i %b %-12:c %s %t "))))))
2023-08-12 17:25:26 +02:00
#+end_src
** yasnippets
2023-08-12 17:25:26 +02:00
#+begin_src emacs-lisp :tangle config.el
(setq doom-snippets-enable-short-helpers t)
#+end_src
** dired-open
#+begin_src emacs-lisp :tangle config.el
(setq dired-open-extensions '(("gif" . "sxiv")
("jpg" . "sxiv")
("png" . "sxiv")
("mkv" . "mpv")
("mp4" . "mpv")))
2023-08-12 17:25:26 +02:00
#+end_src
* custom.el
Custom variables. Note that this file is generally set up automatically by Emacs, so I'm not exporting this block. I'm keeping the default warning commants in just for completion here.
#+begin_src emacs-lisp :tangle no
2023-08-12 17:25:26 +02:00
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-safe-remote-resources
'("\\`https://bajsicki\\.com/org-html-themes/org/theme-readtheorg\\.setup\\'")))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
#+end_src
* init.el
This is the state as of <2023-08-12 Sat>. I'm sure Doom Emacs will expand/ change/ add/ remove things over time, but this is what I use right now.
** input
#+begin_src emacs-lisp :tangle init.el
(doom! :input
#+end_src
** completion
#+begin_src emacs-lisp :tangle init.el
:completion
company
ivy
#+end_src
** ui
#+begin_src emacs-lisp :tangle init.el
:ui
doom
doom-dashboard
doom-quit
(emoji +unicode)
hl-todo
ligatures
modeline
ophints
(popup +defaults)
treemacs
unicode
vi-tilde-fringe
workspaces
#+end_src
** editor
#+begin_src emacs-lisp :tangle init.el
:editor
file-templates
fold
(format +onsave)
snippets
word-wrap
#+end_src
** emacs
#+begin_src emacs-lisp :tangle init.el
:emacs
dired
electric
undo
vc
#+end_src
** term
#+begin_src emacs-lisp :tangle init.el
:term
vterm
#+end_src
** checkers
#+begin_src emacs-lisp :tangle init.el
:checkers
syntax
#+end_src
** tools
#+begin_src emacs-lisp :tangle init.el
:tools
(eval +overlay)
lookup
lsp
magit
pdf
#+end_src
** lang
#+begin_src emacs-lisp :tangle init.el
:lang
common-lisp
data
emacs-lisp
(haskell +lsp)
latex
(org +pretty)
2023-08-12 17:25:26 +02:00
plantuml
raku
shipsweb
rust
yaml
zig
#+end_src
** config
#+begin_src emacs-lisp :tangle init.el
:config
;literate
(default +bindings +smartparens)
#+end_src
** closing
#+begin_src emacs-lisp :tangle init.el
)
#+end_src
* packages.el
** Info from the included (default) comments:
To install a package with Doom you must declare them here and run 'doom sync' on the command line, then restart Emacs for the changes to take effect -- or use 'M-x doom/reload'.
*** Install from MELPA, ELPA or emacsmirror:
#+begin_src emacs-lisp :tangle no
(package! some-package)
#+end_src
*** Install a package directly from git repo:
Specify a ~:recipe~. [[https://github.com/raxod502/straight.el#the-recipe-format][Documentation.]]
#+begin_src emacs-lisp :tangle no
(package! another-package :recipe (:host github
:repo "username/repo"))
#+end_src
If there is no PACKAGENAME.el file, or it's in a subdirectory, specify ~:files~ in the ~:recipe~:
#+begin_src emacs-lisp :tangle no
(package! this-package
:recipe (:host github :repo "username/repo"
:files ("some-file.el" "src/lisp/*.el")))
#+end_src
*** Disable packages included with Doom Emacs:
#+begin_src emacs-lisp :tangle no
~(package! builtin-package :disable t)~
#+end_src
*** Override package recipe:
If a property in a ~:recipe~ isn't specified, it will use defaults from Doom/MELPA/ELPA/Emacsmirror.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :recipe (:nonrecursive t))
(package! builtin-package-2 :recipe (:repo "myfork/package"))
#+end_src
You can override the recipe of a built in package without having to
specify all the properties for `:recipe'. These will inherit the rest
of its recipe from Doom or MELPA/ELPA/Emacsmirror:
*** Install package from specific branch:
You can set the ~:branch~ property. This is required for some packages.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :recipe (:branch "develop"))
#+end_src
*** Install a specific commit:
You can set ~:pin~.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :pin "1a2b3c4d5e")
#+end_src
*** Unpin a commit:
Doom's packages are pinned to a specific commit and updated from release to
release. You can ~unpin!~ them. Note ~(unpin! t)~ unpins all the packages and can break your Emacs.
#+begin_src emacs-lisp :tangle no
(unpin! pinned-package)
(unpin! pinned-package another-pinned-package)
(unpin! t)
#+end_#+begin_src
#+end_src
** Packages:
*** Core
#+begin_src emacs-lisp :tangle packages.el
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
(unpin! straight)
(package! beacon)
(package! counsel)
(package! deft)
#+end_src
*** Themes
#+begin_src emacs-lisp :tangle packages.el
(package! all-the-icons)
(package! all-the-icons-dired)
(package! doom-themes)
#+end_src
2023-08-12 17:25:26 +02:00
*** Modes:
#+begin_src emacs-lisp :tangle packages.el
(package! battle-haxe)
(package! fish-mode)
(package! typescript-mode)
(package! wc-mode)
#+end_src
*** Ivy
#+begin_src emacs-lisp :tangle packages.el
(package! ivy)
(package! ivy-xref)
#+end_src
*** dired
#+begin_src emacs-lisp :tangle packages.el
(package! dired-open)
#+end_src
2023-08-12 17:25:26 +02:00
*** Org
- org-roam pinned to ca873f7 because of https://github.com/org-roam/org-roam/issues/2361
2023-08-12 17:25:26 +02:00
#+begin_src emacs-lisp :tangle packages.el
(package! org-contacts)
(package! org-bullets)
(package! org-download)
2023-08-12 17:25:26 +02:00
(package! org-cliplink)
(package! org-roam :pin "ca873f7")
2023-08-12 17:25:26 +02:00
(package! org-ql)
(package! org-wild-notifier)
(unpin! org-roam)
(package! org-roam-ui)
2023-08-12 17:25:26 +02:00
#+end_src
*** Org-depend
Ensure task dependencies are met.
#+begin_src emacs-lisp :tangle packages.el
(package! org-depend
:recipe (
:host github
:repo "fgeller/org-mode"
:files ("contrib/lisp/org-depend.el")))
#+end_src
*** Elgantt
Pretty Gantt chart for your agenda.
#+begin_src emacs-lisp :tangle packages.el
(package! elgantt
:recipe (:host github :repo "legalnonsense/elgantt"))
#+end_src