Compare commits

20 Commits
cua ... 2026

Author SHA1 Message Date
hgranthorner
7d552bf7af fix hgh/update-projects 2026-07-23 14:42:44 -04:00
hgranthorner
7ee4c1b5ff fix project-switch-commands grep command 2026-07-23 09:26:59 -04:00
58de0905c0 Add elixir-ls to eglot 2026-07-20 18:48:40 -04:00
Grant Horner
f362df7961 update keyboard shortcuts and add evil-eglot-map 2026-07-20 09:26:12 -04:00
3bd6de839e update <leader>rw 2026-07-17 15:42:02 -04:00
acd5c4c4cf upgrade hgh/update-projects 2026-07-17 15:40:11 -04:00
Grant Horner
fd9a531571 enable mise, diminish global minor modes 2026-07-09 10:32:08 -04:00
Grant Horner
3a06999277 use terraform and configure org 2026-07-06 15:58:31 -04:00
Grant Horner
727f6bde07 add keybindings and optional work specific code 2026-07-02 10:52:16 -04:00
Grant Horner
0f27615c1c add org-roam 2026-06-29 12:35:13 -04:00
Grant Horner
c62b4e89a2 use user-emacs-directory 2026-06-29 10:55:22 -04:00
05e0f0a082 correctly configure grep command, duplicate line, man program 2026-06-25 11:47:09 -04:00
bac6f949ab add markdown-ts-mode 2026-06-25 11:05:06 -04:00
051ae8d9d2 add flymake customizations 2026-06-24 15:41:38 -04:00
537b55ae49 fix themes 2026-06-24 13:33:43 -04:00
60c6b6c45e fix theme issues 2026-06-24 12:26:15 -04:00
f924faa82d remove ido mode, add undo tree 2026-06-24 11:46:39 -04:00
10c12abb3c add evil 2026-06-22 13:01:26 -04:00
fe2978dce2 set up evil 2026-06-20 20:18:20 -04:00
eacc765fc9 enable eldoc and line numbers 2026-06-04 15:46:09 -04:00
4 changed files with 308 additions and 39 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
* *
!*.el !*.el
!user-lisp !user-lisp
work

View File

@@ -4,16 +4,21 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(eglot-code-action-indications '(eldoc-hint)) '(apheleia-log-only-errors nil)
'(custom-enabled-themes '(deeper-blue))
'(package-selected-packages '(package-selected-packages
'(cape dumb-jump dumber-jump exec-path-from-shell jai-mode magit '(apheleia cape dart-mode diminish dotenv-mode dumber-jump embark evil
markdown-mode move-text multiple-cursors vterm yaml evil-collection evil-surround exec-path-from-shell
yaml-mode)) fish-mode forge ghostel jai-mode magit marginalia mise
move-text multiple-cursors org-roam pgmacs
terraform-mode undo-tree yaml-mode yasnippet
yasnippet-snippets))
'(package-vc-selected-packages '(package-vc-selected-packages
'((jai-mode :url "https://github.com/valignatev/jai-mode.git")))) '((pgmacs :url "https://github.com/emarsden/pgmacs.git")
(jai-mode :url "https://github.com/valignatev/jai-mode.git"))))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
) '(eglot-inlay-hint-face ((t (:inherit shadow :height 0.8)))))

285
init.el
View File

@@ -4,12 +4,13 @@
(package-initialize) (package-initialize)
(if (string= system-type "darwin") (if (string= system-type "darwin")
(set-frame-font "Berkeley Mono 16" nil t) (set-frame-font "Berkeley Mono 18" nil t)
(set-frame-font "BerkeleyMono 14" nil t)) (set-frame-font "BerkeleyMono 14" nil t))
(load-theme 'modus-vivendi) (load-theme 'deeper-blue)
(when (string= system-type "darwin") (when (string= system-type "darwin")
(setq manual-program "gman")
(setq dired-use-ls-dired nil) (setq dired-use-ls-dired nil)
(setq mac-command-modifier 'control)) (setq mac-command-modifier 'control))
@@ -21,31 +22,67 @@
(keymap-global-set "M-2" #'split-window-below) (keymap-global-set "M-2" #'split-window-below)
(keymap-global-set "M-3" #'split-window-right) (keymap-global-set "M-3" #'split-window-right)
(keymap-global-set "C-x C-b" #'ibuffer)
(keymap-global-set "C-c e i" #'hgh/edit-init-file) (keymap-global-set "C-c e i" #'hgh/edit-init-file)
(keymap-global-set "C-," #'hgh/duplicate-dwim) (keymap-global-set "C-c e l" #'hgh/load-init-file)
(keymap-global-set "C-," #'duplicate-dwim)
(keymap-set help-map "h" #'eldoc)
;; (keymap-global-set "C-h h" #'eldoc)
(require 'grep)
(grep-apply-setting 'grep-command "rg --no-heading")
(grep-apply-setting 'grep-find-command nil)
(defun hgh/emacs-directory (path)
(concat user-emacs-directory path))
(setq (setq
custom-file "~/.emacs.d/custom.el" org-default-notes-file "~/inbox.org"
org-todo-keywords '((sequence "TODO" "INPROGRESS" "DONE"))
custom-file (hgh/emacs-directory "custom.el")
make-backup-files nil make-backup-files nil
dired-dwim-target t) dired-dwim-target t
manual-program "gman"
speedbar-window-default-width 25
speedbar-window-max-width 25
duplicate-line-final-position -1
duplicate-region-final-position -1
competions-detailed t
auth-sources '("~/.authinfo"))
(load-file "~/.emacs.d/utils.el") (require 'project)
(setq project-switch-commands '((project-find-file "Find file" "f")
(project-find-dir "Find dir" "d")
(project-dired "Dired" "D")
(project-find-regexp "ripgrep" "g")
(magit-project-status "Magit" "m")))
(setq-default cursor-type 'bar) (define-key project-prefix-map "u" #'hgh/update-projects)
(when (file-directory-p (hgh/emacs-directory "work"))
(load-file (hgh/emacs-directory "work/work.el"))
(add-to-list 'load-path (hgh/emacs-directory "work")))
(load-file (hgh/emacs-directory "utils.el"))
(setopt (setopt
use-short-answers t use-short-answers t
use-dialog-box nil use-dialog-box nil
use-package-enable-imenu-support t) use-package-enable-imenu-support t
display-line-numbers-type 'relative)
(electric-pair-mode 1) (electric-pair-mode 1)
(ido-mode 1)
(fido-mode 1) (fido-mode 1)
(global-completion-preview-mode 1) (global-completion-preview-mode 1)
(tab-bar-mode -1) (tab-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
(scroll-bar-mode -1) (scroll-bar-mode -1)
(global-hl-line-mode 1) (global-hl-line-mode 1)
(global-eldoc-mode 1)
(global-display-line-numbers-mode 1)
(global-auto-revert-mode 1)
(defun hgh/untabify-buffer () (defun hgh/untabify-buffer ()
(interactive) (interactive)
@@ -55,6 +92,7 @@
(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook 'hgh/untabify-buffer) (add-hook 'before-save-hook 'hgh/untabify-buffer)
(if (file-exists-p custom-file) (if (file-exists-p custom-file)
(load-file custom-file)) (load-file custom-file))
@@ -62,20 +100,101 @@
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
(use-package exec-path-from-shell (use-package exec-path-from-shell
:custom
(exec-path-from-shell-variables '("PATH" "MANPATH" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY" "AWS_SESSION_TOKEN"))
:demand t) :demand t)
(exec-path-from-shell-initialize) (exec-path-from-shell-initialize)
(use-package diminish
:demand t
:config
(diminish 'eldoc-mode)
(diminish 'completion-preview-mode))
(setq treesit-enabled-modes t)
(defun hgh/dired-this-directory ()
(interactive)
(dired (file-name-directory buffer-file-name)))
(use-package evil
:custom
(evil-want-C-u-scroll t)
(evil-want-Y-yank-to-eol t)
(evil-move-beyond-eol t)
(evil-undo-system 'undo-tree)
:ensure t
:init
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
(defvar hgh/evil-eglot-prefix-map
(let ((map (make-sparse-keymap)))
(define-key map "a" 'eglot-code-actions)
(define-key map "r" 'eglot-rename)
map))
:config
(evil-set-leader nil (kbd "SPC"))
(evil-mode 1)
(evil-global-set-key 'normal (kbd "M-.") #'xref-find-definitions)
(evil-global-set-key 'normal (kbd "<leader>ff") #'find-file)
(evil-global-set-key 'normal (kbd "<leader>fs") #'save-buffer)
(evil-global-set-key 'normal (kbd "<leader>fb") #'switch-to-buffer)
(evil-global-set-key 'normal (kbd "<leader>gs") #'magit)
(evil-global-set-key 'normal (kbd "<leader>gg") #'magit)
(evil-global-set-key 'normal (kbd "<leader>rw") #'hgh/dired-this-directory)
(evil-global-set-key 'normal (kbd "<leader>h") #'help-command)
(evil-global-set-key 'normal (kbd "<leader>w") evil-window-map)
(evil-global-set-key 'normal (kbd "<leader>p") project-prefix-map)
(evil-global-set-key 'visual (kbd "TAB") #'indent-region)
(evil-global-set-key 'normal (kbd "]d") #'flymake-goto-next-error)
(evil-global-set-key 'normal (kbd "[d") #'flymake-goto-prev-error)
(evil-define-key 'normal eglot-mode-map (kbd "<leader>l") hgh/evil-eglot-prefix-map)
(evil-global-set-key 'normal (kbd "[d") #'flymake-goto-prev-error))
(use-package evil-collection
:diminish 'evil-collection-unimpaired-mode
:after evil
:ensure t
:custom
(evil-collection-key-blacklist '("SPC"))
:config
(evil-collection-init)
(require 'compile)
(keymap-set compilation-minor-mode-map "SPC" nil)
(keymap-set compilation-mode-map "SPC" nil)
(keymap-set help-mode-map "SPC" nil))
(use-package evil-surround
:ensure t
:config
(global-evil-surround-mode 1))
(use-package move-text (use-package move-text
:bind (("M-<down>" . 'move-text-down) :bind (("M-<down>" . 'move-text-down)
("M-<up>" . 'move-text-up))) ("M-j" . 'move-text-down)
("M-<up>" . 'move-text-up)
("M-k" . 'move-text-up)))
(use-package jai-mode (use-package jai-mode
:vc (:url "https://github.com/valignatev/jai-mode.git" :vc (:url "https://github.com/valignatev/jai-mode.git"
:rev :newest)) :rev :newest))
(use-package magit (use-package magit
:bind ("C-x g" . magit-status)) :bind ("C-x g" . magit-status)
:config
(when (require 'evil nil 'noerror)
(evil-global-set-key 'normal (kbd "<leader>gg") #'magit-status)))
(use-package forge
:ensure t
:after magit
:custom (forge-add-default-bindings nil))
(use-package multiple-cursors (use-package multiple-cursors
:custom :custom
@@ -83,12 +202,7 @@
:bind (("C->" . mc/mark-next-like-this) :bind (("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this) ("C-<" . mc/mark-previous-like-this)
("C-c C-<" . mc/mark-all-like-this) ("C-c C-<" . mc/mark-all-like-this)
("C-c C->" . mc/mark-lines)) ("C-c C->" . mc/mark-lines)))
:init
(advice-add 'mc/mark-next-like-this :before #'hgh/set-box-cursor)
(advice-add 'mc/mark-previous-like-this :before #'hgh/set-box-cursor)
(advice-add 'mc/mark-all-like-this :before #'hgh/set-box-cursor)
(add-hook 'multiple-cursors-mode-disabled-hook #'hgh/set-bar-cursor))
(use-package cape (use-package cape
:hook ((completion-at-point-functions . cape-dabbrev) :hook ((completion-at-point-functions . cape-dabbrev)
@@ -118,10 +232,141 @@
dumber-jump-find-rules)) dumber-jump-find-rules))
(use-package eglot (use-package eglot
:custom
(eglot-documentation-renderer 'markdown-ts-view-mode)
(eglot-code-action-indications nil)
:bind (("C-c l a" . eglot-code-actions))
:hook ((jai-mode . eglot-ensure)
(dart-mode . eglot-ensure)
(terraform-mode . eglot-ensure)
(typescript-ts-mode . eglot-ensure)
(tsx-ts-mode . eglot-ensure)
(elixir-ts-mode . eglot-ensure))
:config :config
(push '(jai-mode "jails") eglot-server-programs) (push `(jai-mode "jails" "-jai_path" ,(concat (getenv "HOME") "/.local/jai/")) eglot-server-programs)
(push '(sql-mode "postgres-language-server" "lsp-proxy") eglot-server-programs)) (push '(sql-mode "postgres-language-server" "lsp-proxy") eglot-server-programs)
(setf (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
eglot-server-programs
nil nil #'equal)
'("/Users/grant/programming/thirdparty/elixir-ls/build/language_server.sh" "--stdio"))
)
(use-package yaml-mode) (use-package yaml-mode)
(use-package vterm) (use-package fish-mode)
(use-package yasnippet
:diminish yas-minor-mode
:config
(yas-global-mode 1))
(use-package yasnippet-snippets)
(use-package undo-tree
:diminish undo-tree-mode
:custom
(undo-tree-history-directory-alist `(,(cons "." (concat (file-name-directory user-init-file) "undo-tree"))))
:config
(global-undo-tree-mode 1))
(use-package dart-mode)
(use-package flymake
:custom
(flymake-wrap-around t))
(use-package markdown-ts-mode
:mode ("\\.md\\'" . markdown-ts-mode)
:defer t)
(use-package org-roam
:custom
(org-roam-directory (file-truename "~/org-roam"))
:init
(defvar hgh/org-roam-node-map
(define-keymap
"o" #'org-roam-node-find
"f" #'org-roam-node-find
"i" #'org-roam-node-insert
"c" #'org-roam-capture)
"Keymap for capturing new org roam nodes.")
(evil-global-set-key 'normal (kbd "<leader>o") hgh/org-roam-node-map)
:config
(condition-case err
(make-directory "~/org-roam")
(file-already-exists nil))
(org-roam-db-autosync-mode))
(use-package ghostel
:custom
(ghostel-module-auto-install "download"))
(use-package terraform-mode
:init
(setf (alist-get "\\.tfstate\\'" auto-mode-alist nil nil #'string=) 'json-ts-mode))
(use-package apheleia
:diminish apheleia-mode
:config
(dolist (pair apheleia-formatters)
(let ((formatter (symbol-name (car pair))))
(when (string-prefix-p "prettier" formatter)
(setf (alist-get (car pair) apheleia-formatters)
'("npx" "prettier" "--stdin-filepath" filepath)))))
(apheleia-global-mode 1))
(use-package mise
:diminish mise-mode
:config
(global-mise-mode 1))
(use-package dotenv-mode)
;; Enable rich annotations using the Marginalia package
(use-package marginalia
;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
;; available in the *Completions* buffer, add it to the
;; `completion-list-mode-map'.
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle))
;; The :init section is always executed.
:init
;; Marginalia must be activated in the :init section of use-package such that
;; the mode gets enabled right away. Note that this forces loading the
;; package.
(marginalia-mode -1))
(use-package embark
:ensure t
:bind
(("M-'" . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim)) ;; good alternative: M-.
:init
;; Optionally replace the key help with a completing-read interface
;; Show the Embark target at point via Eldoc. You may adjust the
;; Eldoc strategy, if you want to see the documentation from
;; multiple providers. Beware that using this can be a little
;; jarring since the message shown in the minibuffer can be more
;; than one line, causing the modeline to move up and down:
;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
;; Add Embark to the mouse context menu. Also enable `context-menu-mode'.
;; (context-menu-mode 1)
;; (add-hook 'context-menu-functions #'embark-context-menu 100)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))

View File

@@ -3,6 +3,10 @@
(interactive) (interactive)
(find-file user-init-file)) (find-file user-init-file))
(defun hgh/load-init-file ()
(interactive)
(load-file user-init-file))
(defun hgh/duplicate-dwim () (defun hgh/duplicate-dwim ()
(interactive) (interactive)
(duplicate-dwim) (duplicate-dwim)
@@ -13,3 +17,17 @@
(defun hgh/set-box-cursor(&rest args) (defun hgh/set-box-cursor(&rest args)
(setq-local cursor-type 'box)) (setq-local cursor-type 'box))
(defun hgh/update-projects ()
(interactive)
(dolist (path '("/programming/projects/"
"/programming/projects/worktrees"
"/programming/thirdparty/"
"/programming/probe/"))
(let ((projects-root (concat (getenv "HOME") path)))
(make-directory projects-root t)
(dolist (dir (directory-files projects-root t "^[^.]"))
(when (file-directory-p dir)
(let ((pr (project--find-in-directory dir)))
(when pr (project-remember-project pr)))))))
(message "Project list updated."))