This commit is contained in:
Michael Thomson 2025-04-17 19:55:32 -04:00
parent 71528ed396
commit 79c25224b1
13 changed files with 660 additions and 349 deletions

66
flake.lock generated
View File

@ -20,11 +20,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743265529, "lastModified": 1744289235,
"narHash": "sha256-QbjP15/2N+VJl0b5jxrrTc+VOt39aU4XrDvtP0Lz5ik=", "narHash": "sha256-ZFkHLdimtFzQACsVVyZkZlfYdj4iNy3PkzXfrwmlse8=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "aquamarine", "repo": "aquamarine",
"rev": "1d2dbd72c2bbaceab031c592d4810f744741d203", "rev": "c8282f4982b56dfa5e9b9f659809da93f8d37e7a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -117,11 +117,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743136572, "lastModified": 1744833442,
"narHash": "sha256-uwaVrKgi6g1TUq56247j6QvvFtYHloCkjCrEpGBvV54=", "narHash": "sha256-BBMWW2m64Grcc5FlXz74+vdkUyCJOfUGnl+VcS/4x44=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1efd2503172016a6742c87b47b43ca2c8145607d", "rev": "c6b75d69b6994ba68ec281bd36faebcc56097800",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -175,11 +175,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1739049071, "lastModified": 1743953322,
"narHash": "sha256-3+7TpXMrbsUXSwgr5VAKAnmkzMb6JO+Rvc9XRb5NMg4=", "narHash": "sha256-prQ5JKopXtzCMX2eT3dXbaVvGmzjMRE2bXStQDdazpM=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprgraphics", "repo": "hyprgraphics",
"rev": "175c6b29b6ff82100539e7c4363a35a02c74dd73", "rev": "9d7f2687c84c729afbc3b13f7937655570f2978d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -204,11 +204,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1743207575, "lastModified": 1744849150,
"narHash": "sha256-bNz2WfcZAF6hZkcEcRYFsoh49wNAamphS+NOhSrf5A0=", "narHash": "sha256-eaKqF4Oc7atN7Y2yTTeAOLN05q+G2YY0597ukgAD2Cs=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "7374a023eff964817c9e5fbe75a661540516f798", "rev": "225e13c3cc83308175f0a9aa18cfa31324155034",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -356,11 +356,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1741191527, "lastModified": 1744468525,
"narHash": "sha256-kM+11Nch47Xwfgtw2EpRitJuORy4miwoMuRi5tyMBDY=", "narHash": "sha256-9HySx+EtsbbKlZDlY+naqqOV679VdxP6x6fP3wxDXJk=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlang", "repo": "hyprlang",
"rev": "72df3861f1197e41b078faa3e38eedd60e00018d", "rev": "f1000c54d266e6e4e9d646df0774fac5b8a652df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -454,11 +454,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743221873, "lastModified": 1744478979,
"narHash": "sha256-i8VPNm4UBsC3Ni6VwjojVJvCpS9GZ4vPrpFRtCGJzBs=", "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "53d0f0ed11487a4476741fde757d0feabef4cc4e", "rev": "43975d782b418ebf4969e9ccba82466728c2851b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -520,11 +520,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1743167577, "lastModified": 1744633460,
"narHash": "sha256-I09SrXIO0UdyBFfh0fxDq5WnCDg8XKmZ1HQbaXzMA1k=", "narHash": "sha256-fbWE4Xpw6eH0Q6in+ymNuDwTkqmFmtxcQEmtRuKDTTk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "0ed819e708af17bfc4bbc63ee080ef308a24aa42", "rev": "9a049b4a421076d27fee3eec664a18b2066824cb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -536,11 +536,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1743827369, "lastModified": 1744463964,
"narHash": "sha256-rpqepOZ8Eo1zg+KJeWoq1HAOgoMCDloqv5r2EAa9TSA=", "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "42a1c966be226125b48c384171c44c651c236c22", "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -584,11 +584,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1743095683, "lastModified": 1744463964,
"narHash": "sha256-gWd4urRoLRe8GLVC/3rYRae1h+xfQzt09xOfb0PaHSk=", "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5e5402ecbcb27af32284d4a62553c019a3a49ea6", "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -607,11 +607,11 @@
"nuschtosSearch": "nuschtosSearch" "nuschtosSearch": "nuschtosSearch"
}, },
"locked": { "locked": {
"lastModified": 1743157969, "lastModified": 1744874965,
"narHash": "sha256-ldlSyVKNaXL7ys7Jr7mLhlpGDE4VPVcWmV7Odupn5TY=", "narHash": "sha256-eOnMgAWsjqOhGRoY9smkKlNQcCz9R89mgiKwLrCIYBE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "95573411bc9be155a93b0f15d2bad62c6b43b3cc", "rev": "500b56f023e0f095ffee2d4f79e58aa09e6b0719",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -806,11 +806,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1741934139, "lastModified": 1744644585,
"narHash": "sha256-ZhTcTH9FoeAtbPfWGrhkH7RjLJZ7GeF18nygLAMR+WE=", "narHash": "sha256-p0D/e4J6Sv6GSb+9u8OQcVHSE2gPNYB5ygIfGDyEiXQ=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "150b0b6f52bb422a1b232a53698606fe0320dde0", "rev": "be6771e754345f18244fb00aae5c9e5ab21ccc26",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -66,6 +66,10 @@
}; };
}; };
nixpkgs.config.packageOverrides = pkgs: {
emacs = pkgs.emacs.override { withNativeCompilation = false; };
};
system.stateVersion = 5; system.stateVersion = 5;
# fix for this: https://github.com/LnL7/nix-darwin/issues/1346 # fix for this: https://github.com/LnL7/nix-darwin/issues/1346

View File

@ -22,6 +22,7 @@
../../modules/home-manager/man.nix ../../modules/home-manager/man.nix
../../modules/home-manager/direnv.nix ../../modules/home-manager/direnv.nix
../../modules/home-manager/spotify-player.nix ../../modules/home-manager/spotify-player.nix
../../modules/home-manager/nb.nix
]; ];
home.username = "mthomson"; home.username = "mthomson";
home.homeDirectory = "/Users/mthomson"; home.homeDirectory = "/Users/mthomson";

View File

@ -3,11 +3,27 @@
config, config,
... ...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
emacs # emacs
tree-sitter
fd
ripgrep
vue-language-server
typescript-language-server
typescript
nodejs
]; ];
home.file.".emacs.d" = {
source = ./emacs.d; programs.emacs = {
enable = true;
extraPackages = epkgs: [
epkgs.mu4e
];
};
services.emacs.enable = true;
home.file.".config/emacs" = {
source = ./emacs;
recursive = true; recursive = true;
}; };
} }

View File

@ -1,289 +0,0 @@
#+TITLE: Michael's GNU Emacs Config
#+AUTHOR: Michael Thomson
#+DESCRIPTION: Michael's personal Emacs config
#+STARTUP: showeverything
#+OPTIONS: toc:2
* TABLE OF CONTENTS :toc:
- [[#important-programs-to-load-first][IMPORTANT PROGRAMS TO LOAD FIRST]]
- [[#elpaca-package-manager][Elpaca Package Manager]]
- [[#evil-mode][Evil Mode]]
- [[#general-keybindings][General Keybindings]]
- [[#fonts][FONTS]]
- [[#gui-tweaks][GUI TWEAKS]]
- [[#org-mode][ORG MODE]]
- [[#general-settings][General Settings]]
- [[#enable-table-of-contents][Enable Table of Contents]]
- [[#enable-org-bullets][Enable org bullets]]
- [[#block-expansion][Block expansion]]
- [[#org-roam][Org Roam]]
- [[#completion-framework][Completion Framework]]
- [[#completion-at-point][COMPLETION AT POINT]]
- [[#lsp][LSP]]
- [[#eglot][Eglot]]
- [[#language-support][LANGUAGE SUPPORT]]
- [[#treesitter][Treesitter]]
* IMPORTANT PROGRAMS TO LOAD FIRST
** Elpaca Package Manager
#+begin_src emacs-lisp
(defvar elpaca-installer-version 0.9)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1 :inherit ignore
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let* ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
(elpaca elpaca-use-package
(elpaca-use-package-mode))
#+end_src
** Evil Mode
#+begin_src emacs-lisp
(use-package evil
:ensure t
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
:config
(evil-mode 1))
(use-package evil-collection
:ensure t
:after evil
:config
(evil-collection-init))
#+end_src
** General Keybindings
#+begin_src emacs-lisp
(use-package general
:ensure t
:config
(general-create-definer mt/leader-def
:states '(normal visual)
:keymaps 'override
:prefix "SPC")
(mt/leader-def
"f f" 'find-file
"f c" (lambda () (interactive) (find-file "~/.emacs.d/config.org")))
(mt/leader-def
"e b" 'eval-buffer
"e r" 'eval-region))
#+end_src
* FONTS
#+begin_src emacs-lisp
(set-face-attribute 'default nil
:font "JetBrainsMono Nerd Font Mono"
:height 110
:weight 'medium)
#+end_src
* GUI TWEAKS
#+begin_src emacs-lisp
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(setq inhibit-splash-screen t)
(setq use-file-dialog nil)
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)
(global-visual-line-mode t)
(setq gc-cons-threshold 100000000) ; 100 mb
(setq read-process-output-max (* 1024 1024)) ; 1mb
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(use-package gruvbox-theme
:ensure t
:config
(load-theme 'gruvbox-dark-hard))
#+end_src
* ORG MODE
** General Settings
#+begin_src emacs-lisp
;; Must do this so the agenda knows where to look for my files
(setq org-agenda-files (directory-files-recursively "~/everything/" "\\.org$"))
;; When a TODO is set to a done state, record a timestamp
(setq org-log-done 'time)
;; Follow the links
(setq org-return-follows-link t)
;; Make the indentation look nicer
(add-hook 'org-mode-hook 'org-indent-mode)
;; Remap the change priority keys to use the UP or DOWN key
(define-key org-mode-map (kbd "C-c <up>") 'org-priority-up)
(define-key org-mode-map (kbd "C-c <down>") 'org-priority-down)
;; Shortcuts for storing links, viewing the agenda, and starting a capture
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(define-key global-map "\C-cc" 'org-capture)
;; When you want to change the level of an org item, use SMR
(define-key org-mode-map (kbd "C-c C-g C-r") 'org-shiftmetaright)
;; Hide the markers so you just see bold text as BOLD-TEXT and not *BOLD-TEXT*
(setq org-hide-emphasis-markers t)
;; Wrap the lines in org mode so that things are easier to read
(add-hook 'org-mode-hook 'visual-line-mode)
#+end_src
** Enable Table of Contents
#+begin_src emacs-lisp
(use-package toc-org
:ensure t
:init
(add-hook 'org-mode-hook 'toc-org-mode))
#+end_src
** Enable org bullets
#+begin_src emacs-lisp
(use-package org-superstar
:ensure t
:init
(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1))))
#+end_src
** Block expansion
#+begin_src emacs-lisp
(require 'org-tempo)
#+end_src
** Org Roam
#+begin_src emacs-lisp
(use-package org-roam
:ensure t
:custom
(org-roam-directory "~/everything")
(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"))))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today))
:config
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
(org-roam-db-autosync-mode))
#+end_src
* Completion Framework
#+begin_src emacs-lisp
(use-package vertico
:ensure t
:init
(vertico-mode))
(use-package marginalia
:ensure t
:init
(marginalia-mode))
(use-package savehist
:ensure nil
:init
(savehist-mode))
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides nil))
#+end_src
* COMPLETION AT POINT
#+begin_src emacs-lisp
(use-package corfu
:ensure t
:config
(setq tab-always-indent 'complete)
(setq corfu-popupinfo-delay '(1.25 . 0.5))
(corfu-popupinfo-mode 1)
(setq corfu-auto t)
(setq corfu-auto-delay 0)
(setq corfu-auto-prefix 0)
:init
(global-corfu-mode))
#+end_src
* LSP
** Eglot
#+begin_src emacs-lisp
(use-package direnv
:ensure t
:config
(direnv-mode))
(use-package exec-path-from-shell
:ensure t
:config
(exec-path-from-shell-initialize))
(use-package eglot
:ensure nil
:hook
(go-ts-mode . eglot-ensure)
(typescript-ts-mode . eglot-ensure)
(css-ts-mode . eglot-ensure)
(vue-ts-mode . eglot-ensure))
#+end_src
* LANGUAGE SUPPORT
** Treesitter
#+begin_src emacs-lisp
(use-package treesit-auto
:ensure t
:custom
(treesit-auto-install 'prompt)
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
#+end_src

View File

@ -1 +0,0 @@
(setq package-enable-at-startup nil)

View File

@ -1,17 +0,0 @@
(org-babel-load-file
(expand-file-name
"config.org"
user-emacs-directory))
(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.
'(custom-safe-themes
'("d445c7b530713eac282ecdeea07a8fa59692c83045bf84dd112dd738c7bcad1d" default)))
(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.
)

View File

@ -0,0 +1,561 @@
;; The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
(defun start/org-babel-tangle-config ()
"Automatically tangle our Emacs.org config file when we save it. Credit to Emacs From Scratch for this one!"
(when (string-equal (file-name-directory (buffer-file-name))
(expand-file-name user-emacs-directory))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'start/org-babel-tangle-config)))
(require 'use-package-ensure) ;; Load use-package-always-ensure
(setq use-package-always-ensure t) ;; Always ensures that a package is installed
(setq package-archives '(("melpa" . "https://melpa.org/packages/") ;; Sets default package repositories
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ;; For Eat Terminal
(use-package evil
:init ;; Execute code Before a package is loaded
(evil-mode)
:config ;; Execute code After a package is loaded
(evil-set-initial-state 'eat-mode 'insert) ;; Set initial state in eat terminal to insert mode
:custom ;; Customization of package custom variables
(evil-want-keybinding nil) ;; Disable evil bindings in other modes (It's not consistent and not good)
(evil-want-C-u-scroll t) ;; Set C-u to scroll up
(evil-want-C-i-jump nil) ;; Disables C-i jump
(evil-undo-system 'undo-redo) ;; C-r to redo
(org-return-follows-link t) ;; Sets RETURN key in org-mode to follow links
;; Unmap keys in 'evil-maps. If not done, org-return-follows-link will not work
:bind (:map evil-motion-state-map
("SPC" . nil)
("RET" . nil)
("TAB" . nil)))
(use-package evil-collection
:after evil
:config
;; Setting where to use evil-collection
(setq evil-collection-mode-list '(dired ibuffer magit corfu vertico consult))
(evil-collection-init))
(use-package general
:config
(general-evil-setup)
;; Set up 'SPC' as the leader key
(general-create-definer start/leader-keys
:states '(normal insert visual motion emacs)
:keymaps 'override
:prefix "SPC" ;; Set leader key
:global-prefix "C-SPC") ;; Set global leader key
(start/leader-keys
"." '(find-file :wk "Find file")
"TAB" '(comment-line :wk "Comment lines"))
(start/leader-keys
"p" '(:ignore t :wk "Project")
"p p" '(project-switch-project :wk "Switch project")
"p f" '(project-find-file :wk "Find file")
"p g" '(project-find-regexp :wk "Grep file")
"p s" '(project-eshell :wk "Shell")
"p c" '(project-compile :wk "Compile")
"p b" '(project-switch-to-buffer :wk "Buffers")
"p K" '(project-kill-buffers :wk "Kill all buffers"))
(start/leader-keys
"f" '(:ignore t :wk "Find")
"f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Edit emacs config")
"f r" '(consult-recent-file :wk "Recent files")
"f f" '(consult-fd :wk "Fd search for files")
"f g" '(consult-ripgrep :wk "Ripgrep search in files")
"f l" '(consult-line :wk "Find line")
"f i" '(consult-imenu :wk "Imenu buffer locations"))
(start/leader-keys
"b" '(:ignore t :wk "Buffer Bookmarks")
"b b" '(consult-buffer :wk "Switch buffer")
"b k" '(kill-current-buffer :wk "Kill this buffer")
"b i" '(ibuffer :wk "Ibuffer")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer")
"b j" '(consult-bookmark :wk "Bookmark jump"))
(start/leader-keys
"d" '(:ignore t :wk "Dired")
"d v" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current"))
(start/leader-keys
"e" '(:ignore t :wk "Languages Eglot")
"e e" '(eglot-reconnect :wk "Eglot Reconnect")
"e d" '(eldoc-doc-buffer :wk "Eldoc Buffer")
"e f" '(eglot-format :wk "Eglot Format")
"e l" '(consult-flymake :wk "Consult Flymake")
"e r" '(eglot-rename :wk "Eglot Rename")
"e i" '(xref-find-definitions :wk "Find defintion")
"e v" '(:ignore t :wk "Elisp")
"e v b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e v r" '(eval-region :wk "Evaluate elisp in region"))
(start/leader-keys
"g" '(:ignore t :wk "Git")
"g g" '(magit-status :wk "Magit status"))
(start/leader-keys
"h" '(:ignore t :wk "Help") ;; To get more help use C-h commands (describe variable, function, etc.)
"h q" '(save-buffers-kill-emacs :wk "Quit Emacs and Daemon")
"h r" '((lambda () (interactive)
(load-file "~/.config/emacs/init.el"))
:wk "Reload Emacs config"))
(start/leader-keys
"s" '(:ignore t :wk "Show")
"s e" '(eat :wk "Eat terminal"))
(start/leader-keys
"t" '(:ignore t :wk "Toggle")
"t t" '(visual-line-mode :wk "Toggle truncated lines (wrap)")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers"))
(start/leader-keys
"o" '(:ignore t :wk "Org")
"o f" '(org-roam-node-find :wk "Find note")
"o c" '(org-roam-capture :wk "Org capture")
"o d" '(:ignore t :wk "Dailies")
"o d t" '(org-roam-dailies-goto-today :wk "Goto today")
"o d c" '(org-roam-dailies-capture-today :wk "Capture today")
"o i" '(org-roam-node-insert :wk "Insert link")))
(use-package emacs
:custom
(menu-bar-mode nil) ;; Disable the menu bar
(scroll-bar-mode nil) ;; Disable the scroll bar
(tool-bar-mode nil) ;; Disable the tool bar
;;(inhibit-startup-screen t) ;; Disable welcome screen
(delete-selection-mode t) ;; Select text and delete it by typing.
(electric-indent-mode nil) ;; Turn off the weird indenting that Emacs does by default.
(electric-pair-mode t) ;; Turns on automatic parens pairing
(blink-cursor-mode nil) ;; Don't blink cursor
(global-auto-revert-mode t) ;; Automatically reload file and show changes if the file has changed
;;(dired-kill-when-opening-new-dired-buffer t) ;; Dired don't create new buffer
;;(recentf-mode t) ;; Enable recent file mode
;;(global-visual-line-mode t) ;; Enable truncated lines
;;(display-line-numbers-type 'relative) ;; Relative line numbers
(global-display-line-numbers-mode t) ;; Display line numbers
(mouse-wheel-progressive-speed nil) ;; Disable progressive speed when scrolling
(scroll-conservatively 10) ;; Smooth scrolling
(scroll-margin 8)
(tab-width 4)
(make-backup-files nil) ;; Stop creating ~ backup files
(auto-save-default nil) ;; Stop creating # auto save files
:hook
(prog-mode . (lambda () (hs-minor-mode t))) ;; Enable folding hide/show globally
:config
;; Move customization variables to a separate file and load it, avoid filling up init.el with unnecessary variables
(setq custom-file (locate-user-emacs-file "custom-vars.el"))
(load custom-file 'noerror 'nomessage)
:bind (
([escape] . keyboard-escape-quit) ;; Makes Escape quit prompts (Minibuffer Escape)
)
;; Fix general.el leader key not working instantly in messages buffer with evil mode
:ghook ('after-init-hook
(lambda (&rest _)
(when-let ((messages-buffer (get-buffer "*Messages*")))
(with-current-buffer messages-buffer
(evil-normalize-keymaps))))
nil nil t)
)
(use-package gruvbox-theme
:config
(load-theme 'gruvbox-dark-medium t)) ;; We need to add t to trust this package
(add-to-list 'default-frame-alist '(alpha-background . 90)) ;; For all new frames henceforth
(set-face-attribute 'default nil
:font "JetBrainsMono Nerd Font" ;; Set your favorite type of font or download JetBrains Mono
:height 120
:weight 'medium)
;; This sets the default font on all graphical frames created after restarting Emacs.
;; Does the same thing as 'set-face-attribute default' above, but emacsclient fonts
;; are not right unless I also add this method of setting the default font.
;;(add-to-list 'default-frame-alist '(font . "JetBrains Mono")) ;; Set your favorite font
(setq-default line-spacing 0.12)
(use-package emacs
:bind
("C-+" . text-scale-increase)
("C--" . text-scale-decrease)
("<C-wheel-up>" . text-scale-increase)
("<C-wheel-down>" . text-scale-decrease))
(use-package doom-modeline
:init (doom-modeline-mode 1)
:custom
(doom-modeline-height 25) ;; 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
(use-package project
:ensure nil)
(use-package envrc
:hook
(after-init . envrc-global-mode))
(use-package eglot
:ensure nil ;; Don't install eglot because it's now built-in
:hook ((c-ts-mode
c++-ts-mode
go-ts-mode
java-ts-mode
vue-mode
typescript-ts-mode)
. eglot-ensure)
:custom
;; Good default
(eglot-events-buffer-size 0) ;; No event buffers (Lsp server logs)
(eglot-autoshutdown t);; Shutdown unused servers.
(eglot-report-progress nil) ;; Disable ls:init
(eglot-connect-timeout 120)
;; Manual lsp servers
:config
(add-to-list 'eglot-server-programs
`(vue-mode . ("vue-language-server" "--stdio" :initializationOptions
(:typescript (:tsdk "/Users/mthomson/dev/work/westjet/profile-app-spa/node_modules/typescript/lib")
:vue (:hybridMode :json-false)))))
(add-to-list 'eglot-server-programs
`(typescript-ts-mode . ("vue-language-server" "--stdio" :initializationOptions
(:typescript (:tsdk "/Users/mthomson/dev/work/westjet/profile-app-spa/node_modules/typescript/lib")
:vue (:hybridMode :json-false)))))
)
(use-package eldoc-box
:hook
(eglot-managed-mode . eldoc-box-hover-at-point-mode)
:custom
(eldoc-box-prettify-ts-errors t))
(use-package yasnippet-snippets
:hook (prog-mode . yas-minor-mode))
(use-package exec-path-from-shell
:init
(setq exec-path-from-shell-debug t)
(setq exec-path-from-shell-arguments nil)
;; (add-to-list 'exec-path "/etc/profiles/per-user/mthomson/bin")
(exec-path-from-shell-initialize))
(use-package treesit
:ensure nil)
(use-package treesit-auto
:ensure t
:commands global-treesit-auto-mode
:custom
(treesit-auto-install 'prompt)
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
;; (add-to-list 'load-path (concat user-emacs-directory "vue-ts-mode"))
;; (require 'vue-ts-mode)
;; (use-package vue-mode)
(use-package web-mode
:ensure t
:mode
(("\\.phtml\\'" . web-mode)
("\\.php\\'" . web-mode)
("\\.tpl\\'" . web-mode)
("\\.[agj]sp\\'" . web-mode)
("\\.as[cp]x\\'" . web-mode)
("\\.erb\\'" . web-mode)
("\\.mustache\\'" . web-mode)
("\\.djhtml\\'" . web-mode)))
(use-package flymake-eslint
:hook
(web-mode . (lambda() (flymake-eslint-enable)))
:custom
(flymake-eslint-defer-binary-check t))
(define-derived-mode vue-mode web-mode "Vue")
(add-to-list 'auto-mode-alist '("\\.vue\\'" . vue-mode))
(use-package nix-mode
:mode "\\.nix\\'")
(use-package org
:ensure nil
:custom
(org-edit-src-content-indentation 4) ;; Set src block automatic indent to 4 instead of 2.
(org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "CODE-REVIEW" "BLOCKED" "|" "DONE" "CANCELED")))
(org-todo-keyword-faces
'(("IN-PROGRESS" . "yellow") ("BLOCKED" . "magenta") ("CODE-REVIEW" . "blue") ("CANCELED" . "grey") ("DONE" . "green")))
:hook
(org-mode . org-indent-mode) ;; Indent text
;; The following prevents <> from auto-pairing when electric-pair-mode is on.
;; Otherwise, org-tempo is broken when you try to <s TAB...
;;(org-mode . (lambda ()
;; (setq-local electric-pair-inhibit-predicate
;; `(lambda (c)
;; (if (char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))
)
(use-package toc-org
:commands toc-org-enable
:hook (org-mode . toc-org-mode))
(use-package org-superstar
:after org
:hook (org-mode . org-superstar-mode))
(use-package org-tempo
:ensure nil
:after org)
(use-package org-roam
:ensure t
:custom
(org-roam-directory "~/RoamNotes")
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert))
:config
(org-roam-db-autosync-mode))
(use-package eat
:hook ('eshell-load-hook #'eat-eshell-mode)
:custom
(eat-term-name "xterm-256color"))
;; (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
;; (require 'start-multiFileExample)
;; (start/hello)
(use-package mu4e
:config
;; mbsync
(setq mu4e-get-mail-command (concat (executable-find "mbsync") " -a"))
(setq mu4e--get-mail-password-regexp "^Master Password: $")
(setq mu4e-update-interval 300)
;; msmtp
(setq send-mail-function 'sendmail-send-it)
(setq sendmail-program (executable-find "msmtp"))
(setq message-sendmail-envelope-from 'header)
;; contexts
(setq mu4e-contexts
`(,(make-mu4e-context
:name "personal"
:enter-func
(lambda () (mu4e-message "Opening michael@michaelthomson.dev"))
:leave-func
(lambda () (mu4e-message "Closing michael@michaelthomson.dev"))
:match-func
(lambda (msg)
(when msg
(mu4e-message-contact-field-matches msg
:to "michael@michaelthomson.dev")))
:vars '((user-mail-address . "michael@michaelthomson.dev" )
(user-full-name . "Michael Thomson")
(mu4e-drafts-folder . "/personal/Drafts")
(mu4e-refile-folder . "/personal/Archive")
(mu4e-sent-folder . "/personal/Sent")
(mu4e-trash-folder . "/personal/Trash")))
))
)
(use-package nerd-icons
:if (display-graphic-p))
(use-package nerd-icons-dired
:hook (dired-mode . (lambda () (nerd-icons-dired-mode t))))
(use-package nerd-icons-ibuffer
:hook (ibuffer-mode . nerd-icons-ibuffer-mode))
(use-package magit
;; :custom (magit-diff-refine-hunk (quote all)) ;; Shows inline diff
:commands magit-status
:custom
(magit-git-executable "git"))
(use-package diff-hl
:hook ((dired-mode . diff-hl-dired-mode-unless-remote)
(magit-pre-refresh . diff-hl-magit-pre-refresh)
(magit-post-refresh . diff-hl-magit-post-refresh))
:init (global-diff-hl-mode))
(use-package corfu
;; Optional customizations
:custom
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
(corfu-auto-prefix 2) ;; Minimum length of prefix for auto completion.
(corfu-popupinfo-mode t) ;; Enable popup information
(corfu-popupinfo-delay 0.5) ;; Lower popupinfo delay to 0.5 seconds from 2 seconds
(corfu-separator ?\s) ;; Orderless field separator, Use M-SPC to enter separator
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
;; (corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect 'prompt) ;; Preselect the prompt
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
;; (corfu-scroll-margin 5) ;; Use scroll margin
(completion-ignore-case t)
;; Enable indentation+completion using the TAB key.
;; `completion-at-point' is often bound to M-TAB.
(tab-always-indent 'complete)
(corfu-preview-current nil) ;; Don't insert completion without confirmation
;; Recommended: Enable Corfu globally. This is recommended since Dabbrev can
;; be used globally (M-/). See also the customization variable
;; `global-corfu-modes' to exclude certain modes.
:init
(global-corfu-mode))
(use-package nerd-icons-corfu
:after corfu
:init (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package cape
:after corfu
:init
;; Add to the global default value of `completion-at-point-functions' which is
;; used by `completion-at-point'. The order of the functions matters, the
;; first function returning a result wins. Note that the list of buffer-local
;; completion functions takes precedence over the global list.
;; The functions that are added later will be the first in the list
(add-to-list 'completion-at-point-functions #'cape-dabbrev) ;; Complete word from current buffers
(add-to-list 'completion-at-point-functions #'cape-dict) ;; Dictionary completion
(add-to-list 'completion-at-point-functions #'cape-file) ;; Path completion
(add-to-list 'completion-at-point-functions #'cape-elisp-block) ;; Complete elisp in Org or Markdown mode
(add-to-list 'completion-at-point-functions #'cape-keyword) ;; Keyword/Snipet completion
;;(add-to-list 'completion-at-point-functions #'cape-abbrev) ;; Complete abbreviation
;;(add-to-list 'completion-at-point-functions #'cape-history) ;; Complete from Eshell, Comint or minibuffer history
;;(add-to-list 'completion-at-point-functions #'cape-line) ;; Complete entire line from current buffer
;;(add-to-list 'completion-at-point-functions #'cape-elisp-symbol) ;; Complete Elisp symbol
;;(add-to-list 'completion-at-point-functions #'cape-tex) ;; Complete Unicode char from TeX command, e.g. \hbar
;;(add-to-list 'completion-at-point-functions #'cape-sgml) ;; Complete Unicode char from SGML entity, e.g., &alpha
;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;; Complete Unicode char using RFC 1345 mnemonics
)
(use-package orderless
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
(use-package vertico
:init
(vertico-mode))
(savehist-mode) ;; Enables save history mode
(use-package marginalia
:after vertico
:init
(marginalia-mode))
(use-package nerd-icons-completion
:after marginalia
:config
(nerd-icons-completion-mode)
:hook
('marginalia-mode-hook . 'nerd-icons-completion-marginalia-setup))
(use-package consult
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
;; Optionally configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
:config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
;; (consult-customize
;; consult-theme :preview-key '(:debounce 0.2 any)
;; consult-ripgrep consult-git-grep consult-grep
;; consult-bookmark consult-recent-file consult-xref
;; consult--source-bookmark consult--source-file-register
;; consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
;; :preview-key '(:debounce 0.4 any))
;; By default `consult-project-function' uses `project-root' from project.el.
;; Optionally configure a different project root function.
;;;; 1. project.el (the default)
;; (setq consult-project-function #'consult--default-project--function)
;;;; 2. vc.el (vc-root-dir)
;; (setq consult-project-function (lambda (_) (vc-root-dir)))
;;;; 3. locate-dominating-file
;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
;;;; 4. projectile.el (projectile-project-root)
;; (autoload 'projectile-project-root "projectile")
;; (setq consult-project-function (lambda (_) (projectile-project-root)))
;;;; 5. No project support
;; (setq consult-project-function nil)
)
(use-package diminish)
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
(use-package which-key
:ensure nil ;; Don't install which-key because it's now built-in
:init
(which-key-mode 1)
:diminish
:custom
(which-key-side-window-location 'bottom)
(which-key-sort-order #'which-key-key-order-alpha) ;; Same as default, except single characters are sorted alphabetically
(which-key-sort-uppercase-first nil)
(which-key-add-column-padding 1) ;; Number of spaces to add to the left of each column
(which-key-min-display-lines 6) ;; Increase the minimum lines to display, because the default is only 1
(which-key-idle-delay 0.8) ;; Set the time delay (in seconds) for the which-key popup to appear
(which-key-max-description-length 25)
(which-key-allow-imprecise-window-fit nil)) ;; Fixes which-key window slipping out in Emacs Daemon
;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))
;; Increase the amount of data which Emacs reads from the process
(setq read-process-output-max (* 1024 1024)) ;; 1mb

View File

@ -5,6 +5,7 @@
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
w3m w3m
inetutils
]; ];
services = { services = {
@ -75,6 +76,9 @@
khard = { khard = {
enable = true; enable = true;
}; };
mu = {
enable = true;
};
}; };
accounts = { accounts = {
@ -112,6 +116,9 @@
notmuch = { notmuch = {
enable = true; enable = true;
}; };
mu = {
enable = true;
};
}; };
}; };
calendar = { calendar = {

View File

@ -3,9 +3,13 @@
config, config,
... ...
}: { }: {
programs = { home.packages = with pkgs; [
texlive = { texliveFull
enable = true; ];
};
}; # programs = {
# texlive = {
# enable = true;
# };
# };
} }

View File

@ -0,0 +1,20 @@
{
pkgs,
config,
...
}: {
home.packages = with pkgs; [
nb
tig
w3m
];
programs = {
pandoc = {
enable = true;
};
bat = {
enable = true;
};
};
}

View File

@ -56,6 +56,7 @@ lib,
scrolloff = 10; scrolloff = 10;
hlsearch = true; hlsearch = true;
foldlevel = 99; foldlevel = 99;
conceallevel = 2;
}; };
keymaps = [ keymaps = [
@ -408,7 +409,7 @@ lib,
}; };
}; };
render-markdown = { render-markdown = {
enable = true; enable = false;
}; };
friendly-snippets = { friendly-snippets = {
enable = true; enable = true;

View File

@ -48,6 +48,10 @@
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh"; file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
} }
]; ];
initExtra = ''
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && \
source "$EAT_SHELL_INTEGRATION_DIR/zsh"
'';
}; };
starship = { starship = {
enable = true; enable = true;