commit 07fbb7893a52f3c8e5914073ab119523fb5f19cd Author: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Wed Aug 2 16:38:31 2023 -0500 Initial commit diff --git a/config.el b/config.el new file mode 100644 index 0000000..b8e40ce --- /dev/null +++ b/config.el @@ -0,0 +1,397 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + + +;;;; Misc settings + +(setq user-full-name "Jeffrey Serio" + user-mail-address "hyperreal@fedoraproject.org") + +;; See 'C-h v doom-font' for documentation and more examples of what they +;; accept. For example: +(when (string= (system-name) "moonshadow") + (setq doom-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 16) + doom-variable-pitch-font (font-spec :family "Rubik") + doom-unicode-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 16) + doom-big-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 16))) + +(when (string= (system-name) "evergloam") + (setq doom-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 18) + doom-variable-pitch-font (font-spec :family "Rubik") + doom-unicode-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 18) + doom-big-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 18))) + +;; 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 "") 'smart-beginning-of-line) +(global-set-key (kbd "") 'end-of-line) + +;; Autoformat on save +(setq +format-on-save-enabled-modes + '(emacs-lisp-mode + python-mode)) + +;; open Emacs in a maxmimized window +;; (add-to-list 'default-frame-alist '(fullscreen . maximized)) + + +;;;; Package: evil-nerd-commenter + +(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) + + +;;;; Package: org + +(setq org-modules '(org-protocol + org-agenda + org-annotate-file + 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") +(setq my-org-inbox-file "~/sync/org/inbox.org") + +;; support selecting lines by using shift +(setq org-support-shift-select t) + +;; org-mode tags +(setq org-tag-alist (quote (("@errand" . ?e) + ("@homemaking" . ?c) + ("@homelab" . ?h) + ("@desktop" . ?d) + ("@selfcare" . ?s) + ("@fedora" . ?f) + ("@refile" . ?r)))) + +;; org-mode keybindings +(with-eval-after-load 'org + (bind-key "C-M-w" 'append-next-kill org-mode-map) + (bind-key "C-TAB" 'org-cycle org-mode-map) + (bind-key "C-c v" 'org-show-todo-tree org-mode-map) + (bind-key "C-c C-r" 'org-refile org-mode-map) + (bind-key "C-c o" 'my-org-follow-entry-link org-mode-map) + (bind-key "C-c d" 'my-org-move-line-to-destination org-mode-map) + (bind-key "C-c t s" 'my-split-sentence-and-capitalize org-mode-map) + (bind-key "C-c t -" 'my-split-sentence-delete-word-and-capitalize org-mode-map) + (bind-key "C-c t d" 'my-delete-word-and-capitalize org-mode-map) + (bind-key "C-c C-p C-p" 'my-org-publish-maybe org-mode-map) + (bind-key "C-c C-r" 'my-org-refile-and-jump org-mode-map) + (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)) + +(with-eval-after-load 'org-agenda + (bind-key "i" 'org-agenda-clock-in org-agenda-mode-map)) + +(setq org-use-effective-time t) + +;; link org subtrees and navigate between them +(defun my-org-follow-entry-link () + "Follow the defined link for this entry." + (interactive) + (if (org-entry-get (point) "LINK") + (org-link-open-from-string (org-entry-get (point) "LINK")) + (org-open-at-point))) + +(defun my-org-link-projects (location) + "Add link properties between the current subtree and the one specified by +LOCATION." + (interactive + (list (let ((org-refile-use-cache nil)) + (org-refile-get-location "Location")))) + (let ((link1 (org-store-link nil)) link2) + (save-window-excursion + (org-refile 4 nil location) + (setq link2 (org-store-link nil)) + (org-set-property "LINK" link1)) + (org-set-property "LINK" link2))) + +;; 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)))) + +;; makes it easier to cut something and paste it elsewhere in the hierarchy +(with-eval-after-load 'org + (bind-key "C-c k" 'org-cut-subtree org-mode-map) + (setq org-yank-adjusted-subtrees t)) + +;; org-todo-keywords +(with-eval-after-load 'org + (setq org-todo-keywords + '((sequence + "STARTED(s)" + "TODO(t)" + "WAITING(w@/!)" + "IDEA(i)" + "SOMEDAY(.)" "BLOCKED(k@/!)" "|" "DONE(x!)" "CANCELLED(c)") + (sequence "PROJECT" "|" "DONE(x)") + (sequence "LEARN" "TRY" "|" "COMPLETE(x)"))) + + ;; catppuccin mocha palette + (setq org-todo-keyword-faces + '(("TODO" . (:foreground "#a6e3a1" :weight bold)) + ("IDEA" . (:foreground "#74c7ec" :weight bold)) + ("DONE" . (:foreground "#f38ba8" :weight bold)) + ("WAITING" . (:foreground "#f9e2af" :weight bold)) + ("SOMEDAY" . (:foreground "#f2cdcd" :weight bold))))) + +(setq org-log-done 'time) + + +;; ;; Package: org-roam + +(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) + ("c" "recipe" plain + "%?" + :if-new (file+head "recipes/${title}.org" + "#+title: ${title}\n#+filetags: :recipe:\n") + :immediate-finish t + :unnarrowed t))) + +;; create the property "type" on my nodes +(cl-defmethod org-roam-node-type ((node org-roam-node)) + "Return the TYPE of NODE." + (condition-case nil + (file-name-nondirectory + (directory-file-name + (file-name-directory + (file-relative-name (org-roam-node-file node) org-roam-directory)))) + (error ""))) + +;; modify the display template to show the node "type" +(setq org-roam-node-display-template + (concat "${type:15} ${title:*} " (propertize "${tags:10}" 'face 'org-tag))) + +;; 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) + ("c" "Calendar" entry (file "~/sync/org/calendar.org") + "* 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 + :immediate-finish t) + ("s" "Slipbox" entry (file "~/sync/org-roam/inbox.org") + "* %?\n"))) + +(defun hyperreal/org-capture-slipbox () + (interactive) + (org-capture nil "s")) + + +;;;; Package: python-mode + +;; 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) + + +;;;; Package: go-mode + +;; 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) + + +;;;; Package: yasnippet + +;; Popup rule for yasnippet +(defun yas-popup-isearch-prompt (prompt choices &optional display-fn) + (when (featurep 'popup) + (popup-menu* + (mapcar + (lambda (choice) + (popup-make-item + (or (and display-fn (funcall display-fn choice)) + choice) + :value choice)) + choices) + :prompt prompt + ;; start isearch mode immediately + :isearch t + ))) +(setq yas-prompt-functions '(yas-popup-isearch-prompt yas-maybe-ido-prompt yas-completing-prompt yas-no-prompt)) + + +;;;; Package: nov.el, nov-xwidget + +(setq nov-variable-pitch nil) + + +;;;; Package: dired + +(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)) + + +;;;; Package: elfeed + +(elfeed-protocol-enable) +(run-with-idle-timer (* 15 60) t #'elfeed-update) +(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`")))) + + +;;;; Package: dictionary +(global-set-key (kbd "C-c l") #'dictionary-lookup-definition) +(setq dictionary-server "dict.org") + + +;;;; Package: undo-tree + +(use-package undo-tree + :diminish undo-tree-mode + :config + (progn + (global-undo-tree-mode) + (setq undo-tree-visualizer-timestamps t) + (setq undo-tree-visualizer-diff t) + (setq undo-tree-history-directory-alist '(("." . "~/sync/emacs/backups/undo-tree"))))) diff --git a/init.el b/init.el new file mode 100644 index 0000000..4d24083 --- /dev/null +++ b/init.el @@ -0,0 +1,194 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a link to Doom's Module Index where all +;; of our modules are listed, including what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;bidi ; (tfel ot) thgir etirw uoy gnipleh + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;; helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji +unicode) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + hydra + ;;indent-guides ; highlighted indent columns + ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + ;;unicode ; extended unicode support for various languages + (vc-gutter +pretty) ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + ;;(evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + (format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;ibuffer ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp ; M-x vscode + magit ; a git porcelain for Emacs + make ; run make tasks from Emacs + pass ; password manager for nerds + pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + tree-sitter ; syntax and parsing, sitting in a tree... + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + ;;(cc +lsp) ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;dhall + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + (go +lsp) ; the hipster dialect + ;;(graphql +lsp) ; Give queries a REST + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + ;;(java +lsp) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;; nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + (org +pretty) ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + ;; (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;; (mu4e +org) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + rss ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/packages.el b/packages.el new file mode 100644 index 0000000..162a54c --- /dev/null +++ b/packages.el @@ -0,0 +1,31 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; 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'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) +(package! autothemer) +(package! catppuccin-theme) +(package! elpher) +(package! gemini :recipe + (:host nil :repo "https://git.carcosa.net/jmcbray/gemini.el")) +(package! python-docstring) +(package! importmagic) +(package! systemd) +(package! license-templates) +(package! shell-pop) +(package! fzf) +(package! evil-nerd-commenter) +(package! just-mode) +(package! justl) +(package! go-complete) +(package! nov) +(package! elfeed-protocol) +(package! elfeed-tube) +(package! elfeed-tube-mpv) +(package! undo-tree) +(package! org-roam)