move stuff around
This commit is contained in:
257
init.el
257
init.el
@@ -1,5 +1,7 @@
|
||||
;;; -*- lexical-binding: t; -*-
|
||||
|
||||
(setq gc-cons-threshold (* 800000 100))
|
||||
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "https://melpa.org/packages/") t)
|
||||
@@ -10,10 +12,13 @@
|
||||
|
||||
;; If startup times are slow
|
||||
;; (setq use-package-verbose t)
|
||||
;; (setq use-package-compute-statistics t)
|
||||
(setq use-package-compute-statistics t)
|
||||
|
||||
(add-to-list 'load-path (concat user-emacs-directory "local-lisp/"))
|
||||
(add-to-list 'load-path (concat user-emacs-directory "user-lisp/"))
|
||||
(add-to-list 'load-path "/opt/homebrew/Cellar/mu/1.12.14/share/emacs/site-lisp/mu/mu4e")
|
||||
|
||||
(global-auto-revert-mode 1)
|
||||
(recentf-mode 1)
|
||||
(setq tab-bar-show nil)
|
||||
(setq inhibit-startup-message t)
|
||||
(setq initial-scratch-message nil)
|
||||
@@ -39,6 +44,13 @@
|
||||
(pixel-scroll-precision-mode 1)
|
||||
(kill-ring-deindent-mode 1)
|
||||
|
||||
(setopt auto-revert-avoid-polling t)
|
||||
(setopt auto-revert-interval 5)
|
||||
(setopt auto-revert-check-vc-info t)
|
||||
(global-auto-revert-mode 1)
|
||||
(setq global-auto-revert-non-file-buffers t)
|
||||
(setq-default grep-command "rg")
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
(setq mac-command-modifier 'control)
|
||||
(setq is-mac (string= system-type "darwin"))
|
||||
@@ -51,13 +63,14 @@
|
||||
(defun hgh/enable-cursor-blink ()
|
||||
(blink-cursor-mode 1))
|
||||
|
||||
(add-hook 'activate-mark-hook 'hgh/disable-cursor-blink)
|
||||
(add-hook 'activate-mark-hook 'hgh/disable-cursor-blink)
|
||||
(add-hook 'deactivate-mark-hook 'hgh/enable-cursor-blink)
|
||||
|
||||
(when is-mac
|
||||
(setq dired-use-ls-dired t
|
||||
insert-directory-program "gls"
|
||||
dired-listing-switches "-aBhl --group-directories-first"))
|
||||
dired-listing-switches "-aBhl --group-directories-first")
|
||||
(setq-default manual-program "gman"))
|
||||
|
||||
;; Add .asdf to exec-path
|
||||
(when (file-exists-p (file-truename "~/.asdf"))
|
||||
@@ -74,6 +87,11 @@
|
||||
(when exec-path
|
||||
(setenv "PATH" (string-join exec-path ":")))
|
||||
|
||||
(defun hgh/duplicate-dwim ()
|
||||
(interactive)
|
||||
(duplicate-dwim)
|
||||
(next-line))
|
||||
|
||||
(defun hgh/visit-init-file ()
|
||||
(interactive)
|
||||
(find-file user-init-file))
|
||||
@@ -110,7 +128,11 @@
|
||||
(keymap-global-set "M-1" #'delete-other-windows)
|
||||
(keymap-global-set "M-2" #'split-window-below)
|
||||
(keymap-global-set "M-3" #'split-window-right)
|
||||
(keymap-global-set "C-," #'duplicate-dwim)
|
||||
(keymap-global-set "C-," #'hgh/duplicate-dwim)
|
||||
|
||||
(keymap-global-set "C-c f n" #'flymake-goto-next-error)
|
||||
(keymap-global-set "C-c f p" #'flymake-goto-prev-error)
|
||||
(keymap-global-set "C-c f b" #'flymake-show-buffer-diagnostics)
|
||||
|
||||
(keymap-set completion-list-mode-map "M-n" #'minibuffer-next-completion)
|
||||
(keymap-set completion-list-mode-map "M-p" #'minibuffer-previous-completion)
|
||||
@@ -123,34 +145,18 @@
|
||||
|
||||
(load-theme 'modus-vivendi t)
|
||||
|
||||
;; Let's prefer completion-preview for now if it's available
|
||||
(if (version<= "30.1" emacs-version)
|
||||
(use-package completion-preview
|
||||
:ensure nil
|
||||
:demand t
|
||||
:bind
|
||||
(:map completion-preview-active-mode-map
|
||||
("M-n" . completion-preview-next-candidate)
|
||||
("M-p" . completion-preview-preview-candidate))
|
||||
:config
|
||||
(global-completion-preview-mode t))
|
||||
(use-package corfu
|
||||
:custom
|
||||
(corfu-auto t)
|
||||
(corfu-cycle t)
|
||||
:config
|
||||
(global-corfu-mode 1)))
|
||||
(use-package corfu
|
||||
:custom
|
||||
(corfu-auto t)
|
||||
(corfu-cycle t)
|
||||
:config
|
||||
(global-corfu-mode 1))
|
||||
|
||||
(use-package exec-path-from-shell
|
||||
:when is-mac
|
||||
:config
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
(use-package man
|
||||
:when is-mac
|
||||
:custom
|
||||
(manual-program "gman"))
|
||||
|
||||
(use-package magit
|
||||
:defer t)
|
||||
|
||||
@@ -164,7 +170,7 @@
|
||||
("\\.jsx\\'" . tsx-ts-mode)
|
||||
("\\.json\\'" . json-ts-mode))
|
||||
:custom
|
||||
(treesit-extra-load-path '("~/repos/tree-sitter-module/dist")))
|
||||
(treesit-extra-load-path `("~/repos/tree-sitter-module/dist" ,(concat user-emacs-directory "/tree-sitter"))))
|
||||
|
||||
(use-package tree-sitter-langs
|
||||
:defer t)
|
||||
@@ -175,6 +181,7 @@
|
||||
(use-package company)
|
||||
|
||||
(defun enable-parinfer ()
|
||||
(require 's)
|
||||
(let ((buf (or (buffer-file-name) (buffer-name) "")))
|
||||
(when (and
|
||||
(not (s-contains? "sbcl" buf))
|
||||
@@ -191,13 +198,46 @@
|
||||
(parinfer-rust-disable-troublesome-modes t))
|
||||
|
||||
(use-package sly
|
||||
:mode "\\.lisp\\'"
|
||||
:commands (sly)
|
||||
:custom
|
||||
(inferior-lisp-program "/opt/homebrew/bin/sbcl"))
|
||||
|
||||
(defun hgh/--project-execute (command name)
|
||||
(require 'project)
|
||||
(when (not command)
|
||||
(user-error (concat "No command specified for project-" name)))
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compilation-start command
|
||||
nil
|
||||
(lambda (mode-name) (concat "*" (project-name (project-current)) " " name "*")))))
|
||||
|
||||
|
||||
|
||||
(defmacro hgh/define-project-command (name)
|
||||
"Define a project command with NAME.
|
||||
Creates a variable `hgh/project-NAME-command' and function `hgh/project-NAME'."
|
||||
(let ((var-sym (intern (format "hgh/project-%s-command" name)))
|
||||
(fn-sym (intern (format "hgh/project-%s" name))))
|
||||
`(progn
|
||||
(defvar ,var-sym nil
|
||||
,(format "Command to %s the project." name))
|
||||
(put ',var-sym 'safe-local-variable #'stringp)
|
||||
(defun ,fn-sym ()
|
||||
,(format "Execute the project %s command." name)
|
||||
(interactive)
|
||||
(hgh/--project-execute ,var-sym ,name)))))
|
||||
|
||||
|
||||
(hgh/define-project-command "run")
|
||||
(hgh/define-project-command "test")
|
||||
(hgh/define-project-command "lint")
|
||||
|
||||
(use-package project
|
||||
:bind (("C-x p s" . hgh/project-ripgrep)
|
||||
("C-x p S" . project-shell)))
|
||||
("C-x p S" . project-shell)
|
||||
("C-x p t" . hgh/project-test)
|
||||
("C-x p r" . hgh/project-run)
|
||||
("C-x p l" . hgh/project-lint)))
|
||||
|
||||
(use-package vertico
|
||||
:custom
|
||||
@@ -222,9 +262,6 @@
|
||||
:init
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev))
|
||||
|
||||
(use-package browse-kill-ring
|
||||
:bind (("C-c y" . browse-kill-ring)))
|
||||
|
||||
(defun hgh/org-mode-visual-fill ()
|
||||
(setq visual-fill-column-width 120
|
||||
visual-fill-column-center-text t)
|
||||
@@ -245,7 +282,10 @@
|
||||
(svelte-mode . eglot-ensure)
|
||||
(haskell-mode . eglot-ensure)
|
||||
(terraform-mode . eglot-ensure)
|
||||
(odin-mode . eglot-ensure))
|
||||
(odin-mode . eglot-ensure)
|
||||
(tuareg-mode . eglot-ensure)
|
||||
(ruby-mode . eglot-ensure)
|
||||
(dart-mode . eglot-ensure))
|
||||
:bind
|
||||
(:map eglot-mode-map
|
||||
("C-c r" . eglot-rename)
|
||||
@@ -257,21 +297,39 @@
|
||||
:config
|
||||
;; Set up using clippy with rust analyzer
|
||||
(setf eglot-server-programs
|
||||
(cl-remove-if (lambda (c) (equal (car c) 'rust-mode))
|
||||
(cl-remove-if (lambda (c) (equal (car c) (or 'rust-mode 'tuareg-mode '(dart-mode dart-ts-mode))))
|
||||
eglot-server-programs))
|
||||
|
||||
(setf eglot-server-programs
|
||||
(append (list
|
||||
(list '(rust-ts-mode rust-mode) "rust-analyzer" :initializationOptions '(:checkOnSave (:command "clippy")))
|
||||
'(svelte-mode "svelteserver" "--stdio")
|
||||
'(haskell-mode "haskell-language-server-wrapper" "--lsp"))
|
||||
eglot-server-programs)))
|
||||
'(haskell-mode "haskell-language-server-wrapper" "--lsp")
|
||||
'(tuareg-mode "dune" "exec" "ocamllsp")
|
||||
'(reason-mode "dune" "exec" "ocamllsp")
|
||||
'(ruby-mode "solargraph" "socket" "--port" :autoport)
|
||||
'(dart-mode "dart" "language-server" "--client-id" "emacs.eglot-dart")
|
||||
eglot-server-programs))))
|
||||
|
||||
(setenv "DOTNET_ROOT" "~/.local/share/mise/installs/dotnet/9")
|
||||
(push '("\\.csproj$" . xml-mode) auto-mode-alist)
|
||||
(push '("\\.vs$" . c-mode) auto-mode-alist)
|
||||
(push '("\\.fs$" . c-mode) auto-mode-alist)
|
||||
(push '("\\.sbclrc" . lisp-mode) auto-mode-alist)
|
||||
(push '("\\.csproj$" . xml-mode) auto-mode-alist)
|
||||
(push '("\\.vs$" . c-mode) auto-mode-alist)
|
||||
(push '("\\.fs$" . c-mode) auto-mode-alist)
|
||||
(push '("\\.sbclrc" . lisp-mode) auto-mode-alist)
|
||||
(push '("dune-project\\'" . lisp-mode) auto-mode-alist)
|
||||
(push '("dune\\'" . lisp-mode) auto-mode-alist)
|
||||
(push '("\\.ml\\'" . tuareg-mode) auto-mode-alist)
|
||||
(setf auto-mode-alist
|
||||
(cl-remove-if
|
||||
(lambda (tup)
|
||||
(or
|
||||
(and
|
||||
(string-equal (car tup) "\\.ml\\'")
|
||||
(eq (cdr tup) 'ocaml-ts-mode))
|
||||
(and
|
||||
(string-equal (car tup) "\\.ml\\'")
|
||||
(eq (cdr tup) 'lisp-mode))))
|
||||
auto-mode-alist))
|
||||
|
||||
;; paredit
|
||||
|
||||
@@ -285,16 +343,10 @@
|
||||
(define-key paredit-mode-map (kbd "M-:") #'paredit-backward-barf-sexp)
|
||||
(enable-paredit-mode))
|
||||
|
||||
(defvar lisp-mode-hooks nil)
|
||||
(setf lisp-mode-hooks '((emacs-lisp-mode-hook emacs-lisp-mode)
|
||||
(clojure-mode-hook clojure-mode)
|
||||
(lisp-mode-hook lisp-mode)
|
||||
(sly-mode-hook sly-mode)))
|
||||
|
||||
(defun hgh/rg (search)
|
||||
(interactive "sSearch: ")
|
||||
(compilation-start
|
||||
(concat "rg --no-heading '" search "'")
|
||||
(concat "rg -S --no-heading '" search "'")
|
||||
'compilation-mode
|
||||
(lambda (s)
|
||||
(concat
|
||||
@@ -317,7 +369,6 @@
|
||||
(advice-add 'mc/mark-next-like-this :before #'hgh/set-cursor-type-box)
|
||||
(advice-add 'mc/mark-previous-like-this :before #'hgh/set-cursor-type-box))
|
||||
|
||||
|
||||
(use-package yasnippet
|
||||
:diminish
|
||||
:defer t
|
||||
@@ -365,26 +416,27 @@
|
||||
(org-html-head-include-default-style nil)
|
||||
(org-html-head-include-scripts nil)
|
||||
(org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
|
||||
|
||||
(org-capture-templates
|
||||
'(("t" "Task" entry (file+headline "~/org/inbox.org" "Tasks")
|
||||
"* TODO %?\n%U\n%i\n%a")
|
||||
("n" "Note" entry (file+headline "~/org/inbox.org" "Notes")
|
||||
"* %?\n%U\n%i\n%a")
|
||||
("i" "Idea" entry (file+headline "~/org/inbox.org" "Ideas")
|
||||
"* %?\n%U\n%i\n%a")))
|
||||
'(("t" "Task" entry (file+headline "~/org/inbox.org" "Tasks")
|
||||
"* TODO %?\n%U\n%i\n%a")
|
||||
("n" "Note" entry (file+headline "~/org/inbox.org" "Notes")
|
||||
"* %?\n%U\n%i\n%a")
|
||||
("i" "Idea" entry (file+headline "~/org/inbox.org" "Ideas")
|
||||
"* %?\n%U\n%i\n%a")))
|
||||
|
||||
(org-publish-use-timestamps-flag nil)
|
||||
(org-publish-project-alist
|
||||
(list
|
||||
(list "writings"
|
||||
:base-directory "~/Documents/writings/content"
|
||||
:publishing-directory "~/Documents/writings/public"
|
||||
:exclude "~/Documents/writings/notes"
|
||||
:recursive t
|
||||
:time-stamp-file nil
|
||||
:section-numbers nil
|
||||
:with-creator t
|
||||
:with-author nil)))
|
||||
(list
|
||||
(list "writings"
|
||||
:base-directory "~/Documents/writings/content"
|
||||
:publishing-directory "~/Documents/writings/public"
|
||||
:exclude "~/Documents/writings/notes"
|
||||
:recursive t
|
||||
:time-stamp-file nil
|
||||
:section-numbers nil
|
||||
:with-creator t
|
||||
:with-author nil)))
|
||||
|
||||
:config
|
||||
(require 'ox-publish)
|
||||
@@ -394,10 +446,12 @@
|
||||
'((shell . t))))
|
||||
|
||||
(use-package dumber-jump
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'xref-backend-functions #'dumber-jump-xref-activate))
|
||||
|
||||
(use-package idris-mode)
|
||||
(use-package idris-mode
|
||||
:mode "\\.idr\\'")
|
||||
|
||||
(use-package htmlize)
|
||||
|
||||
@@ -444,3 +498,74 @@
|
||||
js-mode
|
||||
;; Need to add this
|
||||
tsx-ts-mode)))
|
||||
|
||||
(use-package mu4e
|
||||
:ensure nil
|
||||
:commands (mu4e)
|
||||
:custom
|
||||
(mu4e-maildir "~/Mail")
|
||||
(mu4e-get-mail-command "mbsync -a")
|
||||
(mu4e-update-interval 300)
|
||||
(mu4e-change-filenames-when-moving t)
|
||||
(mu4e-context-policy 'pick-first)
|
||||
(mu4e-compose-context-policy 'ask-if-none)
|
||||
(mu4e-contexts
|
||||
(list
|
||||
(make-mu4e-context
|
||||
:name "Grant"
|
||||
:match-func
|
||||
(lambda (msg)
|
||||
(when msg
|
||||
(string-prefix-p "/grant" (mu4e-message-field msg :maildir))))
|
||||
:vars '((user-mail-address . "grant@granthorner.dev")
|
||||
(user-full-name . "Grant Horner")
|
||||
(mu4e-drafts-folder . "/grant/Drafts")
|
||||
(mu4e-sent-folder . "/grant/Sent Mail")
|
||||
(mu4e-trash-folder . "/grant/Trash")
|
||||
(mu4e-rstrash-folder . "/grant/Trash")))
|
||||
(make-mu4e-context
|
||||
:name "Gmail"
|
||||
:match-func
|
||||
(lambda (msg)
|
||||
(when msg
|
||||
(string-prefix-p "/gmail" (mu4e-message-field msg :maildir))))
|
||||
:vars '((user-mail-address . "gmail@granthorner.dev")
|
||||
(user-full-name . "Grant Horner")
|
||||
(mu4e-drafts-folder . "/gmail/Drafts")
|
||||
(mu4e-sent-folder . "/gmail/Sent Mail")
|
||||
(mu4e-trash-folder . "/gmail/Trash")
|
||||
(mu4e-rstrash-folder . "/gmail/Trash"))))))
|
||||
|
||||
(use-package tuareg
|
||||
:mode "\\.ml\\'")
|
||||
|
||||
(defun hgh/eglot-restart ()
|
||||
(interactive)
|
||||
(require 'eglot)
|
||||
(when eglot--managed-mode
|
||||
(message "Shutting down eglot servers...")
|
||||
(eglot-shutdown-all)
|
||||
(message "Restarting eglot for current buffer...")
|
||||
(eglot)))
|
||||
|
||||
(use-package reason-mode
|
||||
:mode "\\.re\\'")
|
||||
|
||||
(use-package expand-region
|
||||
:bind ("C-=" . er/expand-region))
|
||||
|
||||
(use-package ediff
|
||||
:defer t
|
||||
:custom
|
||||
(ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||
(ediff-split-window-function 'split-window-horizontally)
|
||||
(ediff-diff-options "-w")
|
||||
:config
|
||||
(set-face-attribute 'ediff-odd-diff-A nil :background "#75383b")
|
||||
(set-face-attribute 'ediff-even-diff-A nil :background "#75383b")
|
||||
(set-face-attribute 'ediff-odd-diff-B nil :background "#265441")
|
||||
(set-face-attribute 'ediff-even-diff-B nil :background "#265441"))
|
||||
|
||||
(use-package dart-mode)
|
||||
|
||||
(use-package flutter)
|
||||
|
||||
Reference in New Issue
Block a user