diff --git a/flake.lock b/flake.lock index bff9bbf..54ca7bb 100644 --- a/flake.lock +++ b/flake.lock @@ -25,16 +25,15 @@ ] }, "locked": { - "lastModified": 1693208669, - "narHash": "sha256-hHFaaUsZ860wvppPeiu7nJn/nXZjJfnqAQEu9SPFE9I=", + "lastModified": 1693713564, + "narHash": "sha256-00w2uwb4O6Y1e2W5LG5UFyl1ZN3KFG7aoRdYEvT/BqA=", "owner": "nix-community", "repo": "home-manager", - "rev": "5bac4a1c06cd77cf8fc35a658ccb035a6c50cd2c", + "rev": "8e49b883890ccb52c059abb152b00a416342ec1c", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", "repo": "home-manager", "type": "github" } @@ -140,16 +139,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1685566663, - "narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=", + "lastModified": 1693780807, + "narHash": "sha256-diV1X53HjSB3fIcDFieh9tGZkJ3vqJJQhTz89NbYw60=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4ecab3273592f27479a583fb6d975d4aba3486fe", + "rev": "84ef5335abf541d8148433489e0cf79affae3f89", "type": "github" }, "original": { "owner": "nixos", - "ref": "23.05", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 4d2d198..b8ae7fc 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,9 @@ description = "mehbark's NixOS configuration"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; diff --git a/home.nix b/home.nix index 289bb48..c772693 100644 --- a/home.nix +++ b/home.nix @@ -10,7 +10,6 @@ in home.packages = with pkgs; [ firefox - clojure # bsdgames # CRITICAL THREE fortune @@ -40,10 +39,15 @@ in sbcl chez racket + clojure discord steam fzf + + idris2 + # emacsPackages.idris2-mode + # emacsPackages.evil ]; programs.fish = { @@ -231,6 +235,7 @@ in enable = true; }; + services.emacs.client.enable = true; programs.emacs = { enable = true; }; diff --git a/init.el b/init.el new file mode 100644 index 0000000..a6515d1 --- /dev/null +++ b/init.el @@ -0,0 +1,951 @@ +;;; ________ _______ __ __ +;;; / | / \ / | / | +;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ +;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | +;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$ +(windmove-default-keybindings 'control) ; You can use other modifiers here + +;; Fix archaic defaults +(setq sentence-end-double-space nil) + +;; Make right-click do something sensible +(when (display-graphic-p) + (context-menu-mode)) + +;; Don't litter file system with *~ backup files; put them all inside +;; ~/.emacs.d/backup or wherever +(defun bedrock--backup-file-name (fpath) + "Return a new file path of a given file path. +If the new path's directories does not exist, create them." + (let* ((backupRootDir "~/.emacs.d/emacs-backup/") + (filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path + (backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") ))) + (make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath)) + backupFilePath)) +(setq make-backup-file-name-function 'bedrock--backup-file-name) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Discovery aids +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Show the help buffer after startup +; (add-hook 'after-init-hook 'help-quick) + +;; which-key: shows a popup of available keybindings when typing a long key +;; sequence (e.g. C-x ...) +(use-package which-key + :ensure t + :config + (which-key-mode)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Minibuffer/completion settings +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion + +(setq enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer +(setq completion-cycle-threshold 1) ; TAB cycles candidates +(setq completions-detailed t) ; Show annotations +(setq tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent +(setq completion-styles '(basic initials substring)) ; Different styles to match input to candidates + +(setq completion-auto-help 'always) ; Open completion always; `lazy' another option +(setq completions-max-height 20) ; This is arbitrary +(setq completions-detailed t) +(setq completions-format 'one-column) +(setq completions-group t) +(setq completion-auto-select 'second-tab) ; Much more eager +;(setq completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values + +(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell + +;; For a fancier built-in completion option, try ido-mode or fido-mode. See also +;; the file extras/base.el +;(fido-vertical-mode) +;(setq icomplete-delay-completions-threshold 4000) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Interface enhancements/defaults +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Mode line information +(setq line-number-mode t) ; Show current line in modeline +(setq column-number-mode t) ; Show column as well + +(setq x-underline-at-descent-line nil) ; Prettier underlines +(setq switch-to-buffer-obey-display-actions t) ; Make switching buffers more consistent + +(setq-default show-trailing-whitespace nil) ; By default, don't underline trailing spaces +(setq-default indicate-buffer-boundaries 'left) ; Show buffer top and bottom in the margin + +;; Enable horizontal scrolling +(setq mouse-wheel-tilt-scroll t) +(setq mouse-wheel-flip-direction t) + +;; We won't set these, but they're good to know about +;; +;; (setq-default indent-tabs-mode nil) +;; (setq-default tab-width 4) + +;; Misc. UI tweaks +(blink-cursor-mode -1) ; Steady cursor +(pixel-scroll-precision-mode) ; Smooth scrolling + +;; Use common keystrokes by default +; (cua-mode) + +;; Display line numbers in programming mode +(add-hook 'prog-mode-hook 'display-line-numbers-mode) +(setq-default display-line-numbers-width 3) ; Set a minimum width + +;; Nice line wrapping when working with text +(add-hook 'text-mode-hook 'visual-line-mode) + +;; Modes to highlight the current line with +(let ((hl-line-hooks '(text-mode-hook prog-mode-hook))) + (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Tab-bar configuration +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Show the tab-bar as soon as tab-bar functions are invoked +(setq tab-bar-show 0) + +;; Add the time to the tab-bar, if visible +;(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append) +;(add-to-list 'tab-bar-format 'tab-bar-format-global 'append) +;(setq display-time-format "%a %F %T") +;(setq display-time-interval 1) +;(display-time-mode) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Theme +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package emacs + :config + (load-theme 'gruvbox-dark-soft)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Optional extras +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Uncomment the (load-file …) lines or copy code from the extras/ elisp files +;; as desired + +;; UI/UX enhancements mostly focused on minibuffer and autocompletion interfaces +;; These ones are *strongly* recommended! +; (load-file (expand-file-name "extras/base.el" user-emacs-directory)) + +; ;; Packages for software development +; (load-file (expand-file-name "extras/dev.el" user-emacs-directory)) + +; ;; Vim-bindings in Emacs (evil-mode configuration) +; (load-file (expand-file-name "extras/vim-like.el" user-emacs-directory)) + +; ;; scheme-relevant stuff (includes slime) +; (load-file (expand-file-name "extras/scheme.el" user-emacs-directory)) + +;; Org-mode configuration +;; WARNING: need to customize things inside the elisp file before use! See +;; the file extras/org-intro.txt for help. +; (load-file (expand-file-name "extras/org.el" user-emacs-directory)) + +;; Email configuration in Emacs +;; WARNING: needs the `mu' program installed; see the elisp file for more +;; details. +;(load-file (expand-file-name "extras/email.el" user-emacs-directory)) + +;; Tools for academic researchers +;(load-file (expand-file-name "extras/researcher.el" user-emacs-directory)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Built-in customization framework +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(setq w32-recognize-altgr nil) +(scroll-bar-mode -1) + +(use-package all-the-icons-ivy + :ensure t) + +(use-package counsel + :ensure t) + +(use-package gruvbox-theme + :ensure t) + +;; (set-fringe-mode 'minimal) + +;; (use-package general +;; :ensure t) + +;; (use-package lsp-mode +;; :ensure t) +;;; Emacs Bedrock +;;; +;;; Extra config: Base UI enhancements + +;;; Usage: Append or require this file from init.el to enable various UI/UX +;;; enhancements. + +;;; Contents: +;;; +;;; - Motion aids +;;; - Power-ups: Embark and Consult +;;; - Minibuffer and completion + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Motion aids +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package avy + :ensure t + :demand t + :bind (("C-c j" . avy-goto-line) + ("s-j" . avy-goto-char-timer))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Power-ups: Embark and Consult +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Consult: Misc. enhanced commands +(use-package consult + :ensure t + ;; Other good things to bind: consult-ripgrep, consult-line-multi, + ;; consult-history, consult-outline + :bind (("C-x b" . consult-buffer) ; orig. switch-to-buffer + ("M-y" . consult-yank-pop) ; orig. yank-pop + ("C-s" . consult-line)) ; orig. isearch + :config + ;; Narrowing lets you restrict results to certain groups of candidates + (setq consult-narrow-key "<")) + +(use-package embark + :ensure t + :demand t + :after avy + :bind (("C-c a" . embark-act)) ; bind this to an easy key to hit + :init + ;; Add the option to run embark when using avy + (defun bedrock/avy-action-embark (pt) + (unwind-protect + (save-excursion + (goto-char pt) + (embark-act)) + (select-window + (cdr (ring-ref avy-ring 0)))) + t) + + ;; After invoking avy-goto-char-timer, hit "." to run embark at the next + ;; candidate you select + (setf (alist-get ?. avy-dispatch-alist) 'bedrock/avy-action-embark)) + +(use-package embark-consult + :ensure t) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Minibuffer and completion +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Vertico: better vertical completion for minibuffer commands +(use-package vertico + :ensure t + :init + ;; You'll want to make sure that e.g. fido-mode isn't enabled + (vertico-mode)) + +(use-package vertico-directory + :after vertico + :bind (:map vertico-map + ("M-DEL" . vertico-directory-delete-word))) + +;; Marginalia: annotations for minibuffer +(use-package marginalia + :ensure t + :config + (marginalia-mode)) + +;; Popup completion-at-point +(use-package corfu + :ensure t + :init + (global-corfu-mode) + :bind + (:map corfu-map + ("SPC" . corfu-insert-separator) + ("C-n" . corfu-next) + ("C-p" . corfu-previous))) + +;; Part of corfu +(use-package corfu-popupinfo + :after corfu + :hook (corfu-mode . corfu-popupinfo-mode) + :custom + (corfu-popupinfo-delay '(0.25 . 0.1)) + (corfu-popupinfo-hide nil) + :config + (corfu-popupinfo-mode)) + +;; Make corfu popup come up in terminal overlay +(use-package corfu-terminal + :if (not (display-graphic-p)) + :ensure t + :config + (corfu-terminal-mode)) + +;; Pretty icons for corfu +(use-package kind-icon + :if (display-graphic-p) + :ensure t + :after corfu + :config + (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) + +(use-package eshell + :bind (("C-r" . consult-history))) + +;; Orderless: powerful completion style +(use-package orderless + :ensure t + :config + (setq completion-styles '(orderless))) +;;; Emacs Bedrock +;;; +;;; Extra config: Development tools + +;;; Usage: Append or require this file from init.el for some software +;;; development-focused packages. +;;; +;;; It is **STRONGLY** recommended that you use the base.el config if you want to +;;; use Eglot. Lots of completion things will work better. +;;; +;;; This will try to use tree-sitter modes for many languages. Please run +;;; +;;; M-x treesit-install-language-grammar +;;; +;;; Before trying to use a treesit mode. + +;;; Contents: +;;; +;;; - Built-in config for developers +;;; - Version Control +;;; - Common file types +;;; - Eglot, the built-in LSP client for Emacs + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Built-in config for developers +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package emacs + :config + ;; Treesitter config + + ;; Tell Emacs to prefer the treesitter mode + ;; You'll want to run the command `M-x treesit-install-language-grammar' before editing. + (setq major-mode-remap-alist + '((yaml-mode . yaml-ts-mode) + (bash-mode . bash-ts-mode) + (js2-mode . js-ts-mode) + (typescript-mode . typescript-ts-mode) + (json-mode . json-ts-mode) + (css-mode . css-ts-mode) + (python-mode . python-ts-mode))) + :hook + ;; Auto parenthesis matching + ((prog-mode . electric-pair-mode))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Version Control +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Magit: best Git client to ever exist +(use-package magit + :ensure t + :bind (("s-g" . magit-status) + ("C-c g" . magit-status))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Common file types +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package markdown-mode + :hook ((markdown-mode . visual-line-mode))) + +(use-package yaml-mode + :ensure t) + +(use-package json-mode + :ensure t) + +;; Emacs ships with a lot of popular programming language modes. If it's not +;; built in, you're almost certain to find a mode for the language you're +;; looking for with a quick Internet search. + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Eglot, the built-in LSP client for Emacs +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package eglot + ;; no :ensure t here because it's built-in + + ;; Configure hooks to automatically turn-on eglot for selected modes + ; :hook + ; (((python-mode ruby-mode elixir-mode) . eglot)) + + :custom + (eglot-send-changes-idle-time 0.1) + + :config + (fset #'jsonrpc--log-event #'ignore) ; massive perf boost---don't log every event + ;; Sometimes you need to tell Eglot where to find the language server + ; (add-to-list 'eglot-server-programs + ; '(haskell-mode . ("haskell-language-server-wrapper" "--lsp"))) + ) + + ;; ;;;; ;;;; +;; ;; ;; ;; ;; +;; ;; ;;;; ;; +;; ;; ;; ;; ;; ;; + ;; ;; ;; ;;;; + +;;; Emacs Bedrock +;;; +;;; Extra config: Org-mode starter config + +;;; Usage: Append or require this file from init.el for some software +;;; development-focused packages. +;;; +;;; Org-mode is a fantastically powerful package. It does a lot of things, which +;;; makes it a little difficult to understand at first. +;;; +;;; We will configure Org-mode in phases. Work with each phase as you are +;;; comfortable. +;;; +;;; YOU NEED TO CONFIGURE SOME VARIABLES! The most important variable is the +;;; `org-directory', which tells org-mode where to look to find your agenda +;;; files. + +;;; See "org-intro.txt" for a high-level overview. + +;;; Contents: +;;; +;;; - Critical variables +;;; - Phase 1: editing and exporting files +;;; - Phase 2: todos, agenda generation, and task tracking +;;; - Phase 3: extensions (org-roam, etc.) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Critical variables +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; These variables need to be set for Org-mode's full power to be unlocked! +;;; +;;; You can read the documentation for any variable with `C-h v'. If you have +;;; Consult configured (see the `base.el' file) then it should help you find +;;; what you're looking for. + +;;; Phase 1 variables + +;;; Phase 2 variables + +;; Agenda variables +(setq org-directory "~/Documents/org/") ; Non-absolute paths for agenda and + ; capture templates will look here. +(setq org-agenda-files '("inbox.org" "work.org")) + +;; Default tags +(setq org-tag-alist '( + ;; locale + (:startgroup) + ("home" . ?h) + ("work" . ?w) + ("school" . ?s) + (:endgroup) + (:newline) + ;; scale + (:startgroup) + ("one-shot" . ?o) + ("project" . ?j) + ("tiny" . ?t) + (:endgroup) + ;; misc + ("meta") + ("review") + ("reading"))) + +;; Org-refile: where should org-refile look? +(setq org-refile-targets 'FIXME) + +;;; Phase 3 variables + +;; Org-roam variables +(setq org-roam-directory "~/Documents/org-roam/") +(setq org-roam-index-file "~/Documents/org-roam/index.org") + +;;; Optional variables + +;; Advanced: Custom link types +;; This example is for linking a person's 7-character ID to their page on the +;; free genealogy website Family Search. +(setq org-link-abbrev-alist + '(("family_search" . "https://www.familysearch.org/tree/person/details/%s"))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Phase 1: editing and exporting files +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package org + :hook ((org-mode . visual-line-mode) ; wrap lines at word breaks + (org-mode . flyspell-mode)) ; spell checking! + + :bind (:map global-map + ("C-c l s" . org-store-link) ; Mnemonic: link → store + ("C-c l i" . org-insert-link-global)) ; Mnemonic: link → insert + :config + (require 'oc-csl) ; citation support + (add-to-list 'org-export-backends 'md) + + ;; Make org-open-at-point follow file links in the same window + (setf (cdr (assoc 'file org-link-frame-setup)) 'find-file) + + ;; Make exporting quotes better + (setq org-export-with-smart-quotes t) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Phase 2: todos, agenda generation, and task tracking +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Yes, you can have multiple use-package declarations. It's best if their +;; configs don't overlap. Once you've reached Phase 2, I'd recommend merging the +;; config from Phase 1. I've broken it up here for the sake of clarity. +(use-package org + :config + ;; Instead of just two states (TODO, DONE) we set up a few different states + ;; that a task can be in. + (setq org-todo-keywords + '((sequence "TODO(t)" "WAITING(w@/!)" "STARTED(s!)" "|" "DONE(d!)" "OBSOLETE(o@)"))) + + ;; Refile configuration + (setq org-outline-path-complete-in-steps nil) + (setq org-refile-use-outline-path 'file) + + (setq org-capture-templates + '(("c" "Default Capture" entry (file "inbox.org") + "* TODO %?\n%U\n%i") + ;; Capture and keep an org-link to the thing we're currently working with + ("r" "Capture with Reference" entry (file "inbox.org") + "* TODO %?\n%U\n%i\n%a") + ;; Define a section + ("w" "Work") + ("wm" "Work meeting" entry (file+headline "work.org" "Meetings") + "** TODO %?\n%U\n%i\n%a") + ("wr" "Work report" entry (file+headline "work.org" "Reports") + "** TODO %?\n%U\n%i\n%a"))) + + (setq org-agenda-custom-commands + '(("n" "Agenda and All Todos" + ((agenda) + (todo))) + ("w" "Work" agenda "" + ((org-agenda-files '("work.org"))))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Phase 3: extensions (org-roam, etc.) +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package org-roam + :ensure t + :config + (org-roam-db-autosync-mode) + ;; Dedicated side window for backlinks + (add-to-list 'display-buffer-alist + '("\\*org-roam\\*" + (display-buffer-in-side-window) + (side . right) + (window-width . 0.4) + (window-height . fit-window-to-buffer)))) + +;; Pretty web interface for org-roam +;(use-package org-roam-ui +; :ensure t +; :after org-roam +; :config +; (setq org-roam-ui-sync-theme t +; org-roam-ui-follow t +; org-roam-ui-update-on-save t +; org-roam-ui-open-on-start t)) + +;;;;;; ;;;;;; ;; ;; ;;;;;; ;; ;; ;;;;;; +;; ;; ;; ;; ;; ;;;; ;;;; ;; +;;;;;; ;; ;;;;;; ;;;; ;; ;; ;; ;;;; + ;; ;; ;; ;; ;; ;; ;; ;; +;;;;;; ;;;;;; ;; ;; ;;;;;; ;; ;; ;;;;;; + +(setq scheme-program-name "chez") + +(use-package paredit + :ensure t + :hook ((emacs-lisp-mode . enable-paredit-mode) + (eval-expression-minibuffer-setup . enable-paredit-mode) + (ielm-mode . enable-paredit-mode) + (lisp-mode . enable-paredit-mode) + (lisp-interaction-mode . enable-paredit-mode) + (scheme-mode . enable-paredit-mode) + ;; (inferior-scheme-mode . enable-paredit-mode) + (slime-repl-mode . enable-paredit-mode) + (clojure-mode . enable-paredit-mode) + (clojurescript-mode . enable-paredit-mode) + (cider-repl-mode . enable-paredit-mode) + (cider-mode . enable-paredit-mode) + (clojure-mode . enable-paredit-mode)) + :config + (show-paren-mode t)) + +(use-package rainbow-delimiters + :ensure t + :init + (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode) + (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode) + (add-hook 'scheme-mode-hook #'rainbow-delimiters-mode) + ) + +;; (use-package lsp-scheme +;; :ensure t +;; :init +;; (add-hook 'scheme-mode-hook #'lsp-scheme) +;; :config +;; ) + +;; (use-package scheme-complete +;; :ensure t +;; :config +;; (define-key scheme-mode-map "\t" 'scheme-smart-complete)) + +;; (use-package lispyville +;; :init +;; (general-add-hook '(emacs-lisp-mode-hook lisp-mode-hook scheme-mode-hook) #'lispyville-mode) +;; :config) + +;; (use-package slime :ensure t +;; :init +;; (setq slime-contribs '(slime-fancy) +;; slime-complete-symbol-function 'slime-fuzzy-complete-symbol +;; slime-net-coding-system 'utf-8-unix +;; slime-lisp-implementations '((ccl64 ("/usr/local/bin/ccl64")) +;; (sbcl ("/usr/local/bin/sbcl")) +;; (abcl ("/usr/local/bin/abcl")) +;; (clisp ("/usr/local/bin/clisp")) +;; (ccl ("/usr/local/bin/ccl")))) +;; :config +;; (setq common-lisp-hyperspec-root "/usr/local/share/doc/hyperspec/HyperSpec/" +;; common-lisp-hyperspec-symbol-table (concat common-lisp-hyperspec-root "Data/Map_Sym.txt") +;; common-lisp-hyperspec-issuex-table (concat common-lisp-hyperspec-root "Data/Map_IssX.txt"))) + +;;; Emacs Bedrock +;;; +;;; Extra config: Vim emulation + +;;; Usage: Append or require this file from init.el for bindings in Emacs. + +;;; Contents: +;;; +;;; - Core Packages + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Core Packages +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;;;; ;; ;; ;;;;;; ;; +;; ;; ;; ;; ;; +;;;; ;; ;; ;; ;; +;; ;; ;; ;; ;; +;;;;;; ;; ;;;;;; ;;;;;; + +; lisp sucks, scheme rulez +;; (defun make-file-opener (filename) +;; (lambda () +;; (interactive (concat "sopen " filename " for editing")) +;; (find-file filename))) + +(defun open-init.el () + (interactive) + (find-file "~/.emacs.d/init.el")) +(defun open-vim-like.el () + (interactive) + (find-file "~/.emacs.d/extras/vim-like.el")) +(defun open-scheme.el () + (interactive) + (find-file "~/.emacs.d/extras/scheme.el")) +; emacs lisp really is a pain, but even this makes me appreciate the POWA +(defun scheme-set-up-two-panels-with-repl-and-editor () + (interactive) + (let ((editor (current-buffer))) + (scheme-mode) + (run-scheme "chez") + (split-window-right) + (switch-to-buffer editor))) + +(use-package evil + :ensure t + + :init + (setq evil-respect-visual-line-mode t) + (setq evil-undo-system 'undo-redo) + + ;; Enable this if you want C-u to scroll up, more like pure Vim +;(setq evil-want-C-u-scroll t) + + :config + ; >:D + (evil-mode 1) + + ;; Configuring initial major mode for some modes + ; (evil-set-initial-state 'vterm-mode 'emacs) + + ; basic convenience + (evil-global-set-key 'normal ";w" 'evil-save) + + (evil-global-set-key 'normal ";g" 'magit) + + ; mgmt of modes i want to toggle more often + (evil-global-set-key 'normal ";mp" 'paredit-mode) + + ; buffers + (evil-global-set-key 'normal ";be" 'counsel-switch-buffer) + (evil-global-set-key 'normal ";bn" 'evil-buffer) + (evil-global-set-key 'normal ";bs" 'evil-split-buffer) + + ; config mgmt + (evil-global-set-key 'normal ";ce" 'open-init.el) + ; (evil-global-set-key 'normal ";cev" 'open-vim-like.el) + ; (evil-global-set-key 'normal ";ces" 'open-scheme.el) + (evil-global-set-key 'normal ";cr" 'restart-emacs) + + ; scheme + ; should probably just move these to scheme.el + ; si => scheme inferior (avoids conflicts) + (evil-global-set-key 'normal ";sir" 'run-scheme) + (evil-global-set-key 'normal ";sil" 'scheme-load-file) + (evil-global-set-key 'normal ";sii" 'scheme-set-up-two-panels-with-repl-and-editor) + + ; ss => scheme send + (evil-global-set-key 'normal ";sss" 'scheme-send-last-sexp) + (evil-global-set-key 'normal ";ssr" 'scheme-send-region) + (evil-global-set-key 'normal ";ssd" 'scheme-send-definition) + + (evil-global-set-key 'visual ";ssr" 'scheme-send-region) + + ; scheme/lispy-editing + (evil-global-set-key 'normal ";swp" 'paredit-wrap-round) + (evil-global-set-key 'normal ";swb" 'paredit-wrap-square) + (evil-global-set-key 'normal ";swc" 'paredit-wrap-curly) + (evil-global-set-key 'normal ";swa" 'paredit-wrap-angled) + + ; gonna just port most of my vscode stuff even though i don't hate the C- stuff + (evil-global-set-key 'normal ";sh" 'paredit-backward-slurp-sexp) + (evil-global-set-key 'normal ";sl" 'paredit-forward-slurp-sexp) + (evil-global-set-key 'normal ";bh" 'paredit-backward-barf-sexp) + (evil-global-set-key 'normal ";bl" 'paredit-forward-barf-sexp) + + (evil-global-set-key 'normal ";st" 'paredit-forward-barf-sexp) + ) + +(use-package evil-goggles + :ensure t + + :init + (setq evil-goggles-pulse t) + ; i don't like how deleted stuff says so long + (setq evil-goggles-blocking-duration 0.1) + + :config + (evil-goggles-mode) + (evil-goggles-use-diff-faces)) + +(use-package evil-surround + :ensure t + :config + (global-evil-surround-mode 1)) + +(use-package evil-commentary + :ensure t + :config + (evil-commentary-mode)) + +(use-package evil-org + :ensure t + :config + (evil-commentary-mode)) + +; hi nix