Compare commits

...

11 Commits

Author SHA1 Message Date
1d14d7a09d cua keybinds 2026-06-22 13:04:47 -04:00
c4ce8f1417 update gitignore 2026-05-22 09:14:34 -04:00
d35693b7d3 add utils.el 2026-05-22 09:13:20 -04:00
02ed88ae45 allow all commands for multicursors 2026-05-21 15:40:31 -04:00
6c1831ab96 set up bar cursor 2026-05-17 10:26:20 -04:00
d3533c5965 add dired dwim target 2026-05-17 10:26:20 -04:00
93ac045c78 add electric pair mode 2026-05-16 19:12:19 -04:00
fe05a4f63e untabify on save 2026-05-16 18:58:00 -04:00
5f54cce368 add imenu key bind 2026-05-04 08:46:30 -04:00
0c05222415 add jails 2026-05-03 07:05:33 -04:00
5b16a222ca add a bunch of stuff 2026-04-28 20:33:19 -04:00
4 changed files with 158 additions and 25 deletions

5
.gitignore vendored
View File

@@ -1,2 +1,3 @@
eln-cache *
elpa !*.el
!user-lisp

View File

@@ -1,11 +1,15 @@
;; -*- lexical-binding: t; -*-
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables 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-code-action-indications '(eldoc-hint))
'(package-selected-packages '(package-selected-packages
'(cape dumb-jump exec-path-from-shell jai-mode magit move-text '(apheleia cape dart-mode dumb-jump dumber-jump exec-path-from-shell
multiple-cursors)) jai-mode magit marginalia markdown-mode move-text
multiple-cursors nael orderless undo-tree vertico vterm
yaml yaml-mode))
'(package-vc-selected-packages '(package-vc-selected-packages
'((jai-mode :url "https://github.com/valignatev/jai-mode.git")))) '((jai-mode :url "https://github.com/valignatev/jai-mode.git"))))
(custom-set-faces (custom-set-faces

160
init.el
View File

@@ -1,35 +1,84 @@
;; -*- lexical-binding: t; -*-
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize) (package-initialize)
(set-frame-font "BerkeleyMono 14" nil t) (if (string= system-type "darwin")
(set-frame-font "Berkeley Mono 16" nil t)
(set-frame-font "BerkeleyMono 14" nil t))
(load-theme 'modus-vivendi) (load-theme 'modus-vivendi)
(defun hgh/edit-init-file () (when (string= system-type "darwin")
(interactive) (setq dired-use-ls-dired nil)
(find-file user-init-file)) (setq mac-command-modifier 'control))
(setq hgh/cua t)
(defun hgh/set-cua-keymaps ()
(setq cua-mode 1)
(keymap-global-set "C-o" #'find-file)
(keymap-global-set "C-f" #'isearch-forward)
(keymap-global-set "C-r" #'compile)
(keymap-global-set "C-b" #'switch-to-buffer)
(keymap-global-set "C-j" #'eldoc)
(keymap-global-set "<f1>" #'hgh/edit-init-file))
(defun hgh/set-non-cua-keymaps ()
(keymap-global-set "C-c c" #'compile)
(keymap-global-set "C-h h" #'eldoc)
(keymap-global-set "C-c e i" #'hgh/edit-init-file))
(hgh/set-cua-keymaps)
(setq duplicate-line-final-position -1
duplicate-region-final-position -1)
(keymap-global-set "C-," #'duplicate-dwim)
(keymap-global-set "M-o" #'other-window) (keymap-global-set "M-o" #'other-window)
(keymap-global-set "C-c c" #'compile) ;; (keymap-global-set "M-i" #'imenu)
(keymap-global-set "M-0" #'delete-window) (keymap-global-set "M-0" #'delete-window)
(keymap-global-set "M-1" #'delete-other-windows) (keymap-global-set "M-1" #'delete-other-windows)
(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-c e i" #'hgh/edit-init-file) (keymap-global-set "M-i" #'complete-symbol)
(require 'completion-preview)
(keymap-set completion-preview-active-mode-map "M-n" #'completion-preview-next-candidate)
(keymap-set completion-preview-active-mode-map "M-p" #'completion-preview-prev-candidate)
(setq (setq
custom-file "/home/grant/.emacs.d/custom.el" custom-file "~/.emacs.d/custom.el"
make-backup-files nil) make-backup-files nil
dired-dwim-target t
use-package-compute-statistics t
treesit-font-lock-level 4)
(ido-mode 1) (load-file "~/.emacs.d/utils.el")
(fido-mode 1)
(setq-default cursor-type 'bar)
(setopt
use-short-answers t
use-dialog-box nil
use-package-enable-imenu-support t
tab-width 4)
(electric-pair-mode 1)
(ido-mode -1)
(fido-mode -1)
(global-completion-preview-mode 1) (global-completion-preview-mode 1)
(global-eldoc-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)
(defun hgh/untabify-buffer ()
(interactive)
(untabify (region-beginning) (region-end) nil))
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter) (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(if (file-exists-p custom-file) (if (file-exists-p custom-file)
(load-file custom-file)) (load-file custom-file))
@@ -44,27 +93,96 @@
(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-<up>" . '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))
(use-package multiple-cursors (use-package multiple-cursors
:bind (("C->" . mc/mark-next-like-this) :custom
("C-<" . mc/mark-previous-like-this) (mc/always-run-for-all t)
("C-c C-<" . mc/mark-all-like-this))) :bind (("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-c C-<" . mc/mark-all-like-this)
("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)
(completion-at-point-functions . cape-file))) (completion-at-point-functions . cape-file)))
(use-package dumb-jump (use-package dumber-jump
:demand t
:custom
(dumb-jump-prefer-searcher 'rg)
:init :init
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) (add-hook 'xref-backend-functions #'dumber-jump-xref-activate)
:config
(push
'(:language "jai" :type "function"
:supports ("ag" "grep" "rg" "git-grep")
:regex "\\bJJJ\\s*::"
:tests ("test ::"))
dumber-jump-find-rules)
(push
'(:language "jai" :type "variable"
:supports ("ag" "grep" "rg" "git-grep")
:regex "\\bJJJ\\s*(:|:\\s*=|::)"
:tests ("test: Type" "test : Type = Val" "test :: Val"))
dumber-jump-find-rules)
(push
'(:language "jai" :type "type"
:supports ("ag" "grep" "rg" "git-grep")
:regex "\\bJJJ\\s*::"
:tests ("test ::"))
dumber-jump-find-rules))
;; go-ts-mode registers its `\\.go\\'' -> auto-mode-alist entry with a
;; top-level form that has no autoload cookie, so it only runs once
;; the file is loaded. Add the mapping ourselves so .go files open in
;; go-ts-mode (grammar already lives under tree-sitter/).
(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))
(add-to-list 'auto-mode-alist '("go\\.mod\\'" . go-mod-ts-mode))
(use-package eglot
:hook ((jai-mode . eglot-ensure)
(go-ts-mode . eglot-ensure))
:config
(push '(jai-mode "jails" "-jai_path" "/home/grant/.local/jai/") eglot-server-programs)
(push '(sql-mode "postgres-language-server" "lsp-proxy") eglot-server-programs)
(push '(dart-mode "fvm" "dart" "language-server" "--client-id" "emacs.eglot-dart") eglot-server-programs))
(use-package yaml-mode)
(use-package vterm)
(use-package dart-mode)
(use-package nael)
(use-package vertico
:init
(vertico-mode 1))
(use-package marginalia
:init
(marginalia-mode 1))
(use-package orderless)
(use-package go-ts-mode
:custom
(go-ts-mode-indent-offset 4))
(use-package undo-tree
:init
(global-undo-tree-mode 1))
(use-package apheleia
:init
(apheleia-global-mode 1))

10
utils.el Normal file
View File

@@ -0,0 +1,10 @@
;; -*- lexical-binding: t; -*-
(defun hgh/edit-init-file ()
(interactive)
(find-file user-init-file))
(defun hgh/set-bar-cursor(&rest args)
(setq-local cursor-type 'bar))
(defun hgh/set-box-cursor(&rest args)
(setq-local cursor-type 'box))