Compare commits

...

7 Commits

3 changed files with 113 additions and 69 deletions

View File

@@ -6,13 +6,13 @@
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(package-selected-packages '(package-selected-packages
'(aider browse-kill-ring caddyfile-mode cape cider company corfu '(aider browse-kill-ring caddyfile-mode cape cider company corfu
dockerfile-mode dumb-jump dumber-jump emacs-lldb dockerfile-mode dumb-jump dumber-jump emacs-lldb emmet
exec-path-from-shell flycheck fsharp-mode haskell-mode emmet-mode exec-path-from-shell flycheck fsharp-mode
haskell-ts-mode helm htmlize idris-mode marginalia haskell-mode haskell-ts-mode helm htmlize idris-mode
markdown-ts-mode multiple-cursors odin-mode orderless marginalia markdown-ts-mode move-text multiple-cursors
org-mode parinfer-rust-mode realgud-lldb rg sly odin-mode orderless org-mode parinfer-rust-mode
terraform-mode tree-sitter-langs vertico visual-fill-column realgud-lldb rg sly terraform-mode tree-sitter-langs
yasnippet-snippets zig-mode)) vertico visual-fill-column yasnippet-snippets zig-mode))
'(safe-local-variable-directories '("/Users/grant/programming/project/edit/")) '(safe-local-variable-directories '("/Users/grant/programming/project/edit/"))
'(safe-local-variable-values '(safe-local-variable-values
'((Package . CL-USER) (Syntax . ANSI-Common-Lisp) (Base . 10) '((Package . CL-USER) (Syntax . ANSI-Common-Lisp) (Base . 10)

154
init.el
View File

@@ -1,4 +1,4 @@
;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
(require 'package) (require 'package)
(add-to-list 'package-archives (add-to-list 'package-archives
@@ -8,12 +8,12 @@
(require 'use-package-ensure) (require 'use-package-ensure)
(require 'bind-key) (require 'bind-key)
; If startup times are slow ;; If startup times are slow
; (setq use-package-verbose t) ;; (setq use-package-verbose t)
;; (setq use-package-compute-statistics t)
(add-to-list 'load-path (concat (file-name-parent-directory user-init-file) "local-lisp/")) (add-to-list 'load-path (concat user-emacs-directory "local-lisp/"))
(use-package emacs)
(setq tab-bar-show nil) (setq tab-bar-show nil)
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
(setq initial-scratch-message nil) (setq initial-scratch-message nil)
@@ -36,6 +36,8 @@
(setq-default tab-width 4) (setq-default tab-width 4)
(set-face-attribute 'default nil :height 160 :family "Berkeley Mono") (set-face-attribute 'default nil :height 160 :family "Berkeley Mono")
(global-hl-line-mode 1) (global-hl-line-mode 1)
(pixel-scroll-precision-mode 1)
(kill-ring-deindent-mode 1)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
(setq mac-command-modifier 'control) (setq mac-command-modifier 'control)
@@ -43,14 +45,14 @@
(setq-default cursor-type 'bar) (setq-default cursor-type 'bar)
(defun hgh/disable-bar-cursor () (defun hgh/disable-cursor-blink ()
(blink-cursor-mode -1)) (blink-cursor-mode -1))
(defun hgh/enable-bar-cursor () (defun hgh/enable-cursor-blink ()
(blink-cursor-mode 1)) (blink-cursor-mode 1))
(add-hook 'activate-mark-hook 'hgh/disable-bar-cursor) (add-hook 'activate-mark-hook 'hgh/disable-cursor-blink)
(add-hook 'deactivate-mark-hook 'hgh/enable-bar-cursor) (add-hook 'deactivate-mark-hook 'hgh/enable-cursor-blink)
(when is-mac (when is-mac
(setq dired-use-ls-dired t (setq dired-use-ls-dired t
@@ -59,7 +61,6 @@
;; Add .asdf to exec-path ;; Add .asdf to exec-path
(when (file-exists-p (file-truename "~/.asdf")) (when (file-exists-p (file-truename "~/.asdf"))
(setq env-changed t)
(push (file-truename "~/.asdf/shims") exec-path) (push (file-truename "~/.asdf/shims") exec-path)
(push (file-truename "~/.asdf/bin") exec-path)) (push (file-truename "~/.asdf/bin") exec-path))
@@ -67,8 +68,7 @@
(setq exec-path (setq exec-path
(cl-remove-if (lambda (s) (cl-remove-if (lambda (s)
(and (< 5 (length s)) (and (< 5 (length s))
(string= (substring s 0 6) "/mnt/c") (string= (substring s 0 6) "/mnt/c")))
(setq env-changed t)))
exec-path)) exec-path))
(when exec-path (when exec-path
@@ -110,6 +110,12 @@
(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-," #'duplicate-dwim)
(keymap-set completion-list-mode-map "M-n" #'minibuffer-next-completion)
(keymap-set completion-list-mode-map "M-p" #'minibuffer-previous-completion)
(keymap-set completion-in-region-mode-map "M-n" #'minibuffer-next-completion)
(keymap-set completion-in-region-mode-map "M-p" #'minibuffer-previous-completion)
(require 'dired) (require 'dired)
(setq dired-dwim-target t) (setq dired-dwim-target t)
@@ -117,6 +123,24 @@
(load-theme 'modus-vivendi t) (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 exec-path-from-shell (use-package exec-path-from-shell
:when is-mac :when is-mac
:config :config
@@ -131,14 +155,14 @@
:defer t) :defer t)
(use-package tree-sitter (use-package tree-sitter
:mode ((" \\.tsx\\'" . tsx-ts-mode) :mode (("\\.tsx\\'" . tsx-ts-mode)
(" \\.js\\'" . typescript-ts-mode) ("\\.js\\'" . typescript-ts-mode)
(" \\.mjs\\'" . typescript-ts-mode) ("\\.mjs\\'" . typescript-ts-mode)
(" \\.mts\\'" . typescript-ts-mode) ("\\.mts\\'" . typescript-ts-mode)
(" \\.cjs\\'" . typescript-ts-mode) ("\\.cjs\\'" . typescript-ts-mode)
(" \\.ts\\'" . typescript-ts-mode) ("\\.ts\\'" . typescript-ts-mode)
(" \\.jsx\\'" . tsx-ts-mode) ("\\.jsx\\'" . tsx-ts-mode)
(" \\.json\\'" . json-ts-mode)) ("\\.json\\'" . json-ts-mode))
:custom :custom
(treesit-extra-load-path '("~/repos/tree-sitter-module/dist"))) (treesit-extra-load-path '("~/repos/tree-sitter-module/dist")))
@@ -155,14 +179,16 @@
(when (and (when (and
(not (s-contains? "sbcl" buf)) (not (s-contains? "sbcl" buf))
(not (s-contains? "ocicl" buf)) (not (s-contains? "ocicl" buf))
(not (s-contains? "elpa" buf))
(not (s-contains? "emacs-plus" buf))
(not (string-prefix-p "*sly" buf))) (not (string-prefix-p "*sly" buf)))
(parinfer-rust-mode 1)))) (parinfer-rust-mode 1))))
(use-package parinfer-rust-mode (use-package parinfer-rust-mode
:defer t :defer t
:hook ((lisp-mode emacs-lisp-mode) . enable-parinfer) :hook ((lisp-mode emacs-lisp-mode) . enable-parinfer)
:config :custom
(setq parinfer-rust-disable-troublesome-modes t)) (parinfer-rust-disable-troublesome-modes t))
(use-package sly (use-package sly
:mode "\\.lisp\\'" :mode "\\.lisp\\'"
@@ -192,13 +218,6 @@
(setq completion-styles '(orderless basic) (setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))) completion-category-overrides '((file (styles basic partial-completion)))))
(use-package corfu
:custom
(corfu-auto t)
(corfu-cycle t)
:config
(global-corfu-mode 1))
(use-package cape (use-package cape
:init :init
(add-to-list 'completion-at-point-functions #'cape-dabbrev)) (add-to-list 'completion-at-point-functions #'cape-dabbrev))
@@ -283,21 +302,21 @@
(file-name-nondirectory (directory-file-name default-directory)) (file-name-nondirectory (directory-file-name default-directory))
" rg*")))) " rg*"))))
(defun hgh/set-cursor-type-box (&rest _args)
(setq-local cursor-type 'box))
(defun hgh/set-cursor-type-bar (&rest _args)
(setq-local cursor-type 'bar))
(use-package multiple-cursors (use-package multiple-cursors
:hook ((multiple-cursors-mode-disabled . hgh/set-cursor-type-bar))
:bind (("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this))
:init :init
(add-hook 'multiple-cursors-mode-enabled-hook ;; NOTE(grant): I have no idea if the package is deferred or autoloaded anymore
(lambda () (advice-add 'mc/mark-next-like-this :before #'hgh/set-cursor-type-box)
(remove-hook 'activate-mark-hook 'hgh/disable-bar-cursor) (advice-add 'mc/mark-previous-like-this :before #'hgh/set-cursor-type-box))
(remove-hook 'deactivate-mark-hook 'hgh/disable-bar-cursor)
(blink-cursor-mode 1)))
(add-hook 'multiple-cursors-mode-disabled-hook
(lambda ()
(add-hook 'activate-mark-hook 'hgh/disable-bar-cursor)
(add-hook 'deactivate-mark-hook 'hgh/disable-bar-cursor)
(blink-cursor-mode 1)))
:config
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this))
(use-package yasnippet (use-package yasnippet
:diminish :diminish
@@ -335,26 +354,27 @@
:defer t) :defer t)
(use-package org (use-package org
:mode "\\.org\\'" :ensure nil
:mode ("\\.org\\'" . org-mode)
:hook (org-mode . org-indent-mode)
:custom :custom
(org-todo-keywords '((sequence "TODO" "INPROGRESS" "DONE"))) (org-todo-keywords '((sequence "TODO" "INPROGRESS" "DONE")))
(org-support-shift-select t) (org-support-shift-select t)
(org-default-notes-file (concat org-directory "/captures.org"))
(org-html-validation-link nil) (org-html-validation-link nil)
(org-html-head-include-default-style nil) (org-html-head-include-default-style nil)
(org-html-head-include-scripts nil) (org-html-head-include-scripts nil)
(org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />") (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")))
:config (org-publish-use-timestamps-flag nil)
(org-indent-mode) (org-publish-project-alist
(require 'ox-publish)
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)))
(setq org-publish-use-timestamps-flag nil)
(setq org-publish-project-alist
(list (list
(list "writings" (list "writings"
:base-directory "~/Documents/writings/content" :base-directory "~/Documents/writings/content"
@@ -364,7 +384,14 @@
:time-stamp-file nil :time-stamp-file nil
:section-numbers nil :section-numbers nil
:with-creator t :with-creator t
:with-author nil)))) :with-author nil)))
:config
(require 'ox-publish)
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t))))
(use-package dumber-jump (use-package dumber-jump
:init :init
@@ -400,3 +427,20 @@
(codex-provider nil) (codex-provider nil)
(codex-model nil) (codex-model nil)
:ensure nil) :ensure nil)
(use-package move-text
:bind (("M-<up>" . move-text-up)
("M-<down>" . move-text-down)))
(use-package emmet-mode
:hook (sgml-mode tsx-ts-mode)
:custom
(emmet-jsx-major-modes
'(rjsx-mode
typescript-tsx-mode
js-jsx-mode
js2-jsx-mode
jsx-mode
js-mode
;; Need to add this
tsx-ts-mode)))

View File

@@ -82,13 +82,13 @@ http_headers = {
:type 'boolean :type 'boolean
:group 'codex) :group 'codex)
(defcustom codex-sessions-file (concat (file-name-parent-directory user-init-file) "codex-sessions") (defcustom codex-sessions-file (concat user-emacs-directory "codex-sessions")
"What the default name should be fore the codex chat buffer." "What the default name should be fore the codex chat buffer."
:type 'string :type 'string
:group 'codex) :group 'codex)
(defcustom codex-sessions-history-dir (defcustom codex-sessions-history-dir
(concat (file-name-parent-directory user-init-file) "codex-sessions-history/") (concat user-emacs-directory "codex-sessions-history/")
"Directory where Codex session histories are stored." "Directory where Codex session histories are stored."
:type 'directory :type 'directory
:group 'codex) :group 'codex)
@@ -221,7 +221,7 @@ http_headers = {
(defun codex--send (prompt) (defun codex--send (prompt)
"Sends a prompt to codex." "Sends a prompt to codex."
(let* ((buf (generate-new-buffer "*codex--send*")) (let* ((buf (generate-new-buffer " *codex--send*"))
(proc (make-process (proc (make-process
:name "codex" :name "codex"
:buffer buf :buffer buf