2023-08-02 23:38:31 +02:00
|
|
|
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Misc settings
|
|
|
|
|
|
|
|
(setq user-full-name "Jeffrey Serio"
|
|
|
|
user-mail-address "hyperreal@fedoraproject.org")
|
|
|
|
|
2023-08-20 22:45:21 +02:00
|
|
|
(setq doom-user-dir "~/sync/doom/")
|
|
|
|
|
|
|
|
(after! projectile
|
|
|
|
(setq projectile-project-root-files-bottom-up
|
|
|
|
(remove ".git" projectile-project-root-files-bottom-up)))
|
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
;; This sets the frame dimensions and position on the screen when on moonshadow host.
|
|
|
|
;; Also sets the font size for moonshadow host.
|
2023-08-02 23:38:31 +02:00
|
|
|
(when (string= (system-name) "moonshadow")
|
2023-08-10 03:02:01 +02:00
|
|
|
(setq fontsize 18)
|
|
|
|
(setq default-frame-alist
|
|
|
|
'((height . 53)
|
|
|
|
(width . 154)
|
|
|
|
(left . 1720)
|
|
|
|
(top . 0)
|
|
|
|
(vertical-scroll-bars . nil)
|
|
|
|
(horizontal-scroll-bars . nil))))
|
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
;; This sets the frame to be full screen maximized on evergloam host.
|
|
|
|
;; Also sets the font size for evergloam host.
|
2023-08-02 23:38:31 +02:00
|
|
|
(when (string= (system-name) "evergloam")
|
2023-08-10 03:02:01 +02:00
|
|
|
(setq fontsize 18)
|
|
|
|
(add-to-list 'default-frame-alist '(fullscreen . maximized)))
|
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
;; Set fonts
|
|
|
|
(setq monofontfam "JetBrainsMono Nerd Font Mono")
|
|
|
|
(setq doom-font (font-spec :family monofontfam :size fontsize)
|
2023-08-10 03:02:01 +02:00
|
|
|
doom-variable-pitch-font (font-spec :family "Rubik")
|
2023-08-11 04:44:56 +02:00
|
|
|
doom-unicode-font (font-spec :family monofontfam :size fontsize)
|
|
|
|
doom-big-font (font-spec :family monofontfam :size fontsize))
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
;; Use catppuccin-mocha theme
|
|
|
|
(setq doom-theme 'catppuccin)
|
|
|
|
(setq catppuccin-flavor 'mocha)
|
|
|
|
|
|
|
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
|
|
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
|
|
|
(setq display-line-numbers-type 'relative)
|
|
|
|
|
|
|
|
;; Make vterm open in another window
|
|
|
|
(setq vterm-other-window 1)
|
|
|
|
|
|
|
|
;; Keybinding to kill-whole-line
|
|
|
|
(global-set-key (kbd "M-9") 'kill-whole-line)
|
|
|
|
|
|
|
|
;; Copy all or text selection
|
|
|
|
(defun xah-copy-all-or-region ()
|
|
|
|
"Put the whole buffer content to `kill-ring', or text selection if there's one.
|
|
|
|
Respects `narrow-to-region'.
|
|
|
|
URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html'
|
|
|
|
Version 2015-08-22"
|
|
|
|
(interactive)
|
|
|
|
(if (use-region-p)
|
|
|
|
(progn
|
|
|
|
(kill-new (buffer-substring (region-beginning) (region-end)))
|
|
|
|
(message "Text selection copied."))
|
|
|
|
(progn
|
|
|
|
(kill-new (buffer-string))
|
|
|
|
(message "Buffer content copied."))))
|
|
|
|
|
|
|
|
;; Cut all or text selection
|
|
|
|
(defun xah-cut-all-or-region ()
|
|
|
|
"Cut the whole buffer content to `kill-ring', or text selection if there's one.
|
|
|
|
Respects `narrow-to-region'.
|
|
|
|
URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html'
|
|
|
|
Version 2015-08-22"
|
|
|
|
(interactive)
|
|
|
|
(if (use-region-p)
|
|
|
|
(progn
|
|
|
|
(kill-new (buffer-substring (region-beginning) (region-end)))
|
|
|
|
(delete-region (region-beginning) (region-end)))
|
|
|
|
(progn
|
|
|
|
(kill-new (buffer-string))
|
|
|
|
(delete-region (point-min) (point-max)))))
|
|
|
|
|
|
|
|
;; open URL in Firefox
|
|
|
|
(defun browse-host-firefox (url &rest ignored)
|
|
|
|
"Browse URL with the host's Firefox using distrobox-exec."
|
|
|
|
(interactive "sURL: ")
|
|
|
|
(shell-command (concat "firefox " url)))
|
|
|
|
|
|
|
|
(setq browse-url-browser-function 'browse-host-firefox)
|
|
|
|
|
|
|
|
;; after copy Ctrl+c in Linux X11, you can paste by `yank' in emacs
|
|
|
|
(setq select-enable-clipboard t)
|
|
|
|
|
|
|
|
;; after mouse selection copy in X11, you can paste by `yank' in emacs
|
|
|
|
(setq select-enable-primary t)
|
|
|
|
|
|
|
|
;; set keybinding for paste
|
|
|
|
(global-set-key (kbd "C-S-V") #'clipboard-yank)
|
|
|
|
|
|
|
|
;; Smart home key
|
|
|
|
(defun smart-beginning-of-line ()
|
|
|
|
"Move point to first non-whitespace character or beginning-of-line.
|
|
|
|
|
|
|
|
Move point to the first non-whitespace character on this line.
|
|
|
|
If point was already at that position, move point to beginning of line."
|
|
|
|
(interactive "^")
|
|
|
|
(let ((oldpos (point)))
|
|
|
|
(back-to-indentation)
|
|
|
|
(and (= oldpos (point))
|
|
|
|
(beginning-of-line))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "<home>") 'smart-beginning-of-line)
|
|
|
|
(global-set-key (kbd "<end>") 'end-of-line)
|
|
|
|
|
|
|
|
;; Autoformat on save
|
|
|
|
(setq +format-on-save-enabled-modes
|
|
|
|
'(emacs-lisp-mode
|
|
|
|
python-mode))
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; evil-nerd-commenter
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
(global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)
|
|
|
|
(global-set-key (kbd "C-c l") 'evilnc-quick-comment-or-uncomment-to-the-line)
|
|
|
|
(global-set-key (kbd "C-c c") 'evilnc-copy-and-comment-lines)
|
|
|
|
(global-set-key (kbd "C-c p") 'evilnc-comment-or-uncomment-paragraphs)
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; org-mode
|
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))
|
2023-08-02 23:38:31 +02:00
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
(setq org-modules '(org-agenda
|
2023-08-02 23:38:31 +02:00
|
|
|
org-annotate-file
|
2023-08-11 04:44:56 +02:00
|
|
|
org-choose
|
2023-08-02 23:38:31 +02:00
|
|
|
org-collector
|
|
|
|
))
|
|
|
|
(eval-after-load 'org
|
|
|
|
'(org-load-modules-maybe t))
|
|
|
|
|
|
|
|
(setq org-directory "~/sync/org/")
|
|
|
|
(setq org-default-notes-file "~/sync/org/notes.org")
|
|
|
|
|
|
|
|
;; support selecting lines by using shift
|
|
|
|
(setq org-support-shift-select t)
|
|
|
|
|
|
|
|
;; org-mode tags
|
|
|
|
(setq org-tag-alist (quote (("@errand" . ?e)
|
2023-08-10 03:02:01 +02:00
|
|
|
("@homemaking" . ?m)
|
|
|
|
("@homelab" . ?l)
|
|
|
|
("@config" . ?c)
|
2023-08-02 23:38:31 +02:00
|
|
|
("@selfcare" . ?s)
|
|
|
|
("@fedora" . ?f)
|
2023-08-10 03:02:01 +02:00
|
|
|
("@techne" . ?t)
|
2023-08-02 23:38:31 +02:00
|
|
|
("@refile" . ?r))))
|
|
|
|
|
|
|
|
;; org-mode keybindings
|
|
|
|
(with-eval-after-load 'org
|
2023-08-10 03:02:01 +02:00
|
|
|
(bind-key "C-c $" 'org-archive-subtree)
|
2023-08-02 23:38:31 +02:00
|
|
|
(bind-key "C-c r" 'org-capture)
|
|
|
|
(bind-key "C-c R" 'org-roam-capture)
|
|
|
|
(bind-key "C-c a" 'org-agenda)
|
|
|
|
(bind-key "C-c l" 'org-store-link)
|
|
|
|
(bind-key "C-c L" 'org-insert-link-global)
|
|
|
|
(bind-key "C-c O" 'org-open-at-point-global))
|
|
|
|
|
|
|
|
(setq org-use-effective-time t)
|
|
|
|
|
|
|
|
;; org-refile
|
|
|
|
(setq org-reverse-note-order t) ; new notes prepended
|
|
|
|
(setq org-refile-use-outline-path 'file)
|
|
|
|
(setq org-outline-path-complete-in-steps nil)
|
|
|
|
(setq org-refile-allow-creating-parent-nodes 'confirm)
|
|
|
|
(setq org-refile-use-cache nil)
|
|
|
|
(setq org-blank-before-new-entry '((heading . t) (plain-list-item . t)))
|
|
|
|
|
|
|
|
(setq org-refile-targets
|
|
|
|
`((("~/sync/org/inbox.org"
|
|
|
|
"~/sync/org/calendar.org"
|
|
|
|
"~/sync/org/computing.org"
|
|
|
|
"~/sync/org/general.org"
|
|
|
|
"~/sync/org/orders.org"
|
|
|
|
"~/sync/org/notes.org"
|
|
|
|
"~/sync/org/reading.org"
|
|
|
|
"~/sync/org/grocery.org")
|
|
|
|
. (:maxlevel .5))))
|
|
|
|
|
|
|
|
;; org-todo-keywords
|
|
|
|
(with-eval-after-load 'org
|
|
|
|
(setq org-todo-keywords
|
|
|
|
'((sequence
|
|
|
|
"STARTED(s)"
|
|
|
|
"TODO(t)"
|
|
|
|
"WAITING(w@/!)"
|
|
|
|
"IDEA(i)"
|
2023-08-11 04:44:56 +02:00
|
|
|
"SOMEDAY(.)"
|
|
|
|
"BLOCKED(k@/!)"
|
|
|
|
"|"
|
|
|
|
"DONE(x!)"
|
|
|
|
"CANCELLED(c)")
|
2023-08-02 23:38:31 +02:00
|
|
|
(sequence "PROJECT" "|" "DONE(x)")
|
2023-08-11 04:44:56 +02:00
|
|
|
(sequence "MAYBE(,0)" "CHOSEN(c,+)" "|" "REJECTED")))
|
2023-08-02 23:38:31 +02:00
|
|
|
|
2023-08-11 04:44:56 +02:00
|
|
|
;; catppuccin palette
|
2023-08-02 23:38:31 +02:00
|
|
|
(setq org-todo-keyword-faces
|
2023-08-11 04:44:56 +02:00
|
|
|
'(("STARTED" . (:foreground "#a6d189" :weight bold))
|
|
|
|
("TODO" . (:foreground "#a6e3a1" :weight bold))
|
|
|
|
("WAITING" . (:foreground "#f9e2af" :weight bold))
|
2023-08-02 23:38:31 +02:00
|
|
|
("IDEA" . (:foreground "#74c7ec" :weight bold))
|
2023-08-11 04:44:56 +02:00
|
|
|
("SOMEDAY" . (:foreground "#f2cdcd" :weight bold))
|
|
|
|
("BLOCKED" . (:foreground "#c6d0f5" :weight bold))
|
2023-08-02 23:38:31 +02:00
|
|
|
("DONE" . (:foreground "#f38ba8" :weight bold))
|
2023-08-11 04:44:56 +02:00
|
|
|
("CANCELLED" . (:foreground "#e78284" :weight bold))
|
|
|
|
("MAYBE" . (:foreground "#c6d0f5" :weight bold))
|
|
|
|
("CHOSEN" . (:foreground "#89b4fa" :weight bold))
|
|
|
|
("REJECTED" . (:foreground "#d20f39" :weight bold)))))
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
(setq org-log-done 'time)
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; org-roam
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
(setq org-roam-directory "~/sync/org-roam")
|
|
|
|
(org-roam-db-autosync-mode)
|
|
|
|
|
|
|
|
;; org-roam-capture-template
|
|
|
|
(setq org-roam-capture-templates
|
|
|
|
'(("m" "main" plain
|
|
|
|
"%?"
|
|
|
|
:if-new (file+head "main/${slug}.org"
|
|
|
|
"#+title: ${title}\n")
|
|
|
|
:immediate-finish t
|
|
|
|
:unnarrowed t)
|
|
|
|
("r" "reference" plain
|
|
|
|
"%?"
|
|
|
|
:if-new (file+head "reference/${title}.org"
|
|
|
|
"#+title: ${title}\n")
|
|
|
|
:immediate-finish t
|
|
|
|
:unnarrowed t)
|
|
|
|
("s" "self" plain
|
|
|
|
"%?"
|
|
|
|
:if-new (file+head "self/${slug}.org"
|
|
|
|
"#+title: ${title}\n#+filetags: :self:\n")
|
|
|
|
:unnarrowed t)
|
|
|
|
("S" "self-entry" entry
|
|
|
|
"* %U\n%?"
|
|
|
|
:target (file "self/${slug}.org")
|
|
|
|
:empty-lines 1
|
|
|
|
:unnarrowed t)
|
2023-08-10 03:02:01 +02:00
|
|
|
("c" "cookbook" plain
|
|
|
|
"* %^{Recipe title}\n :PROPERTIES:\n :source-url:%?\n :servings:\n :prep-time:\n :cook-time:\n :ready-in:\n :END:\n** Ingredients\n \n** Directions\n\n"
|
|
|
|
:if-new (file "recipes/${title}.org")
|
2023-08-02 23:38:31 +02:00
|
|
|
:unnarrowed t)))
|
|
|
|
|
|
|
|
;; org-capture templates
|
|
|
|
(setq org-capture-templates
|
|
|
|
'(("t" "Todo" entry (file "~/sync/org/inbox.org")
|
|
|
|
"* TODO %?"
|
|
|
|
:empty-lines-before 1
|
|
|
|
:unnarrowed t
|
|
|
|
:immediate-finish t)
|
2023-08-10 03:02:01 +02:00
|
|
|
("d" "Calendar" entry (file "~/sync/org/calendar.org")
|
2023-08-02 23:38:31 +02:00
|
|
|
"* TODO %?"
|
|
|
|
:empty-lines-before 1
|
|
|
|
:unnarrowed t)
|
|
|
|
("j" "Journal" entry (file+olp+datetree "~/sync/org/journal.org")
|
|
|
|
"* %U\n%?"
|
|
|
|
:empty-lines-before 1
|
|
|
|
:unnarrowed t)
|
|
|
|
("r" "Reading" entry (file "~/sync/org/reading.org")
|
|
|
|
"* %a\n%U\n%^{PROMPT}"
|
|
|
|
:empty-lines-before 1
|
|
|
|
:unnarrowed t
|
2023-08-10 03:02:01 +02:00
|
|
|
:immediate-finish t)))
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
(defun hyperreal/org-capture-slipbox ()
|
|
|
|
(interactive)
|
|
|
|
(org-capture nil "s"))
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; python-mode
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
;; Set bpython as Python shell interpreter
|
|
|
|
(add-hook! python-mode-hook
|
|
|
|
(setq python-shell-interpreter "bpython"))
|
|
|
|
|
|
|
|
;; Set black as Python formatter
|
|
|
|
(setq-hook! 'python-mode-hook +format-with 'black)
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; go-mode
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
;; completion for GoLang
|
|
|
|
(add-hook 'completion-at-point-functions 'go-complete-at-point)
|
|
|
|
|
|
|
|
;; Go - lsp-mode
|
|
|
|
(defun lsp-go-install-save-hooks ()
|
|
|
|
(add-hook 'before-save-hook #'lsp-format-buffer t t)
|
|
|
|
(add-hook 'before-save-hook #'lsp-organize-imports t t))
|
|
|
|
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
|
|
|
|
|
|
|
|
;; Start LSP Mode
|
|
|
|
(add-hook 'go-mode-hook #'lsp-deferred)
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; dired
|
2023-08-02 23:38:31 +02:00
|
|
|
|
|
|
|
(after! dired
|
|
|
|
(setq dired-listing-switches "-laGh1v --group-directories-first")
|
|
|
|
(setq dired-confirm-shell-command nil
|
|
|
|
dired-no-confirm t
|
|
|
|
dired-deletion-confirmer '(lambda (x) t)
|
|
|
|
dired-recursive-deletes 'always))
|
|
|
|
|
|
|
|
|
2023-08-20 22:45:21 +02:00
|
|
|
;;;; dictionary
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c l") #'dictionary-lookup-definition)
|
|
|
|
(setq dictionary-server "dict.org")
|
|
|
|
|
|
|
|
|
|
|
|
;;;; centaur-tabs
|
|
|
|
|
|
|
|
(global-set-key (kbd "s-{") 'centaur-tabs-switch-group)
|
|
|
|
(setq centaur-tabs-buffer-show-groups t)
|
|
|
|
|
|
|
|
(defun centaur-tabs-buffer-groups ()
|
|
|
|
"`centaur-tabs-buffer-groups' control buffers' group rules.
|
|
|
|
|
|
|
|
Group centaur-tabs with mode if buffer is derived from `eshell-mode'
|
|
|
|
`emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'
|
|
|
|
All buffer names starting with * will group to \"Emacs\".
|
|
|
|
Other buffer groups by `centaur-tabs-get-group-name' wit project name."
|
|
|
|
(list
|
|
|
|
(cond
|
|
|
|
((or (string-equal "*" (substring (buffer-name) 0 1))
|
|
|
|
(memq major-mode '(magit-process-mode
|
|
|
|
magit-status-mode
|
|
|
|
magit-diff-mode
|
|
|
|
magit-log-mode
|
|
|
|
magit-file-mode
|
|
|
|
magit-blob-mode
|
|
|
|
magit-blame-mode
|
|
|
|
)))
|
|
|
|
"Emacs")
|
|
|
|
((derived-mode-p 'prog-mode)
|
|
|
|
"Editing")
|
|
|
|
((derived-mode-p 'dired-mode)
|
|
|
|
"Dired")
|
|
|
|
((memq major-mode '(helpful-mode
|
|
|
|
help-mode))
|
|
|
|
"Help")
|
|
|
|
((memq major-mode '(org-mode
|
|
|
|
org-agenda-clockreport-mode
|
|
|
|
org-src-mode
|
|
|
|
org-agenda-mode
|
|
|
|
org-beamer-mode
|
|
|
|
org-indent-mode
|
|
|
|
org-bullets-mode
|
|
|
|
org-agenda-log-mode
|
|
|
|
diary-mode
|
|
|
|
org-roam-mode))
|
|
|
|
"OrgMode")
|
|
|
|
(t
|
|
|
|
(centaur-tabs-get-group-name (current-buffer))))))
|
|
|
|
|
|
|
|
;; prevent access to specified buffers
|
|
|
|
(defun centaur-tabs-hide-tab (x)
|
|
|
|
"Do not show given buffer in tabs."
|
|
|
|
(let ((name (format "%s" x)))
|
|
|
|
(or
|
|
|
|
;; Current window is not dedicated window.
|
|
|
|
(window-dedicated-p (selected-window))
|
|
|
|
|
|
|
|
;; Buffer name does not match blacklisted buffers.
|
|
|
|
(string-prefix-p "*epc" name)
|
|
|
|
(string-prefix-p "*Compile-Log*" name)
|
|
|
|
(string-prefix-p "*lsp" name)
|
|
|
|
(string-prefix-p "*tramp" name)
|
|
|
|
(string-prefix-p "*help" name)
|
|
|
|
(string-prefix-p "*Help" name)
|
|
|
|
|
|
|
|
;; Buffer is not a magit buffer.
|
|
|
|
(and (string-prefix-p "magit" name)
|
|
|
|
(not (file-name-extension name)))
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
2023-08-10 03:02:01 +02:00
|
|
|
;;;; elfeed
|
2023-08-02 23:38:31 +02:00
|
|
|
|
2023-08-20 22:45:21 +02:00
|
|
|
(elfeed-goodies/setup)
|
|
|
|
(setq elfeed-show-entry-switch 'pop-to-buffer-same-window)
|
|
|
|
(setq elfeed-protocol-enabled-protocols '(ttrss))
|
2023-08-02 23:38:31 +02:00
|
|
|
(elfeed-protocol-enable)
|
|
|
|
(setq elfeed-protocol-ttrss-maxsize 200)
|
|
|
|
(setq elfeed-feeds (list
|
|
|
|
(list "ttrss+https://hyperreal@rss.envs.net"
|
|
|
|
:password (shell-command-to-string "echo -n `pass show envs.net/ttrss`"))))
|