My Emacs Config
Table of Contents
- 1. Readme
- 2. Running emacs daemon
- 3. Lexical Binding
- 4. Default
- 5. General
- 6. Package Setup (Straight)
- 7. garbage collection
- 8. Theme
- 9. All the icons
- 10. Modelines
- 11. Misc
- 12. Projectile
- 13. Dashboard
- 14. Undo Tree
- 15. Hydra
- 16. Minibuffer completion
- 17. Code Completion
- 18. Evil
- 19. tab-bar-mode
- 20. Git
- 21. Org-Mode
- 22. Treemacs
- 23. term, vterm
- 24. Dired
- 25. tree-sitter
- 26. eglot
- 27. Programming Languages and Tools
- 28. Org download
- 29. Ox-Hugo
- 30. Org roam
- 31. Org-roam-bibtex
- 32. Org transclusion
- 33. Org Wild Notifier
- 34. Pdf-tools
- 35. nov.el
- 36. MPC and Music/emms
- 37. Speed-Type
- 38. bibliography
- 39. org calfw
- 40. org cite
- 41. Org ref
- 42. org-noter
- 43. org-fc
- 44. yasnippet
- 45. Ledger
- 46. Annotate.el
- 47. ripgrep | deadgrep
- 48. highlight indent guides
- 49. hl-line
- 50. Simplify Yes/No Prompts
- 51. Avy
- 52. enable downcase
C-x C-l - 53. Leader keys and its bindings using Hydra
- 54. disable keys
- 55. rainbow-mode
- 56. calendar customize
- 57. GPtel
- 58. Gptel
- 59. my custom function
1. Readme
For GNU Emacs 29.0.90
1.1. Credits
1.2. Useful Resources
- http://doc.norang.ca/org-mode.html
- https://www.youtube.com/watch?v=74zOY-vgkyw&list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ
- https://www.youtube.com/watch?v=3V3wIJgMeqE
- https://www.youtube.com/watch?v=e-SjhYZjIO8
- https://www.youtube.com/playlist?list=PL3bRG3rC5WYdMKiukj5RlFeuFHbCCgaJ9 [Emacs playlist for me]
2. Running emacs daemon
- Why emacs daemon
Reason specific to me is to load the config during the startup of my OS.
This saves you from having to load configuration and packages for every new file you open.
2.1. enable
systemctl --user enable --now emacs
2.2. start
systemctl --user start emacs.service
2.3. To run the emacs client
;; For GUI emacsclient -nc ;; For terminal emacsclient -nw
3. Lexical Binding
;; -*- lexical-binding: t -*-
4. Default
(setq frame-inhibit-implied-resize t ;; prevent resize window on startup default-frame-alist '((width . 130) (height . 45)) visible-bell t ;; Set up the visible bell ) (scroll-bar-mode -1) ;; Disable visible scrollbar (tool-bar-mode -1) ;; Disable the toolbar (tooltip-mode -1) ;; Disable tooltips (set-fringe-mode 10) ;; Give some breathing room (menu-bar-mode 1) ;; menu bar ;; (hs-minor-mode 1) ;; enable hs minor mode hide/show code block ;; Make ESC quit prompts (global-set-key (kbd "<escape>") 'keyboard-escape-quit ) ;; transparency ;; (set-frame-parameter (selected-frame) 'alpha '(98 . 92)) (setq-default display-time-default-load-average nil ; Don't display load average )
4.1. Font Configuration
;; Font Configuration ---------------------------------------------------------- (defun efs/set-font-faces () (setq height 121) ;;# 110 for work (message "Setting faces!") ;(set-face-attribute 'default nil :font "Fira Code Retina" :height 110) (set-face-attribute 'default nil :font "mononoki" :height height :weight 'regular) ;; Set the fixed pitch face (set-face-attribute 'fixed-pitch nil :font "mononoki" :height height :weight 'regular) ;; Set the variable pitch face (set-face-attribute 'variable-pitch nil :font "mononoki" :height height :weight 'regular) ) (if (daemonp) (add-hook 'after-make-frame-functions (lambda (frame) ;; (setq doom-modeline-icon t) (with-selected-frame frame (efs/set-font-faces)))) (efs/set-font-faces))
5. General
(setq backup-inhibited t) ;; disable backup (display-time-mode 1) ; Enable time in the mode-line (setq display-time-format "%I:%M %p | W %U") (unless (string-match-p "^Power N/A" (battery)) ; On laptops... (display-battery-mode 1)) ; it's nice to know how much power you have ;; (global-subword-mode 1) ; Iterate through CamelCase words
5.1. Smooth scrolling
(if (version< emacs-version "29.0") (pixel-scroll-mode) (pixel-scroll-precision-mode 1) (setq pixel-scroll-precision-large-scroll-height 30.0))
6. Package Setup (Straight)
;; Package System Setup ;; straight.el (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t) ;; old config ;; Initialize package sources ;; (require 'package) ;; (setq package-archives '(("melpa" . "https://melpa.org/packages/") ;; ("org" . "https://orgmode.org/elpa/") ;; ("elpa" . "https://elpa.gnu.org/packages/"))) ;; (package-initialize) ;; uncomment ;; (unless package-archive-contents ;; (package-refresh-contents)) ;; ;; Initialize use-package on non-Linux platforms ;; (unless (package-installed-p 'use-package) ;; (package-install 'use-package)) ;; (require 'use-package) ;; (setq use-package-always-ensure t) ;; Package System Setup End
7. garbage collection
- do read this thread
(use-package gcmh :straight t :diminish :hook (after-init . gcmh-mode) :init (setq gcmh-idle-delay 'auto gcmh-auto-idle-delay-factor 10 gcmh-high-cons-threshold (* 16 1024 1024)))
8. Theme
- Themes to try out
;; theme ;; (add-to-list 'custom-theme-load-path "~/.emacs.d/themes") (straight-use-package 'kaolin-themes) (straight-use-package 'gruvbox-theme) ;; (straight-use-package 'ef-themes) (load-theme 'gruvbox-dark-hard t) ;; (load-theme 'ef-bio :no-confirm) ;; (load-theme 'ef-tritanopia-light :no-confirm) ;; (setq kaolin-themes-modeline-border nil ;; kaolin-themes-italic-comments t) ;; ( ;; (load-theme 'kaolin-ocean t) ;; (straight-use-package 'gruvbox-theme) ;;; dark variants ;; Range: 233 (darkest) ~ 239 (lightest) ;; Default: 237 ;; (load-theme 'gruvbox-dark-hard t) ;; (load-theme 'kaolin-light t) ;; (load-theme 'kaolin-temple t) ;; Load the theme of your choice: ;; (load-theme 'modus-operandi t) ;; OR (load-theme 'modus-vivendi) ;; (define-key global-map (kbd "M-<f5>") #'modus-themes-toggle)
8.1. theme toggle
(defun toggle-theme () (interactive) (if (eq (car custom-enabled-themes) 'kaolin-light) (disable-theme 'kaolin-light) (load-theme 'gruvbox-dark-hard t) (load-theme 'kaolin-light t))) (global-set-key [f8] 'toggle-theme)
8.2. modus themes
;; (use-package modus-themes ;; :straight (:type git :host github :repo "protesilaos/modus-themes") ;; :init ;; ;; Add all your customizations prior to loading the themes ;; (setq modus-themes-italic-constructs t ;; modus-themes-bold-constructs nil ;; modus-themes-mode-line '(borderless (padding . 4) (height . 0.9)) ;; modus-themes-paren-match '(bold intense) ;; modus-themes-completions '((matches . (extrabold)) ;; (selection . (semibold accented)) ;; (popup . (accented intense))) ;; modus-themes-syntax '(faint alt-syntax) ;; ;; modus-themes-syntax nil ;;'(faint) ;; modus-themes-region '(bg-only)) ;; ;; org theme config ;; (setq modus-themes-org-blocks 'gray-background ; ;; modus-themes-headings ; this is an alist: read the manual or its doc string ;; '((1 . (rainbow 1.3)) ;; (2 . (rainbow 1.2)) ;; (3 . (rainbow bold 1.1)) ;; (t . (semilight 1.0))) ;; ;; Important! ;; modus-themes-scale-headings t) ;; ;; operandi color customize ;; (setq modus-themes-operandi-color-overrides ;; '((bg-main . "#f5fffa") ;; (fg-main . "#141414") ;; (bg-hl-line . "#e8e2ef"))) ;; ;; vivendi color customize ;; (setq modus-themes-vivendi-color-overrides ;; '((bg-main . "#1C1B19") ;; (fg-main . "#f7f7f7") ;; (bg-hl-line . "#231a2f"))) ;; ) ;; ;; Load the theme files before enabling a theme ;; (modus-themes-load-themes) ;; :config ;; ;; Load the theme of your choice: ;; (modus-themes-load-operandi) ;; OR (modus-themes-load-vivendi) ;; :bind ("<f8>" . modus-themes-toggle))
9. All the icons
;; (use-package all-the-icons ;; :straight t ;; :ensure t ;; ) ;; (all-the-icons-install-fonts t)
10. Modelines
10.1. Doom modeline
(use-package doom-modeline :straight t :init (doom-modeline-mode 1) :custom ( (doom-modeline-height 25) )) (setq doom-modeline-icon t)
11. Misc
(column-number-mode) (global-display-line-numbers-mode t) (setq display-line-numbers-type 'relative) ;; Disable line numbers for some modes (dolist (mode '(org-mode-hook term-mode-hook vterm-mode-hook treemacs-mode-hook shell-mode-hook eshell-mode-hook)) (add-hook mode (lambda () (display-line-numbers-mode 0)))) (use-package command-log-mode) (use-package flycheck :straight t :init (global-flycheck-mode)) (use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) (use-package which-key :init (which-key-mode) :diminish which-key-mode :config (setq which-key-idle-delay 1))
11.1. Counsel
(use-package counsel :straight t) ;; :config ;; (counsel-mode 1)) ;(global-set-key (kbd "C-M-j") 'counsel-switch-buffer) (use-package helpful :custom (counsel-describe-function-function #'helpful-callable) (counsel-describe-variable-function #'helpful-variable) :bind ([remap describe-function] . counsel-describe-function) ([remap describe-command] . helpful-command) ([remap describe-variable] . counsel-describe-variable) ([remap describe-key] . helpful-key))
12. Projectile
(use-package projectile :diminish projectile-mode :config (projectile-mode) :custom ((projectile-completion-system 'ivy)) :bind-keymap ("C-c p" . projectile-command-map) :init ;; NOTE: Set this to the folder where you keep your Git repos! (when (file-directory-p "~/Desktop/Workspace") (setq projectile-project-search-path '("~/Desktop/Workspace" "~/Desktop/ML"))) (setq projectile-switch-project-action #'projectile-dired)) (use-package counsel-projectile :config (counsel-projectile-mode))
13. Dashboard
(use-package dashboard :straight t :config (setq dashboard-banner-logo-title " felladog") (setq dashboard-startup-banner "~/.emacs.d/pc.png") (setq dashboard-center-content t) (setq dashboard-set-heading-icons t) (setq dashboard-set-file-icons t) (setq dashboard-projects-backend 'projectile) (setq dashboard-items '((recents . 5) (projects . 3) (bookmarks . 5) (agenda . 5))) (setq dashboard-footer-messages '("Happy learning! C-c m d D")) (dashboard-setup-startup-hook)) (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
14. Undo Tree
; undo and redo (use-package undo-tree) (global-undo-tree-mode t) (setq undo-tree-auto-save-history 'nil)
15. Hydra
(use-package hydra)
16. Minibuffer completion
16.1. Vertico
- https://github.com/minad/vertico
- https://www.youtube.com/watch?v=J0OaRy85MOo
- https://www.youtube.com/watch?v=hPwDbx--Waw
https://github.com/karthink/.emacs.d/blob/master/lisp/setup-vertico.el
(use-package vertico :straight (vertico :files (:defaults "extensions/*.el")) :init (vertico-mode) :bind (:map vertico-map ("C-<backspace>" . vertico-directory-up)) :custom (vertico-cycle t) :custom-face (vertico-current ((t (:background "#333537"))))) ;;1d1f21
16.2. savehist
;; Persist history over Emacs restarts. Vertico sorts by history position. (use-package savehist :init (savehist-mode))
16.3. marginalia
(use-package marginalia :after vertico :init (marginalia-mode) :custom (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))
16.4. Orderless
(use-package orderless :straight t :custom (completion-styles '(orderless basic)) (completion-category-overrides '((file (styles basic partial-completion)) (eglot (styles orderless)) )))
16.5. consult
(use-package consult :after projectile :bind (;; Related to the control commands. ("<help> a" . consult-apropos) ("C-x b" . consult-buffer) ("C-x M-:" . consult-complex-command) ("C-c k" . consult-kmacro) ;; Related to the navigation. ("M-g a" . consult-org-agenda) ("M-g e" . consult-error) ("M-g g" . consult-goto-line) ("M-g h" . consult-org-heading) ("M-g i" . consult-imenu) ("M-g k" . consult-global-mark) ("M-g l" . consult-line) ("M-g m" . consult-mark) ("M-g o" . consult-outline) ("M-g I" . consult-project-imenu) ;; Related to the search and selection. ("M-s G" . consult-git-grep) ("M-s g" . consult-grep) ("M-s k" . consult-keep-lines) ("M-s l" . consult-locate) ("M-s m" . consult-multi-occur) ("M-s r" . consult-ripgrep) ("M-s u" . consult-focus-lines) ("M-s f" . consult-find)) :custom (completion-in-region-function #'consult-completion-in-region) (consult-narrow-key "<") (consult-project-root-function #'projectile-project-root) ;; Provides consistent display for both `consult-register' and the register ;; preview when editing registers. (register-preview-delay 0) (register-preview-function #'consult-register-preview))
17. Code Completion
17.1. Corfu
(use-package corfu ;; :straight t :straight (corfu :files (:defaults "extensions/*.el")) :custom (corfu-cycle t) ; Allows cycling through candidates (corfu-auto t) ; Enable auto completion (corfu-separator ?\s) ;; Orderless field separator (corfu-preselect-first nil) ;; Disable candidate preselection :bind (:map corfu-map ("M-SPC" . corfu-insert-separator) ("TAB" . corfu-next) ([tab] . corfu-insert) ("S-TAB" . corfu-previous) ([backtab] . corfu-previous) ("RET" . nil) ;; leave my enter alone! ) :init (global-corfu-mode) (corfu-history-mode) :config (setq tab-always-indent 'complete) (setq completion-cycle-threshold 3) )
17.2. Cape
(use-package cape :straight t ;; Bind dedicated completion commands ;; Alternative prefix keys: C-c p, M-p, M-+, ... :bind (("M-p c p" . completion-at-point) ;; capf ("M-p c t" . complete-tag) ;; etags ) :init ;; Add `completion-at-point-functions', used by `completion-at-point'. (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-keyword) (add-to-list 'completion-at-point-functions #'cape-symbol) ;;(add-to-list 'completion-at-point-functions #'cape-history) )
18. Evil
(use-package evil :init (setq evil-want-integration t) (setq evil-want-keybinding nil) (setq evil-want-C-u-scroll t) (setq evil-want-C-i-jump nil) (setq evil-emacs-state-cursor '("#b7c63f" bar)) (setq evil-normal-state-cursor '("#3faec6" bar)) (setq evil-insert-state-cursor '("#3fabc6" bar)) (setq evil-undo-system 'undo-tree) :config (evil-mode 1) (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) ; alternative C-x C-s (define-key evil-normal-state-map (kbd ",w") 'save-buffer) ; alternative C-w c (define-key evil-normal-state-map (kbd ",q") 'evil-window-delete) ; (evil-normal-state-map C-r) ;; Use visual line motions even outside of visual-line-mode buffers (evil-global-set-key 'motion "j" 'evil-next-visual-line) (evil-global-set-key 'motion "k" 'evil-previous-visual-line) (evil-set-initial-state 'messages-buffer-mode 'normal) (evil-set-initial-state 'dashboard-mode 'normal)) (use-package evil-collection :after evil :config (evil-collection-init))
18.1. Evil Nerd commenter
(use-package evil-nerd-commenter) (define-key evil-normal-state-map (kbd ", c SPC") 'evilnc-comment-or-uncomment-lines)
18.2. ein
(use-package ein) (use-package evil-numbers) (define-key evil-normal-state-map (kbd ", a") 'evil-numbers/inc-at-pt) (define-key evil-normal-state-map (kbd ", x") 'evil-numbers/dec-at-pt) ;;(require 'evil-numbers) ;;(global-set-key (kbd "c-c +") 'evil-numbers/inc-at-pt) ;;(global-set-key (kbd "c-c -") 'evil-numbers/dec-at-pt) ;;(global-set-key (kbd "c-c c-+") 'evil-numbers/inc-at-pt-incremental) ;;(global-set-key (kbd "c-c c--") 'evil-numbers/dec-at-pt-incremental)
19. tab-bar-mode
(setq tab-bar-new-tab-choice "*scratch*" tab-bar-close-button-show nil )
20. Git
20.1. magit
(use-package magit :custom (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; (use-package evil-magit ; :after magit)
20.2. magit delta
- https://github.com/dandavison/magit-delta
- no hook until -> https://github.com/dandavison/magit-delta/issues/9
(use-package magit-delta :straight t ) ;; :hook (magit-mode . magit-delta-mode))
20.3. magit todo's
(use-package magit-todos :straight t :hook (magit-mode . magit-todos-mode))
20.4. Git gutter
(use-package git-gutter :straight t :defer 0.3 :diminish :init (global-git-gutter-mode +1))
21. Org-Mode
21.1. Base org config
21.1.1. org setup helper function
(defun efs/org-mode-setup () (org-indent-mode) (variable-pitch-mode 1) (visual-line-mode 1) (flyspell-mode 1) ) (defun efs/org-font-setup () ;; Replace list hyphen with dot (font-lock-add-keywords 'org-mode '(("^ *\\([-]\\) " (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) ;; Set faces for heading levels (dolist (face '((org-level-1 . 1.2) (org-level-2 . 1.1) (org-level-3 . 1.05) (org-level-4 . 1.0) (org-level-5 . 1.1) (org-level-6 . 1.1) (org-level-7 . 1.1) (org-level-8 . 1.1))) (set-face-attribute (car face) nil :font "mononoki" :weight 'regular :height (cdr face))) ;; Ensure that anything that should be fixed-pitch in Org files appears that way (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch) (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) ;(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
21.1.2. main org
(use-package org :straight (:type built-in) :hook (org-mode . efs/org-mode-setup) :config (setq org-ellipsis " ⤵") (setq org-hide-emphasis-markers t) (setq org-emphasis-alist '(("*" bold) ("/" italic) ("_" underline) ("=" org-verbatim verbatim) ("~" org-code verbatim) ("--" (:strike-through t)))) (setq org-agenda-start-with-log-mode t) (setq org-log-done 'time) (setq org-log-into-drawer t) ;; timer notifiication sound (setq org-clock-sound "~/.emacs.d/ping.wav") (setq org-agenda-files '("~/Dropbox/org-notes/Tasks.org" "~/Dropbox/org-notes/daily.org" "~/Dropbox/org-notes/todo.org" "~/Dropbox/org-notes/work/work_task.org" )) ;; "~/Dropbox/org-notes/Goals.org" ;; setting org for latex (setq org-latex-compiler "xelatex") (setq org-latex-listings 'minted org-latex-packages-alist '(("" "minted")) org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) (setq org-latex-with-hyperref nil) ;; (setq org-latex-minted-options '(("bgcolor" "bg"))) (setq org-format-latex-options '(:foreground default :background default :scale 3.0 :html-foreground "Black" :html-background "Transparent" :html-scale 3.0 :matchers ("begin" "$1" "$$" "\\(" "\\["))) (require 'org-habit) (add-to-list 'org-modules 'org-habit) (setq org-habit-graph-column 60) (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") (sequence "GOAL(g)" "|" "UPDATE(u)") (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) (setq org-tag-alist '((:startgroup . "Context") ("@errand" . ?E) ("@home" . ?H) ("@work" . ?W) (:endgroup) ("agenda" . ?a) ("planning" . ?p) ("publish" . ?P) ("batch" . ?b) ("note" . ?n) ("daily" . ?d) ("idea" . ?i))) (setq org-refile-targets '(("Archive.org" :maxlevel . 1) ("Tasks.org" :maxlevel . 1))) ;; Save Org buffers after refiling! (advice-add 'org-refile :after 'org-save-all-org-buffers) ;; Configure custom agenda views (setq org-agenda-custom-commands '(("d" "Dashboard" ((agenda "" ((org-deadline-warning-days 7))) (todo "NEXT" ((org-agenda-overriding-header "Next Tasks"))) (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) ("n" "Next Tasks" ((todo "NEXT" ((org-agenda-overriding-header "Next Tasks"))))) ("W" "Work Tasks" tags-todo "@work") ;; Low-effort next actions ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" ((org-agenda-overriding-header "Low Effort Tasks") (org-agenda-max-todos 20) (org-agenda-files org-agenda-files))) ("w" "Workflow Status" ((todo "WAIT" ((org-agenda-overriding-header "Waiting on External") (org-agenda-files org-agenda-files))) (todo "REVIEW" ((org-agenda-overriding-header "In Review") (org-agenda-files org-agenda-files))) (todo "PLAN" ((org-agenda-overriding-header "In Planning") (org-agenda-todo-list-sublevels nil) (org-agenda-files org-agenda-files))) (todo "BACKLOG" ((org-agenda-overriding-header "Project Backlog") (org-agenda-todo-list-sublevels nil) (org-agenda-files org-agenda-files))) (todo "READY" ((org-agenda-overriding-header "Ready for Work") (org-agenda-files org-agenda-files))) (todo "ACTIVE" ((org-agenda-overriding-header "Active Projects") (org-agenda-files org-agenda-files))) (todo "COMPLETED" ((org-agenda-overriding-header "Completed Projects") (org-agenda-files org-agenda-files))) (todo "CANC" ((org-agenda-overriding-header "Cancelled Projects") (org-agenda-files org-agenda-files))))))) (setq org-capture-templates `(("t" "Tasks / Projects") ("tt" "Task" entry (file+olp "~/Dropbox/org-notes/Tasks.org" "Inbox") "* TODO %?\n %u\n %a\n" :empty-lines 1) ("d" "Today") ("dd" "Today" entry (file+olp "~/Dropbox/org-notes/todo.org" "Today") "* TODO %?\n %u\n %a\n" :empty-lines 1) ("i" "Ideas") ("ii" "Idea" entry (file+olp "~/Dropbox/org-notes/Ideas.org" "Ideas") "* TODO %?\n %u\n %a\n" :empty-lines 1) ("j" "Journal Entries") ("jj" "Journal" entry (file+olp+datetree "~/Dropbox/org-notes/Journal.org") "* %<%I:%M %p> - Journal :Journal:\n\n%?\n\n" ;; ,(dw/read-file-as-string "~/notes/templates/daily.org") :clock-in :clock-resume :empty-lines 1) ("jm" "Meeting" entry (file+olp+datetree " ~/Dropbox/org-notes/Journal.org") "* %<%I:%M %p> - %a :meetings:\n\n%?\n\n" :clock-in :clock-resume :empty-lines 1) ("w" "Workflows") ("we" "Checking Email" entry (file+olp+datetree "~/Dropbox/org-notes/Journal.org") "* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1) )) (define-key global-map (kbd "C-c j") (lambda () (interactive) (org-capture nil))) (define-key global-map (kbd "<f12>") (lambda () (interactive) (org-agenda nil))) (efs/org-font-setup))
21.2. Modern Org
(straight-use-package 'org-modern) (setq ;; Edit settings org-auto-align-tags nil org-tags-column 0 org-catch-invisible-edits 'show-and-error org-special-ctrl-a/e t org-insert-heading-respect-content t ;; Org styling, hide markup etc. org-hide-emphasis-markers t org-ellipsis "…" ;; Agenda styling org-agenda-block-separator ?─ org-agenda-time-grid '((daily today require-timed) (800 1000 1200 1400 1600 1800 2000) " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") org-agenda-current-time-string "⭠ now ─────────────────────────────────────────────────") (global-org-modern-mode)
21.3. Org Toc
toc-org will maintain a table of contents at the first heading that has a :TOC: tag.
(use-package toc-org :after org :hook (org-mode . toc-org-enable))
21.4. Org Bullets
(use-package org-bullets :after org :hook (org-mode . org-bullets-mode) :custom (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) (defun efs/org-mode-visual-fill () (setq visual-fill-column-width 100 visual-fill-column-center-text t) (visual-fill-column-mode 1)) (use-package visual-fill-column :hook (org-mode . efs/org-mode-visual-fill)) (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (python . t))) (setq org-confirm-babel-evaluate nil) ;; this is needed as of org 9.2 (require 'org-tempo) (add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("py1" . "src python :results output"))
21.5. Automatically tangle our config.org file when we save it
;; Automatically tangle our Emacs.org config file when we save it (defun efs/org-babel-tangle-config () (when (string-equal (buffer-file-name) (expand-file-name "~/.emacs.d/config.org")) ;; Dynamic scoping to the rescue (let ((org-confirm-babel-evaluate nil)) (org-babel-tangle)))) (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))
21.6. Org id
(require 'org-id) (setq org-id-link-to-org-use-id t)
22. Treemacs
(use-package treemacs :straight t :defer t :init (with-eval-after-load 'winum (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) :config (progn (treemacs-filewatch-mode t) (treemacs-fringe-indicator-mode 'always) (pcase (cons (not (null (executable-find "git"))) (not (null treemacs-python-executable))) (`(t . t) (treemacs-git-mode 'deferred)) (`(t . _) (treemacs-git-mode 'simple)))) :bind (:map global-map ("M-0" . treemacs-display-current-project-exclusively) ("C-x t 1" . treemacs-delete-other-windows) ("C-x t t" . treemacs) ("C-x t B" . treemacs-bookmark) ("C-x t C-t" . treemacs-find-file) ("C-x t M-t" . treemacs-find-tag))) (use-package treemacs-evil :after treemacs evil :straight t) (use-package treemacs-magit :after treemacs magit :straight t) (use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode :after treemacs persp-mode;;or perspective vs. persp-mode :straight t :config (treemacs-set-scope-type 'perspectives))
23. term, vterm
(use-package term :config (setq explicit-shell-file-name "zsh") ;; change this to zsh, etc ;;(setq explicit-zsh-args '()) ;; use 'explicit-<shell>-args for shell-specific args ;; match the default bash shell prompt. update this if you have a custom prompt (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *")) (use-package eterm-256color :hook (term-mode . eterm-256color-mode)) (use-package vterm :ensure t :commands vterm :config (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") ;; set this to match your custom shell prompt (setq vterm-shell "zsh") ;; set this to customize the shell to launch (setq vterm-max-scrollback 10000))
24. Dired
(use-package dired :straight nil :commands (dired dired-jump) :bind ( ("C-x C-j" . dired-jump)) :custom ((dired-listing-switches "-agho --group-directories-first")) :config (evil-collection-define-key 'normal 'dired-mode-map "h" 'dired-single-up-directory "l" 'dired-single-buffer "j" 'dired-next-line)) (use-package dired-single) (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) (use-package dired-hide-dotfiles :hook (dired-mode . dired-hide-dotfiles-mode) :config (evil-collection-define-key 'normal 'dired-mode-map "H" 'dired-hide-dotfiles-mode))
24.1. Diredel
https://github.com/purcell/diredfl
(use-package diredfl :straight t :hook (dired-mode . diredfl-mode))
24.2. Dired Sidebar
(use-package dired-sidebar :straight t :commands (dired-sidebar-toggle-sidebar))
25. tree-sitter
;; (add-to-list tree-sitter ;; (treesit-install-language-grammar)
26. eglot
https://github.com/joaotavora/eglot
;; (add-to-list 'eglot-server-programs '( ;; (python-mode . ("pyright-langserver" "--stdio")) ;; ((rust-mode) "rust-analyzer") ;; ) ;; ) (add-hook 'python-mode 'eglot-ensure) (add-hook 'c-mode 'eglot-ensure) (add-hook 'c++-mode 'eglot-ensure) (add-hook 'rustic-mode 'eglot-ensure) ;; (setq eglot-autoshutdown t)
27. Programming Languages and Tools
27.1. Dockerfile
(use-package dockerfile-mode :delight "δ" :mode "Dockerfile\\'")
27.2. Latex/Ox Latex
(with-eval-after-load 'ox-latex (add-to-list 'org-latex-classes '("org-plain-latex" "\\documentclass{article} [NO-DEFAULT-PACKAGES] [PACKAGES] [EXTRA]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) (put 'upcase-region 'disabled nil)
27.3. Python
- [Pyenv Setup] https://realpython.com/intro-to-pyenv/#installing-pyenv
- [Python ls]
(use-package python-mode :straight nil :hook ((python-mode . outline-minor-mode) (python-mode . python-ts-mode) ) :custom ;; NOTE: Set these if Python 3 is called "python3" on your system! (python-shell-interpreter "python") ) (use-package pyvenv :config (setenv "WORKON_HOME" "~/.pyenv/versions") ;; (setenv "WORKON_HOME" "~/anaconda3/envs") (pyvenv-mode 1) (pyvenv-tracking-mode 1))
27.3.1. python-black
(straight-use-package '(python-black :after python))
27.4. Rust
(use-package rustic :mode ("\\.rs\\'" . rustic-mode) :config (setq rustic-lsp-client 'eglot rustic-analyzer-command '("~/.local/bin/rust-analyzer")))
27.5. YAML
(use-package yaml-mode :delight "ψ" :mode ("\\.\\(yaml\\|yml\\)\\'") :hook ((yaml-mode . yaml-ts-mode)) )
27.6. Common Lisp
;; (load (expand-file-name "~/.quicklisp/slime-helper.el")) ;; (setq inferior-lisp-program "sbcl")
28. Org download
(use-package org-download :after org :bind (:map org-mode-map (("s-Y" . org-download-screenshot) ("s-y" . org-download-yank))))
29. Ox-Hugo
(use-package ox-hugo :straight t :after ox)
30. Org roam
(use-package org-roam :straight t :custom (org-roam-directory (file-truename "~/Dropbox/org-notes/")) (org-roam-dailies-directory "journals/") (org-roam-file-extensions '("org")) :bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n f" . org-roam-node-find) ("C-c n g" . org-roam-graph) :map org-mode-map ("C-c n i" . org-roam-node-insert) ("C-c n I" . org-roam-insert-immediate) :map org-roam-dailies-map ("Y" . org-roam-dailies-capture-yesterday) ("T" . org-roam-dailies-capture-tomorrow) ("D" . org-roam-dailies-capture-today)) :bind-keymap ("C-c m d" . org-roam-dailies-map) :config (org-roam-setup) (require 'org-roam-dailies) ;; Ensure the keymap is available (setq org-roam-auto-replace-fuzzy-links nil) (setq org-roam-completion-everywhere t) (setq org-roam-prefer-id-links t) (setq org-roam-graph-exclude-matcher '("pages" "journals")) (setq org-roam-capture-templates '(("d" "default" plain (file "~/Dropbox/org-notes/templates/plainTemplate.org") :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" ":PROPERTIES:\n:SSOR: ignore \n:END:\n#+title: ${title} \n#+date: %(format-time-string \"%Y-%m-%d %H:%M\") \n") :unnarrowed t) ("b" "book" plain (file "~/Dropbox/org-notes/templates/plainTemplate.org") :if-new (file+head "book/%<%Y%m%d%H%M%S>-${slug}.org" ":PROPERTIES:\n:SSOR: ignore \n:END:\n#+title: ${title} \n#+date: %(format-time-string \"%Y-%m-%d %H:%M\") \n") :unnarrowed t) ("p" "project journal" plain (file "~/Dropbox/org-notes/templates/plainTemplate.org") :if-new (file+head "p_journals/%<%Y%m%d%H%M%S>-${slug}.org" ":PROPERTIES:\n:SSOR: ignore \n:END:\n#+title: ${title} \n#+date: %(format-time-string \"%Y-%m-%d %H:%M\") \n") :unnarrowed t) ("w" "work" plain (file "~/Dropbox/org-notes/templates/workTemplate.org") :if-new (file+head "wrok/%<%Y%m%d%H%M%S>-${slug}.org" ":PROPERTIES:\n:SSOR: ignore \n:END:\n#+title: ${title} \n#+date: %(format-time-string \"%Y-%m-%d %H:%M\") \n") :unnarrowed t))) (setq org-roam-dailies-capture-templates '(("d" "default" entry "** %(format-time-string \"<%Y-%m-%d %H:%M>\") %?" :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n#+STARTUP: content\n")))) ;; Org-roam interface ;; the directory of the node (cl-defmethod org-roam-node-directories ((node org-roam-node)) (if-let ((dirs (file-name-directory (file-relative-name (org-roam-node-file node) org-roam-directory)))) (format "(%s)" (car (f-split dirs))) "")) ;; backlinks count (cl-defmethod org-roam-node-backlinkscount ((node org-roam-node)) (let* ((count (caar (org-roam-db-query [:select (funcall count source) :from links :where (= dest $s1) :and (= type "id")] (org-roam-node-id node))))) (format "[%d]" count))) ;; 1 title tags (setq org-roam-node-display-template "${backlinkscount:4} ${directories:15} ${title:80} ${tags:60}") ) (setq org-roam-v2-ack t) ;; for org-roam-buffer-toggle (add-to-list 'display-buffer-alist '(("\\*org-roam\\*" (display-buffer-in-direction) (direction . right) (window-width . 0.23) (window-height . fit-window-to-buffer))))
30.1. Org roam ui
(use-package org-roam-ui :straight (:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out")) :after org-roam ;; 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 nil))
30.1.1. simple httpd
;; org roam ui (straight-use-package 'simple-httpd)
31. Org-roam-bibtex
(use-package org-roam-bibtex :straight t :after (org-roam) :hook (org-roam-mode . org-roam-bibtex-mode) :config (require 'org-ref))
32. Org transclusion
(use-package org-transclusion :straight '(org-transclusion :host github :repo "nobiot/org-transclusion" :branch "main" :files ("*.el")) :after org :bind (:map global-map (("<f10>" . #'org-transclusion-add) ("C-c n t" . #'org-transclusion-mode) )))
33. Org Wild Notifier
(use-package org-wild-notifier :ensure t :init (org-wild-notifier-mode 1) :custom (alert-default-style 'libnotify) (org-wild-notifier-alert time '(1 5 30)) (org-wild-notifier-keyword-whitelist '("TODO" "NEXT")) (org-wild-notifier-alert-times-property "WILD_NOTIFY") (org-wild-notifier-notification-title "Org Alert!")) (setq alert-fade-time 30)
34. Pdf-tools
(use-package pdf-tools :pin manual ;; manually update :straight t :config ;; initialise (pdf-tools-install) ;; open pdfs scaled to fit page (setq-default pdf-view-display-size 'fit-page) ;; automatically annotate highlights (setq pdf-annot-activate-created-annotations t) ;; use normal isearch (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward))
35. nov.el
(straight-use-package 'nov\.el)
36. MPC and Music/emms
(setq mpc-browser-tags '(Filename) mpc-host "0.0.0.0:6900" mpc-songs-format "%-20{Artist} %26{Title} %40{Album} %4{Time}") (global-set-key (kbd "C-c C-p") 'mpc-play-at-point) ;; song_columns_list_format = "(2)[magenta]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"
36.1. emms
(use-package emms :straight t :ensure t :config (require 'emms-setup) (require 'emms-player-mpd) (emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work (setq emms-seek-seconds 5) (setq emms-player-list '(emms-player-mpd)) (setq emms-info-functions '(emms-info-mpd)) (setq emms-player-mpd-server-name "0.0.0.0") (setq emms-player-mpd-server-port "6900") :bind ("<f5>" . emms-previous) ("<f7>" . emms-next) ("<f6>" . emms-pause) ) (setq emms-player-mpd-music-directory "~/Music/")
37. Speed-Type
(straight-use-package 'speed-type)
Executing M-x speed-type-text will start the typing exercise.
38. bibliography
38.1. helm-bibtex
(straight-use-package 'helm-bibtex)
38.2. setting up
(setq bibtex-completion-notes-path "~/Dropbox/org-notes/paper_notes/" bibtex-completion-bibliography "~/Dropbox/org-notes/bib/zotBiB.bib" bibtex-completion-pdf-field "file" bibtex-completion-notes-template-multiple-files(concat "#+TITLE: ${title}\n" "#+ROAM_KEY: cite:${=key=}\n" "* TODO Notes\n" ":PROPERTIES:\n" ":Custom_ID: ${=key=}\n" ":NOTER_DOCUMENT: %^{file}\n" ":AUTHOR: ${author-abbrev}\n" ":JOURNAL: ${journaltitle}\n" ":DATE: ${date}\n" ":YEAR: ${year}\n" ":DOI: ${doi}\n" ":URL: ${url}\n" ":END:\n\n" ) )
39. org calfw
https://github.com/kiwanami/emacs-calfw
(use-package calfw :straight (:host github :repo "kiwanami/emacs-calfw") :config (with-eval-after-load 'calfw (use-package calfw-org :straight (:host github :repo "kiwanami/emacs-calfw")) (use-package calfw-cal :straight (:host github :repo "kiwanami/emacs-calfw")))) (defun my-open-calendar () (interactive) (cfw:open-calendar-buffer :contents-sources (list (cfw:org-create-source "Green") ; orgmode source (cfw:cal-create-source "Orange") ; diary source )))
40. org cite
(setq org-cite-global-bibliography '("~/Dropbox/org-notes/bib/zotBiB.bib"))
41. Org ref
(straight-use-package 'org-ref)
41.1. Org ref and helm bibtex
(require 'org-ref-helm)
42. org-noter
(use-package org-noter :straight t ;; (:host github :repo "dmitrym0/org-noter-plus-djvu" :branch "master") :after (:any org pdf-view) :config (setq ;; The WM can handle splits org-noter-notes-window-location 'other-frame ;; Please stop opening frames org-noter-always-create-frame nil ;; I want to see the whole file org-noter-hide-other nil org-noter-default-notes-file-names '("~/Dropbox/org-notes/org-noter/Notes.org") ;; Everything is relative to the main notes file org-noter-notes-search-path '("~/Dropbox/org-notes/paper_notes/" "~/Dropbox/org-notes/book/") ) )
42.0.1. setting up other package
;; (add-to-list 'load-path "~/.emacs.d/straight/repos/org-noter-plus-djvu/other") ;; (add-to-list 'load-path "~/.emacs.d/straight/repos/org-noter-plus-djvu/modules") ;; (require 'org-noter-nov) ;; (require 'org-noter-pdf) ;; (require 'org-noter-nov-overlay)
43. org-fc
;; (straight-use-package ;; '(org-fc ;; :type git :repo "https://git.sr.ht/~l3kn/org-fc" ;; :files (:defaults "awk" "demo.org") ;; :after org ;; :custom (org-fc-directories '("~/Dropbox/org-notes/orgfc/")) ;; :config ;; (require 'org-fc-hydra)))
44. yasnippet
- Project Repo -> https://github.com/joaotavora/yasnippet
- Collection of snippets -> https://github.com/AndreaCrotti/yasnippet-snippets
(straight-use-package 'yasnippet) (setq yas-snippet-dirs '("~/Desktop/emacs_config/snippets" ;; personal snippets )) (yas-global-mode 1) ;; tetsst
45. Ledger
(use-package ledger-mode :straight t :ensure t :init (setq ledger-clear-whole-transactions 1) :config (add-to-list 'evil-emacs-state-modes 'ledger-report-mode) :mode "\\.dat\\'")
46. Annotate.el
(straight-use-package 'annotate\.el)
47. ripgrep | deadgrep
- https://github.com/BurntSushi/ripgrep#installation
- https://github.com/nlamirault/ripgrep.el
- https://github.com/Wilfred/deadgrep
(straight-use-package 'deadgrep)
48. highlight indent guides
https://github.com/DarthFennec/highlight-indent-guides
(straight-use-package 'highlight-indent-guides) (add-hook 'prog-mode-hook 'highlight-indent-guides-mode) (setq highlight-indent-guides-method 'bitmap)
49. hl-line
(straight-use-package 'hl-line) ;; (set-face-background 'hl-line "#e7e2ef") (add-hook 'prog-mode-hook 'hl-line-mode) (add-hook 'org-mode-hook 'hl-line-mode)
50. Simplify Yes/No Prompts
(fset 'yes-or-no-p 'y-or-n-p) (setq use-dialog-box nil)
51. Avy
https://github.com/abo-abo/avy
(use-package avy :straight t :custom (avy-timeout-seconds 0.5) (avy-style 'pre) :custom-face (avy-lead-face ((t (:background "#51afef" :foreground "#870000" :weight bold)))));
52. enable downcase C-x C-l
(put 'downcase-region 'disabled nil)
53. Leader keys and its bindings using Hydra
; stream 3 (use-package general :config (general-create-definer rune/leader-keys :keymaps '(normal insert visual emacs) :prefix "SPC" :global-prefix "C-SPC") )
53.1. scaling text
(defhydra hydra-text-scale (:timeout 2) "scale text" ("j" text-scale-increase "in") ("k" text-scale-decrease "out") ("f" nil "finished" :exit t))
53.2. avy search
(defhydra hydra-avy-search(:timeout 2) "avy search text" ("c" avy-goto-char-timer "goto char") ("l" avy-goto-line "goto line") ("r" avy-resume "resume old search") ("f" nil "finished" :exit t))
53.3. tab-bar-mode
(defhydra hydra-tab-switch(:timeout 2) "tab switch " ("h" tab-bar-switch-to-prev-tab "Previous tab") ("l" tab-bar-switch-to-next-tab"Next tab") ("s" tab-bar-switch-to-tab "Switch tab") ("2" tab-new "New tab") ("0" tab-close "Close tab") ("f" nil "finished" :exit t))
53.4. magit bindings
(defhydra hydra-magit(:timeout 1) "Magit" ("s" magit-status "Status") ("bc" magit-checkout "Checkout") ("db" magit-diff-buffer-file "Diff Buffer") ("f" nil "finished" :exit t))
53.5. ya-snippet bindings
(defhydra hydra-ya-snippet(:timeout 2) "scale text" ("n" yas-new-snippet "new") ("i" yas-insert-snippet "insert") ("v" yas-visit-snippet-file "visit") ("f" nil "finished" :exit t))
53.6. python-hydra-bindings
(defhydra hydra-python(:timeout 2) "scale text" ("b" python-black-buffer "python black buffer") ("f" nil "finished" :exit t))
53.7. bind all the keys
(rune/leader-keys "s" '(hydra-text-scale/body :which-key "Scale text") "t" '(hydra-tab-switch/body :which-key "Switch tab") "m" '(hydra-magit/body :which-key "Magit") "a" '(hydra-avy-search/body :which-key "Avy search") "p" '(hydra-python/body :which-key "Python") "y" '(hydra-ya-snippet/body :which-key "ya-snippet") "k" '(yank-from-kill-ring :which-key "Kill Ring"))
54. disable keys
;; (define-key dired-next-line (kbd "SPC") nil)
55. rainbow-mode
(straight-use-package 'rainbow-mode)
56. calendar customize
(setq calendar-week-start-day 1) (setq calendar-intermonth-text '(propertize (format "%2d" (car (calendar-iso-from-absolute (calendar-absolute-from-gregorian (list month day year))))) 'font-lock-face 'font-lock-warning-face)) (setq calendar-intermonth-header (propertize "Wk" ; or e.g. "KW" in Germany 'font-lock-face 'font-lock-keyword-face))
57. GPtel
(straight-use-package '(gptel :host github :repo "karthink/gptel")) (setq gptel--debug nil)
58. Gptel
(straight-use-package '(gptel :host github :repo "karthink/gptel") ) (setq gptel--debug t)
59. my custom function
59.1. for python setup
(defun py-setup () "Set up pyenv and run lsp command" (interactive) (call-interactively 'pyvenv-workon) (eglot))
59.2. for searching notes
(defun search-notes(search_term) "Search notes on a the notes directory using deadgrep" (interactive "MSearching on org-notes for text: ") (deadgrep search_term "~/Dropbox/org-notes/") ) (define-key global-map (kbd "C-c n s") 'search-notes)
59.3. consult and persp
(consult-customize consult--source-buffer :hidden t :default nil) (add-to-list 'consult-buffer-sources persp-consult-source)