diff --git a/base.nix b/base.nix index 7c706c1..0f86e79 100644 --- a/base.nix +++ b/base.nix @@ -15,6 +15,24 @@ stylix = { enable = true; image = ./wallpaper.jpeg; + cursor = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + }; + fonts = { + monospace = { + package = pkgs.nerd-fonts.comic-shanns-mono; + name = "ComicShansMono Nerd Font Mono"; + }; + sansSerif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans"; + }; + serif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Serif"; + }; + }; }; sops = { defaultSopsFormat = "yaml"; diff --git a/dotfiles/doom/bookmarks b/dotfiles/doom/bookmarks new file mode 100644 index 0000000..97f9da7 --- /dev/null +++ b/dotfiles/doom/bookmarks @@ -0,0 +1,10 @@ +;;;; Emacs Bookmark Format Version 1;;;; -*- coding: utf-8-emacs; mode: lisp-data -*- +;;; This format is meant to be slightly human-readable; +;;; nevertheless, you probably don't want to edit it. +;;; -*- End Of Bookmark File Format Version Stamp -*- +(("org-capture-last-stored" + (filename . "~/Documents/Notes/20240518175854-egypt.org") + (front-context-string) + (rear-context-string . "\n#+title: Egypt\n") + (position . 83)) +) diff --git a/dotfiles/doom/config.el b/dotfiles/doom/config.el new file mode 100644 index 0000000..fb87e64 --- /dev/null +++ b/dotfiles/doom/config.el @@ -0,0 +1,502 @@ +(use-package + insert-esv + :init + (setq insert-esv-crossway-api-key "bb1872462ecc59624c7bb8ab36c9701ce2027cd1") + (setq insert-esv-include-short-copyright 'false) + (setq insert-esv-include-headings 'true) + (setq insert-esv-include-passage-horizontal-lines 'false) + (setq insert-esv-line-length '500) + :bind ("C-x C-e" . insert-esv-passage)) + +(setq bookmark-default-file "~/.config/doom/bookmarks") + +(map! :leader + (:prefix ("b". "buffer") + :desc "List bookmarks" "L" #'list-bookmarks + :desc "Set bookmark" "m" #'bookmark-set + :desc "Delete bookmark" "M" #'bookmark-set + :desc "Save current bookmarks to bookmark file" "w" #'bookmark-save)) + +(global-auto-revert-mode 1) +(setq global-auto-revert-non-file-buffers t) + +(evil-define-key 'normal ibuffer-mode-map + (kbd "f c") 'ibuffer-filter-by-content + (kbd "f d") 'ibuffer-filter-by-directory + (kbd "f f") 'ibuffer-filter-by-filename + (kbd "f m") 'ibuffer-filter-by-mode + (kbd "f n") 'ibuffer-filter-by-name + (kbd "f x") 'ibuffer-filter-disable + (kbd "g h") 'ibuffer-do-kill-lines + (kbd "g H") 'ibuffer-update) + +(setq doom-fallback-buffer "*dashboard*") + +(map! :leader + (:prefix ("d" . "dired") + :desc "Open dired" "d" #'dired + :desc "Dired jump to current" "j" #'dired-jump) + (:after dired + (:map dired-mode-map + :desc "Peep-dired image previews" "d p" #'peep-dired + :desc "Dired view file" "d v" #'dired-view-file))) + +(evil-define-key 'normal dired-mode-map + (kbd "M-RET") 'dired-display-file + (kbd "h") 'dired-up-directory + (kbd "l") 'dired-open-file ; use dired-find-file instead of dired-open. + (kbd "m") 'dired-mark + (kbd "t") 'dired-toggle-marks + (kbd "u") 'dired-unmark + (kbd "C") 'dired-do-copy + (kbd "D") 'dired-do-delete + (kbd "J") 'dired-goto-file + (kbd "M") 'dired-do-chmod + (kbd "O") 'dired-do-chown + (kbd "P") 'dired-do-print + (kbd "R") 'dired-do-rename + (kbd "T") 'dired-do-touch + (kbd "Y") 'dired-copy-filenamecopy-filename-as-kill ; copies filename to kill ring. + (kbd "Z") 'dired-do-compress + (kbd "+") 'dired-create-directory + (kbd "-") 'dired-do-kill-lines + (kbd "% l") 'dired-downcase + (kbd "% m") 'dired-mark-files-regexp + (kbd "% u") 'dired-upcase + (kbd "* %") 'dired-mark-files-regexp + (kbd "* .") 'dired-mark-extension + (kbd "* /") 'dired-mark-directories + (kbd "; d") 'epa-dired-do-decrypt + (kbd "; e") 'epa-dired-do-encrypt) +;; (kbd "Q") 'quick-preview-at-point) ;; previews with sushi +;; Get file icons in dired +;; (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) +;; With dired-open plugin, you can launch external programs for certain extensions +;; For example, I set all .png files to open in 'sxiv' and all .mp4 files to open in 'mpv' +(setq dired-open-extensions '(("gif" . "eog") + ("jpg" . "eog") + ("png" . "eog") + ("mkv" . "celluloid") + ("mp4" . "celluloid"))) + +(evil-define-key 'normal peep-dired-mode-map + (kbd "j") 'peep-dired-next-file + (kbd "k") 'peep-dired-prev-file) +(add-hook 'peep-dired-hook 'evil-normalize-keymaps) + +(setq delete-by-moving-to-trash t + trash-directory "~/.local/share/Trash/files/") + +;; (diredp-toggle-find-file-reuse-dir 1) +(setq dired-kill-when-opening-new-dired-buffer 1) + +(use-package! base16-stylix-theme) +(require 'base16-stylix-theme) +(setq doom-theme 'base16-stylix) +;; (setq doom-theme 'doom-opera-light) +;; ;; (setq doom-theme 'doom-dark+) +;; (map! :leader +;; :desc "Load new theme" "h t" #'counsel-load-theme) + +;; (emms-all) +;; (emms-default-players) +;; (emms-mode-line 1) +;; (emms-playing-time 1) +;; (setq emms-source-file-default-directory "~/Music/" +;; emms-playlist-buffer-name "*Music*" +;; emms-info-asynchronously t +;; emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find) +;; (map! :leader +;; (:prefix ("m p d". "EMMS audio player") +;; :desc "Go to emms playlist" "a" #'emms-playlist-mode-go +;; :desc "Emms pause track" "x" #'emms-pause +;; :desc "Emms stop track" "s" #'emms-stop +;; :desc "Emms play previous track" "p" #'emms-previous +;; :desc "Emms play next track" "n" #'emms-next)) + +(map! :leader + (:prefix ("e". "evaluate/EWW") + :desc "Evaluate elisp in buffer" "b" #'eval-buffer + :desc "Evaluate defun" "d" #'eval-defun + :desc "Evaluate elisp expression" "e" #'eval-expression + :desc "Evaluate last sexpression" "l" #'eval-last-sexp + :desc "Evaluate elisp in region" "r" #'eval-region)) + +;; (setq browse-url-browser-function 'eww-browse-url) +(map! :leader + :desc "Search web for text between BEG/END" + "s w" #'eww-search-words + (:prefix ("e" . "evaluate/EWW") + :desc "Eww web browser" "w" #'eww + :desc "Eww reload page" "R" #'eww-reload)) + +(setq doom-unicode-font "Symbola") +(setq doom-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 18) + doom-variable-pitch-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 18) + doom-big-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 22)) +(after! doom-themes + (setq doom-themes-enable-bold t + doom-themes-enable-italic t)) +(custom-set-faces! + '(bold :weight ultra-bold) + '(font-lock-comment-face :slant italic) + '(font-lock-keyword-face :slant italic)) + +(defun func/insert-todays-date (prefix) + (interactive "P") + (let ((format (cond + ((not prefix) "%Y-%m-%d") + ((equal prefix '(4)) "%A, %B %d, %Y")))) + (insert (format-time-string format)))) + +(require 'calendar) +(defun func/insert-any-date (date) + "Insert DATE using the current locale." + (interactive (list (calendar-read-date))) + (insert (calendar-date-string date))) + +(map! :leader + (:prefix ("i d" . "Insert date") + :desc "Insert any date" "a" #'func/insert-any-date + :desc "Insert todays date" "t" #'func/insert-todays-date)) + +(defun func/org-roam-capture-task () + (interactive) + ;; Capture the new task, creating the project file if necessary + (org-roam-capture- + :node (org-roam-node-read nil) + :templates '(("p" "project" plain "** TODO %?" + :if-new (file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n#+category: ${title}\n#+filetags: Project" + ("Tasks")))))) + +(global-set-key (kbd "C-c n t") #'my/org-roam-capture-task) + +(use-package! flycheck + :config + (flycheck-define-checker nix-statix + "A syntax checker for Nix using Statix." + :command ("statix" "check" source) + :error-patterns + ((warning line-start (file-name) ":" line ":" column + ": " (message) line-end)) + :modes (nix-mode)) + + (add-to-list 'flycheck-checkers 'nix-statix)) + +;; Populates only the EXPORT_FILE_NAME property in the inserted headline. +(with-eval-after-load 'org-capture + (defun org-hugo-new-subtree-post-capture-template () + "Returns `org-capture' template string for new Hugo post. + See `org-capture-templates' for more information." + (let* ((title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title + (fname (org-hugo-slug title))) + (mapconcat #'identity + `( + ,(concat "* TODO " title) + ":PROPERTIES:" + ,(concat ":EXPORT_FILE_NAME: " (format-time-string "%Y-%m-%d-") fname) + ":END:" + "%?\n") ;Place the cursor here finally + "\n")))) +;; org capture templates +(setq org-capture-templates + '( + ("h" ;`org-capture' binding + h + "Hugo post" + entry + ;; It is assumed that below file is present in `org-directory' + ;; and that it has a "Blog Ideas" heading. It can even be a + ;; symlink pointing to the actual location of all-posts.org! + (file+olp "/home/jawz/Development/Websites/portfolio/content-org/posts.org" "blog") + (function org-hugo-new-subtree-post-capture-template)) + )) + +;;;(after! org + ;;;;; ⧗       ―        ﮸     λ ◁ ▷ ✧ ✦ + ;;;(appendq! +ligatures-extra-symbols + ;;;`(:clock "⧗ " + ;;;:circle "" + ;;;:code "" + ;;;:results "﮸" + ;;;:shogi "⛊" + ;;;:white_shogi "☖" + ;;;:black_shogi "☗" + ;;;:two_lines "⚏" + ;;;;; :tags "  ‌" + ;;;:empty "" + ;;;)) + ;;;(set-ligatures! 'org-mode + ;;;;; :merge t + ;;;;; :clock ":LOGBOOK:" + ;;;:quote "#+begin_quote" + ;;;:name "#+CAPTION:" + ;;;:quote_end "#+end_quote" + ;;;:code "#+begin_src" + ;;;:code "#+BEGIN_SRC" + ;;;:src_block "#+BEGIN:" + ;;;:code "#+end_src" + ;;;:code "#+END_SRC" + ;;;:results "#+RESULTS:" + ;;;:results "#+results:" + ;;;;; :src_block_end ":END:" + ;;;;; :src_block_end "#+END" + ;;;;; :two_lines ":PROPERTIES:" + ;;;;; :black_shogi "#+CATEGORY:" + ;;;;; :black_shogi "#+category:" + ;;;;; :two_lines "#+startup:" + ;;;;; :two_lines "#+STARTUP:" + ;;;:empty "#+title: " + ;;;:empty "#+TITLE: " + ;;;;; :shogi "#+NAME:" + ;;;;; :shogi "#+name:" + ;;;;; :tags "keywords:" + ;;;;; :black_shogi "#+roam_tags:" + ;;;)) + +(setq display-line-numbers-type t) +(map! :leader + :desc "Comment or uncomment lines" "TAB TAB" #'comment-line + (:prefix ("t" . "toggle") + :desc "Toggle line numbers" "l" #'doom/toggle-line-numbers + :desc "Toggle line highlight in frame" "h" #'hl-line-mode + :desc "Toggle line highlight globally" "H" #'global-hl-line-mode + :desc "Toggle truncate lines" "t" #'toggle-truncate-lines)) + +(setq display-line-numbers-type `relative) +(global-visual-line-mode t) + +;; CONFIG +(require 'config-general-mode) + (add-to-list 'auto-mode-alist '("\\.conf$" . config-general-mode)) + +(setq all-the-icons-scale-factor .8) ;; fixes the issue of rightmost characters not fitting. +(set-face-attribute 'mode-line nil :font "Iosevka Nerd Font-15") +(setq doom-modeline-height 30 ;; sets modeline height + doom-modeline-bar-width 5 ;; sets right bar width + doom-modeline-persp-name t ;; adds perspective name to modeline + doom-modeline-persp-icon t) ;; adds folder icon next to persp name + +(xterm-mouse-mode 1) + +(map! :leader + (:prefix ("=" . "open file") + :desc "Edit agenda file" "a" #'(lambda () (interactive) + (find-file + "~/Documents/Notes/20220819130052-agenda.org")) + :desc "Edit doom config.org" "c" #'(lambda () (interactive) + (find-file + "~/.config/doom/config.org")) + :desc "Edit doom init.el" "i" #'(lambda () (interactive) + (find-file "~/.config/doom/init.el")) + :desc "Edit doom packages.el" "p" #'(lambda () (interactive) + (find-file "~/.config/doom/packages.el")))) + +(setq read-process-output-max (* 1024 1024)) ;; 1mb +(setq lsp-idle-delay 0.500) +(setq lsp-log-io nil) ; if set to true can cause a performance hit +;; c# LSP +(after! lsp-mode + (setq lsp-csharp-server-path "/usr/bin/omnisharp")) + +(after! org + (setq org-directory "~/Documents/Notes/" + org-agenda-files (directory-files-recursively + "~/Documents/Notes" "\\.org$") + ;; org-default-notes-file (expand-file-name "Notes.org" org-directory) + org-id-locations-file "~/Documents/Notes/.orgids" + org-attach-id-dir "~/Documents/Notes/images" + org-ellipsis " ▼ " + org-superstar-headline-bullets-list '("◉" "●" "○" "◆" "●" "○" "◆") + org-superstar-item-bullet-alist '((?+ . ?+) (?- . ?-)) + org-log-done 'time + org-log-into-drawer t + org-hide-emphasis-markers t + org-todo-keywords + '((sequence + "TODO(t)" ; A task that needs doing & is ready to do + "PROJ(p)" ; A project, which usually contains other tasks + "ART(a)" ; Similar to PROJ but focused on drawing + "IDEA(i)" ; Misc tasks, usually to elaborate on writing later + "HOLD(h)" ; This task is paused/on hold because I'm a lazy fuck + "|" + "DONE(d)" ; Task succesfully completed + "CANCELED(c)") ; Task was cancelled + (sequence + "[ ](T)" ; A task that needs doing + "[-](S)" ; A task in progress + "[?](H)" ; A task on hold + "|" + "[X](D)")) ; A task completed + org-todo-keyword-faces + '(("[-]" . +org-todo-active) + ("[?]" . +org-todo-onhold) + ("HOLD" . +org-todo-onhold) + ("ART" . +org-todo-project) + ("IDEA" . +org-todo-project) + ("PROJ" . +org-todo-project) + ("CANCELED" . +org-todo-cancel))) + (require 'org-habit)) + +(use-package! org-roam-bibtex + :after org-roam + :load-path "~/Documents/Notes/bibtex/") + ;; :config + ;; (require 'org-ref)) ; optional: if using Org-ref v2 or v3 citation links + +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.3)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.2)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0)))) + '(org-document-title ((t (:inherit outline-1 :height 2.0)))) +) + +;; (use-package org-alert +;; :ensure t) +;; (setq alert-default-style 'libnotify +;; org-alert-interval 3600) +;; ;; Auto start org-alert when emacs/daemon load +;; (org-alert-enable) + +(use-package org-auto-tangle + :defer t + :hook (org-mode . org-auto-tangle-mode)) + +(map! :leader + :desc "Org babel tangle" "m B" #'org-babel-tangle) +;; (org-babel-do-load-languages +;; 'org-babel-load-languages +;; '((R . t) +;; (emacs-lisp . t) +;; (nix . t))) + +(require 'org-inlinetask) +(setq org-inlinetask-min-level 9) + +(setq deft-directory "~/Documents/Notes/") +(use-package org-roam + :ensure t + :custom + (org-roam-directory "~/Documents/Notes/") + (org-roam-completion-everywhere t) + (org-roam-dailies-capture-templates + '(("d" "default" entry "* %<%I:%M %p>: %?" + :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))) + (org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("l" "programming language" plain + (file "/home/jawz/.config/doom/templates/programming.org") + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :programming:language:${title}:\n#+title: ${title}") + :unnarrowed t) + ("e" "political events" plain + (file "/home/jawz/.config/doom/templates/events.org") + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :politics:conflicts:\n#+title: ${title}") + :unnarrowed t) + ("p" "project" plain + "* PROJ ${title}\n%?\n* Tasks" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+category: ${title}\n#+filetags: :project:\n#+title: ${title}") + :unnarrowed t) + )) + :bind() + :bind-keymap() + :config + (org-roam-db-autosync-mode)) +(setq completion-ignore-case t) +(set-file-template! "~/Documents/Notes/.+\\.org$" 'org-mode :ignore t) + +(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 nil)) + +(use-package! org-transclusion + :after org + :init + (map! + :map global-map "" #'org-transclusion-add + :leader + (:prefix ("n r" . "toggle") + :desc "Org Transclussion Add" "a" #'org-transclusion-add + :desc "Org Transclusion Mode" "t" #'org-transclusion-mode))) + +(after! undo-tree + (setq undo-tree-auto-save-history nil)) + +;; (remove-hook 'undo-fu-mode-hook #'global-undo-fu-session-mode) + +(setq user-full-name "Danilo Reyes" + user-mail-address "CaptainJawZ@outlook.com") + +(custom-set-variables + '(flycheck-flake8-maximum-line-length 88) + '(safe-local-variable-values '((git-commit-major-mode . git-commit-elisp-text-mode)))) + +(map! :leader + (:prefix ("r" . "registers") + :desc "Copy to register" "c" #'copy-to-register + :desc "Frameset to register" "f" #'frameset-to-register + :desc "Insert contents of register" "i" #'insert-register + :desc "Jump to register" "j" #'jump-to-register + :desc "List registers" "l" #'list-registers + :desc "Number to register" "n" #'number-to-register + :desc "Interactively choose a register" "r" #'counsel-register + :desc "View a register" "v" #'view-register + :desc "Window configuration to register" "w" #'window-configuration-to-register + :desc "Increment register" "+" #'increment-register + :desc "Point to register" "SPC" #'point-to-register)) + +(defadvice! fixed-flycheck-proselint-parse-errors-a (output checker buffer) + :override #'flycheck-proselint-parse-errors + (delq + nil (mapcar (lambda (err) + (let-alist err + (and (or (not (derived-mode-p 'org-mode)) + (save-excursion (goto-char .start) + (not (org-in-src-block-p)))) + (flycheck-error-new-at-pos + .start + (pcase .severity + (`"suggestion" 'info) + (`"warning" 'warning) + (`"error" 'error) + (_ 'error)) + .message + :id .check + :buffer buffer + :checker checker + :end-pos .end)))) + (let-alist (car (flycheck-parse-json output)) + .data.errors)))) + +(defun prefer-horizontal-split () + (set-variable 'split-height-threshold nil t) + (set-variable 'split-width-threshold 40 t)) ; make this as low as needed +(add-hook 'markdown-mode-hook 'prefer-horizontal-split) +(map! :leader + :desc "Clone indirect buffer other window" "b c" #'clone-indirect-buffer-other-window) + +(setq twittering-allow-insecure-server-cert t) + +(map! :leader + (:prefix ("w" . "window") + :desc "Winner redo" "" #'winner-redo + :desc "Winner undo" "" #'winner-undo)) + +(map! :leader + :desc "Zap to char" "z" #'zap-to-char + :desc "Zap up to char" "Z" #'zap-up-to-char) diff --git a/dotfiles/doom/config.org b/dotfiles/doom/config.org new file mode 100755 index 0000000..42d2a21 --- /dev/null +++ b/dotfiles/doom/config.org @@ -0,0 +1,1041 @@ +#+AUTHOR: Danilo Reyes (JawZ) +#+STARTUP: content +#+TITLE: JawZ's Doom Emacs config + +* ABOUT THIS CONFIG +This is my personal Doom Emacs config file, forked from DT's config file on +GitLab and modified to fit my personal preferences, plugins, extensions and +other customization settings. + +The purpose of this file, is to have an easy-to-read documentation which +explains why and how each customization works, for future editing and other +friends to use. + +** Resources ++ The following [[https://systemcrafters.net/build-a-second-brain-in-emacs/5-org-roam-hacks/][tutorial]] and [[https://shiori.danilo-reyes.com/bookmark/39/content][archived tutorial]]. ++ [[https://github.com/psamim/dotfiles][Agenda/org prettify stuff]] ++ [[https://gitlab.com/dwt1/dotfiles/-/tree/master/.config/doom][DT's original repo]] + +* BIBLE +Allows me to insert bible quotes into my org notes. +=NOTE= I'm not religious just for worldbuilding purposes lol. + +#+begin_src emacs-lisp +(use-package + insert-esv + :init + (setq insert-esv-crossway-api-key "bb1872462ecc59624c7bb8ab36c9701ce2027cd1") + (setq insert-esv-include-short-copyright 'false) + (setq insert-esv-include-headings 'true) + (setq insert-esv-include-passage-horizontal-lines 'false) + (setq insert-esv-line-length '500) + :bind ("C-x C-e" . insert-esv-passage)) +#+end_src + +* BOOKMARKS AND BUFFERS +Doom Emacs uses 'SPC b' for keybindings related to bookmarks and buffers. + +** Bookmarks +Emacs bookmarking works somewhat like registers in that they record positions +you can jump to. Unlike registers, they have long names, and they persist +automatically from one Emacs session to the next. The prototypical use of +bookmarks is to record where you were reading in bookmarked files. + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------+----------------------------------------+------------| +| list-bookmarks | /List bookmarks/ | SPC b L | +| bookmark-set | /Set bookmark/ | SPC b m | +| bookmark-delete | /Delete bookmark/ | SPC b M | +| bookmark-save | /Save current bookmark to bookmark file/ | SPC b w | + +#+BEGIN_SRC emacs-lisp +(setq bookmark-default-file "~/.config/doom/bookmarks") + +(map! :leader + (:prefix ("b". "buffer") + :desc "List bookmarks" "L" #'list-bookmarks + :desc "Set bookmark" "m" #'bookmark-set + :desc "Delete bookmark" "M" #'bookmark-set + :desc "Save current bookmarks to bookmark file" "w" #'bookmark-save)) +#+END_SRC + +** Buffers +Regarding /buffers/, the text you are editing in Emacs resides in an object +called a /buffer/. Each time you visit a file, a buffer holds the file’s text. +Each time you invoke Dired, a buffer holds the directory listing. /Ibuffer/ is +a program that lists all of your Emacs /buffers/, allowing you to navigate +between them and filter them. + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------+----------------------+------------| +| ibuffer | Launch ibuffer | SPC b i | +| kill-buffer | Kill current buffer | SPC b k | +| next-buffer | Goto next buffer | SPC b n | +| previous-buffer | Goto previous buffer | SPC b p | +| save-buffer | Save current buffer | SPC b s | + +** Global Auto Revert +A buffer can get out of sync with respect to its visited file on disk if that +file changes by another program. To keep it up to date, you can enable Auto +Revert mode by typing M-x auto-revert-mode, or you can set to turn on globally +with ‘global-auto-revert-mode’. I have also turned on Global Auto Revert on +non-file buffers, which is especially useful for ‘dired’ buffers. + +#+begin_src emacs-lisp +(global-auto-revert-mode 1) +(setq global-auto-revert-non-file-buffers t) +#+end_src + +** Keybindings within ibuffer mode +ibuffer mode, it's a more elegant way to display your opened buffers, and plus +you can manipulate them using vim keybindings. + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------------------------+----------------------------------------+------------| +| ibuffer-mark-forward | Mark the buffer | m | +| ibuffer-unmark-forward | Unmark the buffer | u | +| ibuffer-do-kill-on-deletion-marks | Kill the marked buffers | x | +| ibuffer-filter-by-content | ibuffer filter by content | f c | +| ibuffer-filter-by-directory | ibuffer filter by directory | f d | +| ibuffer-filter-by-filename | ibuffer filter by filename (full path) | f f | +| ibuffer-filter-by-mode | ibuffer filter by mode | f m | +| ibuffer-filter-by-name | ibuffer filter by name | f n | +| ibuffer-filter-disable | Disable ibuffer filter | f x | +| ibuffer-do-kill-lines | Hide marked buffers | g h | +| ibuffer-update | Restore hidden buffers | g H | + +#+begin_src emacs-lisp +(evil-define-key 'normal ibuffer-mode-map + (kbd "f c") 'ibuffer-filter-by-content + (kbd "f d") 'ibuffer-filter-by-directory + (kbd "f f") 'ibuffer-filter-by-filename + (kbd "f m") 'ibuffer-filter-by-mode + (kbd "f n") 'ibuffer-filter-by-name + (kbd "f x") 'ibuffer-filter-disable + (kbd "g h") 'ibuffer-do-kill-lines + (kbd "g H") 'ibuffer-update) +#+end_src + +* DASHBOARD +Emacs Dashboard is a startup screen showing you recent files, bookmarks, agenda +items and an Emacs banner. + +** Dashboard in Emacsclient +This setting ensures that emacsclient always opens on *dashboard* rather than +*scratch*. + +#+begin_src emacs-lisp +(setq doom-fallback-buffer "*dashboard*") +#+end_src + +* DIRED +The file manager within Emacs. Below, I setup keybindings for image previews +(peep-dired). Doom Emacs does not use 'SPC d' for any of its keybindings, so +I've chosen the format of 'SPC d' plus 'key'. + +** Keybindings To Open Dired + +| COMMAND | DESCRIPTION | KEYBINDING | +|------------+------------------------------------+------------| +| dired | /Open dired file manager/ | SPC d d | +| dired-jump | /Jump to current directory in dired/ | SPC d j | + +** Basic dired commands + +| COMMAND | DESCRIPTION | KEYBINDING | +|------------------------+---------------------------------------------+------------| +| dired-view-file | /View file in dired/ | SPC d v | +| dired-up-directory | /Go up in directory tree/ | h | +| dired-find-file | /Go down in directory tree (or open if file)/ | l | +| dired-next-line | Move down to next line | j | +| dired-previous-line | Move up to previous line | k | +| dired-mark | Mark file at point | m | +| dired-unmark | Unmark file at point | u | +| dired-do-copy | Copy current file or marked files | C | +| dired-do-rename | Rename current file or marked files | R | +| dired-hide-details | Toggle detailed listings on/off | ( | +| dired-git-info-mode | Toggle git information on/off | ) | +| dired-create-directory | Create new empty directory | + | +| dired-diff | Compare file at point with another | = | +| dired-subtree-toggle | Toggle viewing subtree at point | TAB | + +** Dired commands using regex + +| COMMAND | DESCRIPTION | KEYBINDING | +|-------------------------+----------------------------+------------| +| dired-mark-files-regexp | Mark files using regex | % m | +| dired-do-copy-regexp | Copy files using regex | % C | +| dired-do-rename-regexp | Rename files using regex | % R | +| dired-mark-files-regexp | Mark all files using regex | * % | + +** File permissions and ownership + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------+----------------------------------+------------| +| dired-do-chgrp | Change the group of marked files | g G | +| dired-do-chmod | Change the mode of marked files | M | +| dired-do-chown | Change the owner of marked files | O | +| dired-do-rename | Rename file or all marked files | R | + +#+begin_src emacs-lisp +(map! :leader + (:prefix ("d" . "dired") + :desc "Open dired" "d" #'dired + :desc "Dired jump to current" "j" #'dired-jump) + (:after dired + (:map dired-mode-map + :desc "Peep-dired image previews" "d p" #'peep-dired + :desc "Dired view file" "d v" #'dired-view-file))) + +(evil-define-key 'normal dired-mode-map + (kbd "M-RET") 'dired-display-file + (kbd "h") 'dired-up-directory + (kbd "l") 'dired-open-file ; use dired-find-file instead of dired-open. + (kbd "m") 'dired-mark + (kbd "t") 'dired-toggle-marks + (kbd "u") 'dired-unmark + (kbd "C") 'dired-do-copy + (kbd "D") 'dired-do-delete + (kbd "J") 'dired-goto-file + (kbd "M") 'dired-do-chmod + (kbd "O") 'dired-do-chown + (kbd "P") 'dired-do-print + (kbd "R") 'dired-do-rename + (kbd "T") 'dired-do-touch + (kbd "Y") 'dired-copy-filenamecopy-filename-as-kill ; copies filename to kill ring. + (kbd "Z") 'dired-do-compress + (kbd "+") 'dired-create-directory + (kbd "-") 'dired-do-kill-lines + (kbd "% l") 'dired-downcase + (kbd "% m") 'dired-mark-files-regexp + (kbd "% u") 'dired-upcase + (kbd "* %") 'dired-mark-files-regexp + (kbd "* .") 'dired-mark-extension + (kbd "* /") 'dired-mark-directories + (kbd "; d") 'epa-dired-do-decrypt + (kbd "; e") 'epa-dired-do-encrypt) +;; (kbd "Q") 'quick-preview-at-point) ;; previews with sushi +;; Get file icons in dired +;; (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) +;; With dired-open plugin, you can launch external programs for certain extensions +;; For example, I set all .png files to open in 'sxiv' and all .mp4 files to open in 'mpv' +(setq dired-open-extensions '(("gif" . "eog") + ("jpg" . "eog") + ("png" . "eog") + ("mkv" . "celluloid") + ("mp4" . "celluloid"))) +#+end_src + +** Keybindings Within Dired With Peep-Dired-Mode Enabled +With peep-dired, you will get image previews as you go up/down with 'j' +and 'k' + +| COMMAND | DESCRIPTION | KEYBINDING | +|----------------------+------------------------------------------+------------| +| peep-dired | /Toggle previews within dired/ | SPC d p | +| peep-dired-next-file | /Move to next file in peep-dired-mode/ | j | +| peep-dired-prev-file | /Move to previous file in peep-dired-mode/ | k | + +#+begin_src emacs-lisp +(evil-define-key 'normal peep-dired-mode-map + (kbd "j") 'peep-dired-next-file + (kbd "k") 'peep-dired-prev-file) +(add-hook 'peep-dired-hook 'evil-normalize-keymaps) +#+end_src + +** Making deleted files go to trash can + +#+begin_src emacs-lisp +(setq delete-by-moving-to-trash t + trash-directory "~/.local/share/Trash/files/") +#+end_src + +** Clean up dired buffers while navigating away + +#+begin_src emacs-lisp +;; (diredp-toggle-find-file-reuse-dir 1) +(setq dired-kill-when-opening-new-dired-buffer 1) +#+end_src + +* DOOM THEME +Setting the theme to doom-one. To try out new themes, I set a keybinding for +counsel-load-theme with 'SPC h t'. + +#+begin_src emacs-lisp +(use-package! base16-stylix-theme) +(require 'base16-stylix-theme) +(setq doom-theme 'base16-stylix) +;; (setq doom-theme 'doom-opera-light) +;; ;; (setq doom-theme 'doom-dark+) +;; (map! :leader +;; :desc "Load new theme" "h t" #'counsel-load-theme) +#+end_src + +* EMMS +One of the media players available for Emacs is emms, which stands for Emacs +Multimedia System. By default, Doom Emacs does not use 'SPC m p d',' so the format +I use for these bindings is 'SPC a' plus 'key'. + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------------+---------------------------------+------------| +| emms-playlist-mode-go | /Switch to the playlist buffer/ | SPC a a | +| emms-pause | /Pause the track/ | SPC a x | +| emms-stop | /Stop the track/ | SPC a s | +| emms-previous | /Play previous track in playlist/ | SPC a p | +| emms-next | /Play next track in playlist/ | SPC a n | + +#+begin_src emacs-lisp +;; (emms-all) +;; (emms-default-players) +;; (emms-mode-line 1) +;; (emms-playing-time 1) +;; (setq emms-source-file-default-directory "~/Music/" +;; emms-playlist-buffer-name "*Music*" +;; emms-info-asynchronously t +;; emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find) +;; (map! :leader +;; (:prefix ("m p d". "EMMS audio player") +;; :desc "Go to emms playlist" "a" #'emms-playlist-mode-go +;; :desc "Emms pause track" "x" #'emms-pause +;; :desc "Emms stop track" "s" #'emms-stop +;; :desc "Emms play previous track" "p" #'emms-previous +;; :desc "Emms play next track" "n" #'emms-next)) +#+end_src + +* EVALUATE ELISP EXPRESSIONS +Changing some keybindings from their defaults to better fit with Doom Emacs, and +to avoid conflicts with my window managers which sometimes use the control key +in their keybindings. By default, Doom Emacs does not use 'SPC e' for anything, +so I choose to use the format 'SPC e' plus 'key' for these (I also use 'SPC e' +for 'eww' keybindings). + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------+----------------------------------------------+------------| +| eval-buffer | /Evaluate elisp in buffer/ | SPC e b | +| eval-defun | /Evaluate the defun containing or after point/ | SPC e d | +| eval-expression | /Evaluate an elisp expression/ | SPC e e | +| eval-last-sexp | /Evaluate elisp expression before point/ | SPC e l | +| eval-region | /Evaluate elisp in region/ | SPC e r | + +#+begin_src emacs-lisp +(map! :leader + (:prefix ("e". "evaluate/EWW") + :desc "Evaluate elisp in buffer" "b" #'eval-buffer + :desc "Evaluate defun" "d" #'eval-defun + :desc "Evaluate elisp expression" "e" #'eval-expression + :desc "Evaluate last sexpression" "l" #'eval-last-sexp + :desc "Evaluate elisp in region" "r" #'eval-region)) +#+end_src + +* EWW +This is the Emacs Web Wowser, the builtin browser in Emacs. Below I set urls to +open in a specific browser (eww) with browse-url-browser-function. By default, +Doom Emacs does not use 'SPC e' for anything, so I choose to use the format 'SPC +e' plus 'key' for these (I also use 'SPC e' for 'eval' keybindings). I chose to +use 'SPC s w' for eww-search-words because Doom Emacs uses 'SPC s' for 'search' +commands. + +#+begin_src emacs-lisp +;; (setq browse-url-browser-function 'eww-browse-url) +(map! :leader + :desc "Search web for text between BEG/END" + "s w" #'eww-search-words + (:prefix ("e" . "evaluate/EWW") + :desc "Eww web browser" "w" #'eww + :desc "Eww reload page" "R" #'eww-reload)) +#+end_src + +* FONTS +Settings related to fonts within Doom Emacs: ++ 'doom-font' -- standard monospace font that defaults for most things in Emacs. ++ 'doom-variable-pitch-font' -- variable font which is useful in some Emacs + plugins. ++ 'doom-big-font' -- used in doom-big-font-mode; useful for presentations. ++ 'font-lock-comment-face' -- for comments. ++ 'font-lock-keyword-face' -- for keywords with special significance like 'setq' + in elisp. + +#+begin_src emacs-lisp +(setq doom-unicode-font "Symbola") +(setq doom-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 18) + doom-variable-pitch-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 18) + doom-big-font (font-spec :family "ComicShannsMono Nerd Font Mono" :size 22)) +(after! doom-themes + (setq doom-themes-enable-bold t + doom-themes-enable-italic t)) +(custom-set-faces! + '(bold :weight ultra-bold) + '(font-lock-comment-face :slant italic) + '(font-lock-keyword-face :slant italic)) +#+end_src + +* FUNCTIONS +These are a collection of functions which I've snipped from multiple sources on +the internet. Some are slightly modified for my preferences, but overall I'm +not good enough with LISP to write my own functions yet. + +** Insert date +Some custom functions to insert the date. The function 'insert-todays-date' has +three different formats: + +1) Just the keybinding without the universal argument prefix. +2) With one universal argument prefix. +3) With two universal argument prefixes. + +The universal argument prefix is 'SPC-u' in Doom Emacs (C-u in standard GNU +Emacs). The function 'insert-any-date' only outputs to one format, which is the +same format as 'insert-todays-date' without a prefix. + +| COMMAND | EXAMPLE OUTPUT | KEYBINDING | +|-----------------------+---------------------------+-----------------------| +| dt/insert-todays-date | 2021-11-19 | SPC i d t | +| dt/insert-todays-date | Friday, November 19, 2021 | SPC u SPC i d t | +| dt/insert-any-date | Friday, November 19, 2021 | SPC i d a | + +=NOTE= Made by DT + +#+begin_src emacs-lisp +(defun func/insert-todays-date (prefix) + (interactive "P") + (let ((format (cond + ((not prefix) "%Y-%m-%d") + ((equal prefix '(4)) "%A, %B %d, %Y")))) + (insert (format-time-string format)))) + +(require 'calendar) +(defun func/insert-any-date (date) + "Insert DATE using the current locale." + (interactive (list (calendar-read-date))) + (insert (calendar-date-string date))) + +(map! :leader + (:prefix ("i d" . "Insert date") + :desc "Insert any date" "a" #'func/insert-any-date + :desc "Insert todays date" "t" #'func/insert-todays-date)) +#+end_src + +** Capture a task directly into a specific project +One important thing to point out here is that we're using 'file + head + olp' in +the capture template so that we can drop the new task entry under the "Tasks" +heading. + +Works, but I'm unsure how to use it on my workflow, may be safe to delete it +later. + +=NOTE= made by SystemCrafters + +#+begin_src emacs-lisp +(defun func/org-roam-capture-task () + (interactive) + ;; Capture the new task, creating the project file if necessary + (org-roam-capture- + :node (org-roam-node-read nil) + :templates '(("p" "project" plain "** TODO %?" + :if-new (file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n#+category: ${title}\n#+filetags: Project" + ("Tasks")))))) + +(global-set-key (kbd "C-c n t") #'my/org-roam-capture-task) +#+end_src + +* FLYCHECK +Configurations to add linting support to specific languages by integrating linters with flycheck. + +#+begin_src emacs-lisp +(use-package! flycheck + :config + (flycheck-define-checker nix-statix + "A syntax checker for Nix using Statix." + :command ("statix" "check" source) + :error-patterns + ((warning line-start (file-name) ":" line ":" column + ": " (message) line-end)) + :modes (nix-mode)) + + (add-to-list 'flycheck-checkers 'nix-statix)) +#+end_src +* HUGO +Capture template for new hugo posts. + +#+begin_src emacs-lisp +;; Populates only the EXPORT_FILE_NAME property in the inserted headline. +(with-eval-after-load 'org-capture + (defun org-hugo-new-subtree-post-capture-template () + "Returns `org-capture' template string for new Hugo post. + See `org-capture-templates' for more information." + (let* ((title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title + (fname (org-hugo-slug title))) + (mapconcat #'identity + `( + ,(concat "* TODO " title) + ":PROPERTIES:" + ,(concat ":EXPORT_FILE_NAME: " (format-time-string "%Y-%m-%d-") fname) + ":END:" + "%?\n") ;Place the cursor here finally + "\n")))) +;; org capture templates +(setq org-capture-templates + '( + ("h" ;`org-capture' binding + h + "Hugo post" + entry + ;; It is assumed that below file is present in `org-directory' + ;; and that it has a "Blog Ideas" heading. It can even be a + ;; symlink pointing to the actual location of all-posts.org! + (file+olp "/home/jawz/Development/Websites/portfolio/content-org/posts.org" "blog") + (function org-hugo-new-subtree-post-capture-template)) + )) +#+end_src + +* LIGATURES +Set custom ligature symbols for different modes, which prettifies the Emacs +experience. + +Customizing ligatures, which replace strings with pretty symbols. They configure by mode. + +#+begin_src emacs-lisp +;;;(after! org + ;;;;; ⧗       ―        ﮸     λ ◁ ▷ ✧ ✦ + ;;;(appendq! +ligatures-extra-symbols + ;;;`(:clock "⧗ " + ;;;:circle "" + ;;;:code "" + ;;;:results "﮸" + ;;;:shogi "⛊" + ;;;:white_shogi "☖" + ;;;:black_shogi "☗" + ;;;:two_lines "⚏" + ;;;;; :tags "  ‌" + ;;;:empty "" + ;;;)) + ;;;(set-ligatures! 'org-mode + ;;;;; :merge t + ;;;;; :clock ":LOGBOOK:" + ;;;:quote "#+begin_quote" + ;;;:name "#+CAPTION:" + ;;;:quote_end "#+end_quote" + ;;;:code "#+begin_src" + ;;;:code "#+BEGIN_SRC" + ;;;:src_block "#+BEGIN:" + ;;;:code "#+end_src" + ;;;:code "#+END_SRC" + ;;;:results "#+RESULTS:" + ;;;:results "#+results:" + ;;;;; :src_block_end ":END:" + ;;;;; :src_block_end "#+END" + ;;;;; :two_lines ":PROPERTIES:" + ;;;;; :black_shogi "#+CATEGORY:" + ;;;;; :black_shogi "#+category:" + ;;;;; :two_lines "#+startup:" + ;;;;; :two_lines "#+STARTUP:" + ;;;:empty "#+title: " + ;;;:empty "#+TITLE: " + ;;;;; :shogi "#+NAME:" + ;;;;; :shogi "#+name:" + ;;;;; :tags "keywords:" + ;;;;; :black_shogi "#+roam_tags:" + ;;;)) +#+end_src + +* LINE SETTINGS +I set comment-line to 'SPC TAB TAB' which is a rather comfortable keybinding for +me. The standard Emacs keybinding for comment-line is 'C-x C-;'. The other +keybindings are for commands that toggle on/off line-related settings. +Doom Emacs uses 'SPC t' for "toggle" commands, so I choose 'SPC t' plus 'key' +for those bindings. + +| COMMAND | DESCRIPTION | KEYBINDING | +|--------------------------+-------------------------------------------+-------------| +| comment-line | /Toggle commenting lines/ | SPC TAB TAB | +| hl-line-mode | /Toggle line highlighting in current frame/ | SPC t h | +| global-hl-line-mode | /Toggle line highlighting globally/ | SPC t H | +| doom/toggle-line-numbers | /Toggle line numbers/ | SPC t l | +| toggle-truncate-lines | /Toggle truncate lines/ | SPC t t | + +#+begin_src emacs-lisp +(setq display-line-numbers-type t) +(map! :leader + :desc "Comment or uncomment lines" "TAB TAB" #'comment-line + (:prefix ("t" . "toggle") + :desc "Toggle line numbers" "l" #'doom/toggle-line-numbers + :desc "Toggle line highlight in frame" "h" #'hl-line-mode + :desc "Toggle line highlight globally" "H" #'global-hl-line-mode + :desc "Toggle truncate lines" "t" #'toggle-truncate-lines)) +#+end_src + +These are my default line display preferences. + +#+begin_src emacs-lisp +(setq display-line-numbers-type `relative) +(global-visual-line-mode t) +#+end_src + +* LOAD-MODES +These settings make it so company modes load by default on specific file formats. + +#+begin_src emacs-lisp +;; CONFIG +(require 'config-general-mode) + (add-to-list 'auto-mode-alist '("\\.conf$" . config-general-mode)) +#+end_src + +* MODELINE +The modeline is the bottom status bar that appears in Emacs windows. For more +information on what is available to configure in the Doom modeline, check out: +https://github.com/seagle0128/doom-modeline + +#+begin_src emacs-lisp +(setq all-the-icons-scale-factor .8) ;; fixes the issue of rightmost characters not fitting. +(set-face-attribute 'mode-line nil :font "Iosevka Nerd Font-15") +(setq doom-modeline-height 30 ;; sets modeline height + doom-modeline-bar-width 5 ;; sets right bar width + doom-modeline-persp-name t ;; adds perspective name to modeline + doom-modeline-persp-icon t) ;; adds folder icon next to persp name +#+end_src + +* MOUSE SUPPORT +Adding mouse support in the terminal version of Emacs. + +#+begin_src emacs-lisp +(xterm-mouse-mode 1) +#+end_src + +* OPEN SPECIFIC FILES +Keybindings to open files that I work with all the time using the find-file +command, which is the interactive file search that opens with 'C-x C-f' in GNU +Emacs or 'SPC f f' in Doom Emacs. These keybindings use find-file +non-interactively since we specify exactly what file to open. The format I use +for these bindings is 'SPC =' plus 'key' since Doom Emacs does not use 'SPC ='. + +| PATH TO FILE | DESCRIPTION | KEYBINDING | +|------------------------------+-----------------------+------------| +| ~/Documents/Notes/Agenda.org | /Edit agenda file/ | SPC = a | +| ~/.config/doom/config.org | /Edit doom config.org/ | SPC = c | +| ~/.config/doom/init.el | /Edit doom init.el/ | SPC = i | +| ~/.config/doom/packages.el | /Edit doom packages.el/ | SPC = p | + +#+begin_src emacs-lisp +(map! :leader + (:prefix ("=" . "open file") + :desc "Edit agenda file" "a" #'(lambda () (interactive) + (find-file + "~/Documents/Notes/20220819130052-agenda.org")) + :desc "Edit doom config.org" "c" #'(lambda () (interactive) + (find-file + "~/.config/doom/config.org")) + :desc "Edit doom init.el" "i" #'(lambda () (interactive) + (find-file "~/.config/doom/init.el")) + :desc "Edit doom packages.el" "p" #'(lambda () (interactive) + (find-file "~/.config/doom/packages.el")))) +#+end_src + +* LSP +When configured properly lsp-mode's performance is on par with mainstream LSP +clients (e. g. VScode, Theia, etc). Here are steps to achieve optimal results. + +#+begin_src emacs-lisp +(setq read-process-output-max (* 1024 1024)) ;; 1mb +(setq lsp-idle-delay 0.500) +(setq lsp-log-io nil) ; if set to true can cause a performance hit +;; c# LSP +(after! lsp-mode + (setq lsp-csharp-server-path "/usr/bin/omnisharp")) +#+end_src + +* ORG MODE +I wrapped most of this block in (after! org). Without this, my settings might +evaluate too early, which will result in my settings being overwritten by Doom's +defaults. I have also enabled org-journal, org-superstar and org-roam by adding +(+journal +pretty +roam2) to the org section of my Doom Emacs init.el. + +These are my personal settings, heavily modified from DT's original config. For +starters, I made it so org-agenda-files recursively feeds the agenda from .org +files found on my Notes directory, also made it so logs go into drawers, and +lastly customized the TODO keywords based on my personal preferences, these are +settings overwrite the original org settings, and this require to run after org, +so they can build upon the variables defined by the default configuration of +Doom Emacs. + +#+begin_src emacs-lisp +(after! org + (setq org-directory "~/Documents/Notes/" + org-agenda-files (directory-files-recursively + "~/Documents/Notes" "\\.org$") + ;; org-default-notes-file (expand-file-name "Notes.org" org-directory) + org-id-locations-file "~/Documents/Notes/.orgids" + org-attach-id-dir "~/Documents/Notes/images" + org-ellipsis " ▼ " + org-superstar-headline-bullets-list '("◉" "●" "○" "◆" "●" "○" "◆") + org-superstar-item-bullet-alist '((?+ . ?+) (?- . ?-)) + org-log-done 'time + org-log-into-drawer t + org-hide-emphasis-markers t + org-todo-keywords + '((sequence + "TODO(t)" ; A task that needs doing & is ready to do + "PROJ(p)" ; A project, which usually contains other tasks + "ART(a)" ; Similar to PROJ but focused on drawing + "IDEA(i)" ; Misc tasks, usually to elaborate on writing later + "HOLD(h)" ; This task is paused/on hold because I'm a lazy fuck + "|" + "DONE(d)" ; Task succesfully completed + "CANCELED(c)") ; Task was cancelled + (sequence + "[ ](T)" ; A task that needs doing + "[-](S)" ; A task in progress + "[?](H)" ; A task on hold + "|" + "[X](D)")) ; A task completed + org-todo-keyword-faces + '(("[-]" . +org-todo-active) + ("[?]" . +org-todo-onhold) + ("HOLD" . +org-todo-onhold) + ("ART" . +org-todo-project) + ("IDEA" . +org-todo-project) + ("PROJ" . +org-todo-project) + ("CANCELED" . +org-todo-cancel))) + (require 'org-habit)) +#+end_src + +** Set font sizes for each header level in Org +You can set the Org heading levels to be different font sizes. So I choose to +have level 1 headings to be 140% in height, level 2 to be 130%, etc. Other +interesting things you could play with include adding :foreground color and/or +:background color if you want to override the theme colors. + +#+begin_src emacs-lisp +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.3)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.2)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0)))) + '(org-document-title ((t (:inherit outline-1 :height 2.0)))) +) +#+end_src + +** Org-Alert +This change makes it so org-alert uses libnotify for system notifications as +well as update intervals. + +#+begin_src emacs-lisp +;; (use-package org-alert +;; :ensure t) +;; (setq alert-default-style 'libnotify +;; org-alert-interval 3600) +;; ;; Auto start org-alert when emacs/daemon load +;; (org-alert-enable) +#+end_src + +** Org-Auto-Tangle +Allows you to add the option #+auto_tangle: t in your Org file so that it +automatically tangles when you save the document. + +#+begin_src emacs-lisp +(use-package org-auto-tangle + :defer t + :hook (org-mode . org-auto-tangle-mode)) +#+end_src + +** Org-Babel +Load language support on org-babel, also map out org-babel-tangle. + +#+begin_src emacs-lisp +(map! :leader + :desc "Org babel tangle" "m B" #'org-babel-tangle) +;; (org-babel-do-load-languages +;; 'org-babel-load-languages +;; '((R . t) +;; (emacs-lisp . t) +;; (nix . t))) +#+end_src + +** Org-Inlinetask +Enables a feature native to org-mode, which after a set amount of indentations, +turns the header into a task, allowing for the insertion of TODO or PROJ without +disrupting the indentation of the lines below it. +https://github.com/amluto/org-mode/blob/master/lisp/org-inlinetask.el + +#+begin_src emacs-lisp +(require 'org-inlinetask) +(setq org-inlinetask-min-level 9) +#+end_src + +** Org-Roam +First lines set up some preferences through variables, then it sets up some +templates for dailies, and nodes. + +| COMMAND | DESCRIPTION | KEYBINDING | +|---------------------------------+---------------------------------+-------------| +| org-roam-find-file | org roam find file | SPC n r f | +| org-roam-insert | org roam insert | SPC n r i | +| org-roam-dailies-find-date | org roam dailies find date | SPC n r d d | +| org-roam-dailies-find-today | org roam dailies find today | SPC n r d t | +| org-roam-dailies-find-tomorrow | org roam dailies find tomorrow | SPC n r d m | +| org-roam-dailies-find-yesterday | org roam dailies find yesterday | SPC n r d y | + +#+begin_src emacs-lisp +(setq deft-directory "~/Documents/Notes/") +(use-package org-roam + :ensure t + :custom + (org-roam-directory "~/Documents/Notes/") + (org-roam-completion-everywhere t) + (org-roam-dailies-capture-templates + '(("d" "default" entry "* %<%I:%M %p>: %?" + :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))) + (org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("l" "programming language" plain + (file "/home/jawz/.config/doom/templates/programming.org") + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :programming:language:${title}:\n#+title: ${title}") + :unnarrowed t) + ("e" "political events" plain + (file "/home/jawz/.config/doom/templates/events.org") + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :politics:conflicts:\n#+title: ${title}") + :unnarrowed t) + ("p" "project" plain + "* PROJ ${title}\n%?\n* Tasks" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+category: ${title}\n#+filetags: :project:\n#+title: ${title}") + :unnarrowed t) + )) + :bind() + :bind-keymap() + :config + (org-roam-db-autosync-mode)) +(setq completion-ignore-case t) +(set-file-template! "~/Documents/Notes/.+\\.org$" 'org-mode :ignore t) +#+end_src + +** Org-Roam-UI +This is a superior (and interactive) visualizer for org-roam graph. +https://github.com/org-roam/org-roam-ui + +#+begin_src emacs-lisp +(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 nil)) +#+end_src + +** Org-Transclusion +Org-transclusion lets you insert a copy of text content via a file link or ID +link within an Org file. It lets you have the same content present in different +buffers at the same time without copy-and-pasting it. Edit the source of the +content, and you can refresh the transcluded copies to the up-to-date state. +Org-transclusion keeps your files clear of the transcluded copies, leaving only +the links to the original content. +https://github.com/nobiot/org-transclusion + +| COMMAND | DESCRIPTION | KEYBINDING | +|-----------------------+--------------------------+------------| +| org-transclusion-add | Add transclusion block | SPC n r a | +| org-transclusion-mode | Toggle transclusion mode | SPC n r t | + + +#+begin_src emacs-lisp +(use-package! org-transclusion + :after org + :init + (map! + :map global-map "" #'org-transclusion-add + :leader + (:prefix ("n r" . "toggle") + :desc "Org Transclussion Add" "a" #'org-transclusion-add + :desc "Org Transclusion Mode" "t" #'org-transclusion-mode))) +#+end_src + +* OTHER SETTINGS +These are some personal settings, and other fixes. + +** Disable persistent undo +Uses [[doom-package:][undo-tree]] instead of [[doom-package:][undo-fu]], which is a little less stable, but offers +branching undo history and a visualizer for navigating it. + ++ If using +tree + #+begin_src emacs-lisp +(after! undo-tree + (setq undo-tree-auto-save-history nil)) + #+end_src + ++ Else + #+begin_src emacs-lisp +;; (remove-hook 'undo-fu-mode-hook #'global-undo-fu-session-mode) + #+end_src + +** User information + +#+begin_src emacs-lisp +(setq user-full-name "Danilo Reyes" + user-mail-address "CaptainJawZ@outlook.com") +#+end_src + +** Variables +Custom set variables, I should note that I don't know what git commit major mode +does, but flycheck is for minimizing errors on python scripts for long line +length. + +#+begin_src emacs-lisp +(custom-set-variables + '(flycheck-flake8-maximum-line-length 88) + '(safe-local-variable-values '((git-commit-major-mode . git-commit-elisp-text-mode)))) +#+end_src + +* REGISTERS +Emacs registers are compartments where you can save text, rectangles and +positions for later use. Once you save text or a rectangle in a register, you +can copy it into the buffer once or multiple times; once you save a position in +a register, you can jump back to that position once or multiple times. The +default GNU Emacs keybindings for these commands (with the exception of +counsel-register) involves 'C-x r' followed by one or more other keys. I wanted +to make this a little more user friendly, and since I am using Doom Emacs, I +choose to replace the 'C-x r' part of the key chords with 'SPC r'. + +| COMMAND | DESCRIPTION | KEYBINDING | +|----------------------------------+----------------------------------+------------| +| copy-to-register | /Copy to register/ | SPC r c | +| frameset-to-register | /Frameset to register/ | SPC r f | +| insert-register | /Insert contents of register/ | SPC r i | +| jump-to-register | /Jump to register/ | SPC r j | +| list-registers | /List registers/ | SPC r l | +| number-to-register | /Number to register/ | SPC r n | +| counsel-register | /Interactively choose a register/ | SPC r r | +| view-register | /View a register/ | SPC r v | +| window-configuration-to-register | /Window configuration to register/ | SPC r w | +| increment-register | /Increment register/ | SPC r + | +| point-to-register | /Point to register/ | SPC r SPC | + +#+begin_src emacs-lisp +(map! :leader + (:prefix ("r" . "registers") + :desc "Copy to register" "c" #'copy-to-register + :desc "Frameset to register" "f" #'frameset-to-register + :desc "Insert contents of register" "i" #'insert-register + :desc "Jump to register" "j" #'jump-to-register + :desc "List registers" "l" #'list-registers + :desc "Number to register" "n" #'number-to-register + :desc "Interactively choose a register" "r" #'counsel-register + :desc "View a register" "v" #'view-register + :desc "Window configuration to register" "w" #'window-configuration-to-register + :desc "Increment register" "+" #'increment-register + :desc "Point to register" "SPC" #'point-to-register)) +#+end_src + +* SPELL +This will disable Proselint from running inside code blocks. + +#+begin_src emacs-lisp +(defadvice! fixed-flycheck-proselint-parse-errors-a (output checker buffer) + :override #'flycheck-proselint-parse-errors + (delq + nil (mapcar (lambda (err) + (let-alist err + (and (or (not (derived-mode-p 'org-mode)) + (save-excursion (goto-char .start) + (not (org-in-src-block-p)))) + (flycheck-error-new-at-pos + .start + (pcase .severity + (`"suggestion" 'info) + (`"warning" 'warning) + (`"error" 'error) + (_ 'error)) + .message + :id .check + :buffer buffer + :checker checker + :end-pos .end)))) + (let-alist (car (flycheck-parse-json output)) + .data.errors)))) +#+end_src + +* SPLITS +I set splits to default to opening on the right using 'prefer-horizontal-split'. +I set a keybinding for 'clone-indirect-buffer-other-window' for when I want to +have the same document in two splits. The text of the indirect buffer is always +identical to the text of its base buffer; changes made by editing either one are +visible immediately in the other. But in all other respects, the indirect +buffer and its base buffer are separate. For example, I can fold one split but +the other remains unfolded. + +#+begin_src emacs-lisp +(defun prefer-horizontal-split () + (set-variable 'split-height-threshold nil t) + (set-variable 'split-width-threshold 40 t)) ; make this as low as needed +(add-hook 'markdown-mode-hook 'prefer-horizontal-split) +(map! :leader + :desc "Clone indirect buffer other window" "b c" #'clone-indirect-buffer-other-window) +#+end_src + +* TWITTER +Needed to login on twitter. + +#+begin_src emacs-lisp +(setq twittering-allow-insecure-server-cert t) +#+end_src + +* WINNER MODE +Winner mode comes with GNU Emacs since version 20. This is a global minor mode +and, when activated, it allows you to “undo” (and “redo”) changes in the window +configuration with the key commands 'SCP w ' and 'SPC w '. + +#+begin_src emacs-lisp +(map! :leader + (:prefix ("w" . "window") + :desc "Winner redo" "" #'winner-redo + :desc "Winner undo" "" #'winner-undo)) +#+end_src + +* ZAP TO CHAR +Emacs provides a 'zap-to-char' command that kills from the current point to a +character. It bounds to 'M-z' in standard GNU Emacs but since Doom Emacs uses +'SPC' as its leader key and does not have 'SPC z' binding to anything, it just +makes since to use it for 'zap-to-char'. Note that 'zap-to-char' can combine +with the universal argument 'SPC u' to modify its behaviour. Examples of +'zap-to-char' usage listed in the table below: + +| KEYBINDING | WHAT IS DOES | +|---------------------------+------------------------------------------------------------| +| SPC z e | deletes all chars to the next occurrence of 'e' | +| SPC u 2 SPC z e | deletes all chars to the second occurrence of 'e' | +| SPC u - SPC z e | deletes all chars to the previous occurrence of 'e' | +| SPC u -2 SPC z e | deletes all chars to the fourth previous occurrence of 'e' | +| SPC u 1 0 0 SPC u SPC z e | deletes all chars to the 100th occurrence of 'e' | + +=TIP= The universal argument (SPC u) can only take a single integer by default. +If you need to use a multi-digit number (like 100 in the last example in the +table above), then you must terminate the universal argument with another 'SPC +u' after typing the number. + +'zap-up-to-char' is an alternative command that does not zap the char specified. +It bounds to 'SPC Z'. It can also combine in conjunction with the universal +argument 'SPC u' in similar fashion to the 'zap-to-char' examples above. + +=NOTE= Vim (evil mode) has similar functionality builtin. You can delete to +the next occurrence of 'e' by using 'dte' in normal. To delete to the next +occurrence of 'e' including the 'e', then you would use 'dfe'. And you can +modify 'dt' and 'df' by prefixing them with numbers, so '2dte' would delete to +the second occurrence of 'e'. + +#+begin_src emacs-lisp +(map! :leader + :desc "Zap to char" "z" #'zap-to-char + :desc "Zap up to char" "Z" #'zap-up-to-char) +#+end_src + +# LocalWords: ibuffer dired elisp setq modeline libnotify Proselint DT's SPC +# LocalWords: GitLab unmark emacsclient modeline Goto emms eww Transclusion +# LocalWords: Inlinetask LSP diff --git a/dotfiles/doom/custom.el b/dotfiles/doom/custom.el new file mode 100644 index 0000000..be0e9b7 --- /dev/null +++ b/dotfiles/doom/custom.el @@ -0,0 +1,21 @@ +(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. + '(flycheck-flake8-maximum-line-length 88) + '(safe-local-variable-values + '((org-hugo-auto-export-on-save . t) + (org-hugo-base-dir . /home/jawz/Development/Websites/portfolio/) + (git-commit-major-mode . git-commit-elisp-text-mode)))) +(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. + '(org-document-title ((t (:inherit outline-1 :height 2.0)))) + '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.3)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.2)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0))))) diff --git a/dotfiles/doom/init.el b/dotfiles/doom/init.el new file mode 100755 index 0000000..327b146 --- /dev/null +++ b/dotfiles/doom/init.el @@ -0,0 +1,192 @@ +;;; 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 + (corfu +orderless) ; complete with cap(f), cape and a flying feather! + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;(ivy +fuzzy +childframe +icons) ; 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 +github) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;indent-guides ; highlighted indent columns + ;;(ligatures +extra +iosevka) ; 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 +lsp) ; 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 + eww ; the internet is gross + ibuffer ; interactive buffer management + (undo +tree) ; 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 +hunspell) ; tasing you for misspelling mispelling + grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;collab ; buffers with friends + ;;debugger ; FIXME stepping through code, to help you add bugs + direnv + (docker +lsp) + editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + (lookup +dictionary + offline) ; navigate your code and its documentation + (lsp +peek) ; 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 + ;;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 (featurep :system 'macos) 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 +lsp +tree-sitter) ; 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 +lsp) ; the language you waited for + ;;(go +lsp) ; the hipster dialect + ;;(graphql +lsp) ; Give queries a REST + (haskell +lsp +tree-sitter) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + (json +lsp +tree-sitter) ; At least it ain't XML + ;;(java +lsp +tree-sitter) ; the poster child for carpal tunnel syndrome + (javascript +lsp +tree-sitter) ; 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 +lsp +tree-sitter) ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + (org +hugo +pretty +roam2) ; organize your plain life in plain text + ;;(php +lsp +tree-sitter) ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;; graphviz ; diagrams for confusing yourself even more + ;;purescript ; javascript, but functional + (python +pyright +lsp +tree-sitter) ; 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 +lsp +tree-sitter) ; 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 +lsp +tree-sitter) ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + calendar + ;;emms + everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + + :config + literate + (default +bindings +smartparens)) diff --git a/dotfiles/doom/packages.el b/dotfiles/doom/packages.el new file mode 100755 index 0000000..dd99bd9 --- /dev/null +++ b/dotfiles/doom/packages.el @@ -0,0 +1,93 @@ +;; -*- 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) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format + ;(package! another-package + ; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': + ;(package! this-package + ; :recipe (:host github :repo "username/repo" + ; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: + ;(package! builtin-package :disable t) + +;; 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: + ;(package! builtin-package :recipe (:nonrecursive t)) + ;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) + ;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. + ;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... + ;(unpin! pinned-package) +;; ...or multiple packages + ;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) + ;(unpin! t) + +;; (package! nixos-options) ;; enable when migrating to nixos +;; (package! quick-preview) ;; preview files with sushi + + +;; (package! codeium :recipe (:host github :repo "Exafunction/codeium.el")) +(package! config-general-mode) +(package! dired-open) +(package! dired-subtree) +(package! doom-modeline-now-playing) +(package! ini-mode) +(package! insert-esv) ;; bible passages +(package! olivetti) ;; writing mode centering text, looks like word +(package! org-auto-tangle) +(package! org-roam-ui) +(package! org-transclusion) +(package! peep-dired) ;; kind of cool but never could make it work +(package! php-cs-fixer) +(package! systemd) +;; (package! 2048-game) +;; (package! academic-phrases) +;; (package! caddyfile-mode) +;; (package! clippy) +;; (package! crontab-mode) ;; crontab colors +;; (package! evil-tutor) ;; vim tutorial +;; (package! ewal) ;; theme colors based on pywal +;; (package! ewal-doom-themes) +;; (package! ewal-evil-cursors) +;; (package! fish-completion) ;; what does it do??????????????????????????? +;; (package! flycheck-aspell) +;; (package! ivy-posframe) +;; (package! mw-thesaurus) +;; (package! org-alert) +;; (package! org-appear) ;; couldn't get it to work +;; (package! org-recur) ;; works but I want to keep org vanilla +;; (package! ox-chameleon +;; :recipe (:host github :repo "tecosaur/ox-chameleon")) +;; (package! renpy) +;; (package! resize-window) +;; (package! tldr) +;; (package! typit) ;; type speed test +;; (package! vimgolf) ;; vim puzzles +;; (package! wc-mode) ;; displays character count of buffer diff --git a/dotfiles/doom/templates/default.org b/dotfiles/doom/templates/default.org new file mode 100755 index 0000000..50d062d --- /dev/null +++ b/dotfiles/doom/templates/default.org @@ -0,0 +1 @@ +%? diff --git a/dotfiles/doom/templates/events.org b/dotfiles/doom/templates/events.org new file mode 100644 index 0000000..dd15ac1 --- /dev/null +++ b/dotfiles/doom/templates/events.org @@ -0,0 +1,21 @@ +%? + +* Sources +1. + +* Belligerents +1. + +* Casualties and losses + +* Location + +* Causes + +* Events + +* Major Contention Events + +* Outcome + +* Important Notes diff --git a/dotfiles/doom/templates/programming.org b/dotfiles/doom/templates/programming.org new file mode 100755 index 0000000..5937a71 --- /dev/null +++ b/dotfiles/doom/templates/programming.org @@ -0,0 +1,13 @@ +%? + +- Influenced by +- Influenced +- Related tools + +* Hello World + +* Tips + +* Resources +- Documentation +- YouTube channels diff --git a/flake.lock b/flake.lock index 51957c4..00de854 100644 --- a/flake.lock +++ b/flake.lock @@ -116,6 +116,45 @@ "type": "github" } }, + "doomemacs": { + "flake": false, + "locked": { + "lastModified": 1733434763, + "narHash": "sha256-sebujw5VvBWMS+wXyjiGF81iyjPM/QQDnw5l7tDJCvk=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "ba1dca322f9a07bc2b7bec6a98f2c3c55c0bbd77", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "type": "github" + } + }, + "emacs-overlay": { + "inputs": { + "nixpkgs": [ + "nix-doom-emacs-unstraightened" + ], + "nixpkgs-stable": [ + "nix-doom-emacs-unstraightened" + ] + }, + "locked": { + "lastModified": 1734423772, + "narHash": "sha256-AN8gnO871LRm1vvclMqXt+YWS5fJeX5BE2BDuaIQdHs=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "840a2fa3e9d546ecbcc080ee13bf6aa0e8697b10", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -528,9 +567,7 @@ }, "jawz-scripts": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1734312686, @@ -546,6 +583,27 @@ "url": "ssh://git@gitlab.com/CaptainJawZ/scripts-flake.git" } }, + "nix-doom-emacs-unstraightened": { + "inputs": { + "doomemacs": "doomemacs", + "emacs-overlay": "emacs-overlay", + "nixpkgs": "nixpkgs_2", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1734424909, + "narHash": "sha256-P06anJ94BOMY8wIlOrpZ4+wDG63zDUz8hTWU757dlgM=", + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "rev": "3923ae495bf08dffd21efef50b04b074a54299b1", + "type": "github" + }, + "original": { + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "type": "github" + } + }, "nix-gaming": { "inputs": { "flake-parts": "flake-parts", @@ -570,18 +628,14 @@ }, "nixpkgs": { "locked": { - "lastModified": 1734119587, + "lastModified": 0, "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", - "type": "github" + "path": "/nix/store/22r7q7s9552gn1vpjigkbhfgcvhsrz68-source", + "type": "path" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-lib": { @@ -612,6 +666,34 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 0, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "path": "/nix/store/22r7q7s9552gn1vpjigkbhfgcvhsrz68-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1734119587, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": "flake-parts_2", @@ -663,8 +745,9 @@ "home-manager": "home-manager", "hyprland": "hyprland", "jawz-scripts": "jawz-scripts", + "nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened", "nix-gaming": "nix-gaming", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_3", "nur": "nur", "sops-nix": "sops-nix", "stylix": "stylix", @@ -704,7 +787,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2", + "systems": "systems_3", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-tmux": "tinted-tmux" @@ -753,6 +836,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 8491930..afaac84 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,8 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; ucodenix.url = "github:e-tho/ucodenix"; + nix-doom-emacs-unstraightened.url = "github:marienz/nix-doom-emacs-unstraightened"; + jawz-scripts.url = "git+ssh://git@gitlab.com/CaptainJawZ/scripts-flake.git"; nur = { url = "github:nix-community/nur"; inputs.nixpkgs.follows = "nixpkgs"; @@ -27,10 +29,7 @@ url = "github:danth/stylix"; inputs.nixpkgs.follows = "nixpkgs"; }; - jawz-scripts = { - url = "git+ssh://git@gitlab.com/CaptainJawZ/scripts-flake.git"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + }; outputs = @@ -42,7 +41,6 @@ inherit system; config.allowUnfree = true; }; - overlayFile = import ./overlay.nix { inherit pkgs; }; lib = inputs.nixpkgs.lib // inputs.home-manager.lib; createConfig = name: @@ -52,7 +50,12 @@ inherit inputs outputs; }; modules = [ - { nixpkgs.overlays = [ overlayFile ]; } + { + nixpkgs.overlays = [ + (import ./overlay.nix { inherit pkgs; }) + inputs.nix-doom-emacs-unstraightened.overlays.default + ]; + } ./hosts/${name}/configuration.nix inputs.nur.modules.nixos.default inputs.sops-nix.nixosModules.sops diff --git a/home-manager.nix b/home-manager.nix index 4bb8af8..77cd8e2 100644 --- a/home-manager.nix +++ b/home-manager.nix @@ -1,6 +1,10 @@ { config, ... }: { home.stateVersion = "24.11"; + stylix.targets = { + emacs.enable = true; + vesktop.enable = true; + }; programs.bash = { enable = true; historyFile = "\${XDG_STATE_HOME}/bash/history"; diff --git a/modules/dev/emacs.nix b/modules/dev/emacs.nix index 3af6e05..c8e73fa 100644 --- a/modules/dev/emacs.nix +++ b/modules/dev/emacs.nix @@ -1,4 +1,5 @@ { + inputs, config, lib, pkgs, @@ -24,42 +25,54 @@ }; }; }; - users.users.jawz.packages = - builtins.attrValues { - inherit (pkgs.xorg) xwininfo; - inherit (pkgs) - xdotool - xclip - wl-clipboard-rs - ; - } - ++ builtins.attrValues { - inherit (pkgs) - fd # modern find, faster searches - fzf # fuzzy finder! super cool and useful - ripgrep # modern grep - tree-sitter # code parsing based on symbols and shit, I do not get it - graphviz # graphs - tetex # export pdf - languagetool # proofreader for English - - # lsps - yaml-language-server - markdownlint-cli - ; - inherit (pkgs.nodePackages) - vscode-json-languageserver - prettier # multi-language linter - ; - }; services.emacs = { enable = true; - package = - let - emacsPackages = (pkgs.emacsPackagesFor pkgs.emacs-gtk).emacsWithPackages; - in - emacsPackages (epkgs: [ epkgs.vterm ]); + package = pkgs.emacsWithDoom { + doomDir = ../../dotfiles/doom; + doomLocalDir = "~/.local/share/nix-doom"; + emacs = pkgs.emacs-gtk; + extraPackages = + epkgs: + let + extraPackages = config.home-manager.users.jawz.programs.emacs.extraPackages epkgs; + in + extraPackages + ++ [ + (epkgs.trivialBuild { + pname = "stylix-theme"; + # add config from doom's ui/doom module + src = pkgs.writeText "stylix-theme.el" config.home-manager.users.jawz.programs.emacs.extraConfig; + version = "0.1.0"; + packageRequires = extraPackages; + }) + ]; + extraBinPackages = builtins.attrValues { + inherit (pkgs.xorg) xwininfo; + inherit (pkgs) + xdotool + xclip + wl-clipboard-rs + + fd # modern find, faster searches + fzf # fuzzy finder! super cool and useful + ripgrep # modern grep + tree-sitter # code parsing based on symbols and shit, I do not get it + graphviz # graphs + tetex # export pdf + languagetool # proofreader for English + + # lsps + yaml-language-server + markdownlint-cli + ; + inherit (pkgs.nodePackages) + vscode-json-languageserver + prettier # multi-language linter + ; + }; + }; defaultEditor = true; + # extraPackages = [ pkgs.base16-stylix-theme ]; }; environment.variables.PATH = [ "\${XDG_CONFIG_HOME}/emacs/bin" ]; };