aboutsummaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.config/emacs/init.org53
-rw-r--r--emacs/.emacs.d/.gitignore1
-rw-r--r--emacs/.emacs.d/init.org846
-rw-r--r--emacs/.emacs.d/oni-compilation.el53
-rw-r--r--emacs/.emacs.d/oni-corfu.el17
-rw-r--r--emacs/.emacs.d/oni-dashboard.el57
-rw-r--r--emacs/.emacs.d/oni-dumb-jump.el15
-rw-r--r--emacs/.emacs.d/oni-flycheck.el28
-rw-r--r--emacs/.emacs.d/oni-grep.el29
-rw-r--r--emacs/.emacs.d/oni-gui.el92
-rw-r--r--emacs/.emacs.d/oni-hl-todo.el8
-rw-r--r--emacs/.emacs.d/oni-outline.el8
-rw-r--r--emacs/.emacs.d/oni-php.el331
-rw-r--r--emacs/.emacs.d/oni-prescient.el11
-rw-r--r--emacs/.emacs.d/oni-smartparens.el12
-rw-r--r--emacs/.emacs.d/oni-stillness.el6
-rw-r--r--emacs/.emacs.d/oni-xterm-color.el5
-rw-r--r--emacs/.emacs.d/oni-yasnippet.el34
-rwxr-xr-xemacs/.emacs.d/scripts/find-php-class48
19 files changed, 1601 insertions, 53 deletions
diff --git a/emacs/.config/emacs/init.org b/emacs/.config/emacs/init.org
deleted file mode 100644
index ff7186d..0000000
--- a/emacs/.config/emacs/init.org
+++ /dev/null
@@ -1,53 +0,0 @@
-#+TITLE: Emacs Configuration
-
-First, lexical binding must be enabled. This is better for performance, but also makes variable binding behave more as expected, and allows the creation of closures.
-
-#+begin_src emacs-lisp :padline no
- ;; -*- lexical-binding: t; -*-
-#+end_src
-
-#+begin_src emacs-lisp
- (require 'oni-core)
- (require 'oni-gui)
-#+end_src
-
-Store all auto-save files in =$XDG_DATA_HOME/emacs/auto-save-list= to prevent them from clogging up =$XDG_CONFIG_HOME/emacs/=. The XDG specification says that if =XDG_DATA_HOME= hasn't been specified a default of =~/.local/share= should be used.
-
-#+begin_src emacs-lisp
- (add-to-list
- 'auto-save-file-name-transforms
- `(,(rx (zero-or-more any))
- ,(concat (or (getenv "XDG_DATA_HOME")
- (expand-file-name "~/.local/share"))
- "/emacs/auto-save-list")
- t)
- t)
-#+end_src
-
-Use =hunspell= instead of the default =aspell=. Hunspell is used by LibreOffice and other programs too. So far (at least through Emacs) it doesn't recognize the =’= as an apostrophe and I have to use ='= in org-mode if I want spell checking to accept word contractions in English.
-
-#+begin_src emacs-lisp
- (eval-when-compile (require 'ispell))
- (with-eval-after-load 'ispell
- (setq ispell-program-name "hunspell"
- ispell-really-hunspell t))
-#+end_src
-
-Electric quote uses pretty quoting characters =’=, =‘=, =”=, and =“= instead of ='= and ="=, but when I'm in the middle of a word I don't want to use =’= (right single quotation mark), but ='= (apostrophe), which provides better results with spellchecking. So here is a function that checks whether the character before the previous is a word character.
-
-#+begin_src emacs-lisp
- (defun oni-in-word-p ()
- "Check whether the character just typed was part of a word."
- (save-excursion
- (backward-char)
- (looking-back (rx word) (1- (point)))))
-#+end_src
-
-Now that I can check whether or not I'm typing a word, I can tell =electric-quote-mode= not to use =’= in that case.
-
-#+begin_src emacs-lisp
- (with-eval-after-load 'electric
- (add-hook 'electric-quote-inhibit-functions #'oni-in-word-p))
-#+end_src
-
-So now that that's settled, I should be writing ='= in words like “shouldn't'' and =’= otherwise. And spellchecking should work just fine.
diff --git a/emacs/.emacs.d/.gitignore b/emacs/.emacs.d/.gitignore
new file mode 100644
index 0000000..509e059
--- /dev/null
+++ b/emacs/.emacs.d/.gitignore
@@ -0,0 +1 @@
+init.el \ No newline at end of file
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
new file mode 100644
index 0000000..ab3d120
--- /dev/null
+++ b/emacs/.emacs.d/init.org
@@ -0,0 +1,846 @@
+#+TITLE: Emacs Configuration
+
+First, lexical binding must be enabled. This is better for performance, but also makes variable binding behave more as expected, and allows the creation of closures.
+
+#+begin_src emacs-lisp :padline no
+ ;; -*- lexical-binding: t; -*-
+#+end_src
+
+Switch prompts for “yes” or “no” to “y” or “n”.
+
+#+begin_src emacs-lisp
+ (defalias 'yes-or-no-p 'y-or-n-p)
+#+end_src
+
+sStore all auto-save files in =$XDG_DATA_HOME/emacs/auto-save-list= and backup files in =$XDG_DATA_HOME/emacs/backup-files= to prevent them from clogging up =$XDG_CONFIG_HOME/emacs/=. The XDG specification says that if =XDG_DATA_HOME= hasn't specified a default of =~/.local/share= should be used.
+
+#+begin_src emacs-lisp
+ (defun oni-core-data-dir (file)
+ (expand-file-name file (concat (or (getenv "XDG_DATA_HOME")
+ "~/.local/share")
+ "/emacs/")))
+
+ (add-to-list
+ 'auto-save-file-name-transforms
+ `(,(rx (zero-or-more any))
+ ,(oni-core-data-dir "auto-save-list")
+ t)
+ t)
+
+ (setq backup-directory-alist
+ `((".*" . ,(oni-core-data-dir "backups/"))))
+
+ (setq abbrev-file-name (oni-core-data-dir "abbrev_defs"))
+
+ (setq recentf-save-file (oni-core-data-dir "recentf"))
+#+end_src
+
+Use =hunspell= instead of the default =aspell=. Hunspell is used by LibreOffice and other programs too. So far (at least through Emacs) it doesn't recognize the =’= as an apostrophe and I have to use ='= in org-mode if I want spell checking to accept word contractions in English.
+
+#+begin_src emacs-lisp
+ (eval-when-compile (require 'ispell))
+ (with-eval-after-load 'ispell
+ (setq ispell-program-name "hunspell"
+ ispell-really-hunspell t))
+#+end_src
+
+Electric quote uses pretty quoting characters =’=, =‘=, =”=, and =“= instead of ='= and ="=, but when I'm in the middle of a word I don't want to use =’= (right single quotation mark), but ='= (apostrophe), which provides better results with spellchecking. So here is a function that checks whether the character before the previous is a word character.
+
+#+begin_src emacs-lisp
+ (defun oni-in-word-p ()
+ "Check whether the character just typed was part of a word."
+ (save-excursion
+ (backward-char)
+ (looking-back (rx word) (1- (point)))))
+#+end_src
+
+Now that I can check whether or not I'm typing a word, I can tell =electric-quote-mode= not to use =’= in that case.
+
+#+begin_src emacs-lisp
+ (with-eval-after-load 'electric
+ (add-hook 'electric-quote-inhibit-functions #'oni-in-word-p))
+#+end_src
+
+So now that that's settled, I should be writing ='= in words like “shouldn't'' and =’= otherwise. And spellchecking should work just fine.
+
+Add MELPA to package archives, this lets me install more packages.
+
+#+begin_src emacs-lisp
+ (eval-and-compile
+ (use-package package
+ :config
+ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)))
+#+end_src
+
+Make use-package default to ensuring everything. This way each =use-package= doesn't need to have its own ~:ensure t~ and when I use Guix to install these modules they don't try to download everything from everywhere else.
+
+#+begin_src emacs-lisp
+ (eval-and-compile
+ (require 'use-package-ensure)
+ (setq use-package-always-ensure t))
+#+end_src
+
+* exec-path-from-shell
+
+This is necessary to make sure that packages installed through bundle and such are available in Emacs.
+
+#+begin_src emacs-lisp
+ (use-package exec-path-from-shell
+ :init
+ (when (memq window-system '(mac ns x))
+ (exec-path-from-shell-initialize)))
+#+end_src
+
+* Ensure system packages
+
+Add the =use-package-ensure-system-package= extension for =use-package=.
+
+#+begin_src emacs-lisp
+ (use-package use-package-ensure-system-package)
+ (use-package system-packages)
+#+end_src
+
+* Docker
+
+I need to use Docker for some projects at work.
+
+#+begin_src emacs-lisp
+ (use-package dockerfile-mode)
+#+end_src
+
+* PHP
+
+I currently develop in PHP.
+
+#+begin_src emacs-lisp
+ (use-package php-mode
+ :ensure-system-package php)
+#+end_src
+
+* Magit
+
+GIT.
+
+#+begin_src emacs-lisp
+ (use-package magit
+ :hook
+ (magit-pre-display-buffer-hook . magit-save-window-configuration)
+ :custom
+ (magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1 "Show magit buffers in full-frame")
+ (magit-bury-buffer-function 'magit-restore-window-configuration "Bring back the windows as they were before magit"))
+#+end_src
+
+Tell magit to apply ANSI colors in the process buffer.
+
+#+begin_src emacs-lisp
+ (use-package magit-process
+ :config
+ (setq magit-process-apply-ansi-colors 'filter))
+#+end_src
+
+* Lua mode
+
+Lua is mainly used by wezterm right now.
+
+#+begin_src emacs-lisp
+ (use-package lua-mode)
+#+end_src
+
+* Markdown
+
+#+begin_src emacs-lisp
+ (use-package markdown-mode)
+#+end_src
+
+* Org Mode
+
+#+begin_src emacs-lisp
+ (use-package org
+ :bind (("C-c o c" . org-capture)
+ ("C-c o a" . org-agenda)
+ ("C-c o l" . org-store-link)
+ ("C-c o b" . org-switchb))
+ :config
+ (add-hook 'org-mode-hook 'visual-line-mode)
+ (add-hook 'org-mode-hook 'org-indent-mode))
+
+ (use-package org-capture
+ :config
+ (map-put org-capture-templates "t"
+ '("A simple TODO item" entry (file "") "* TODO %?
+ :PROPERTIES:
+ :CREATED: %U
+ :END:"))
+ (map-put org-capture-templates "d"
+ '("A simple DONE item" entry (file "") "* DONE %?
+ :PROPERTIES:
+ :CREATED: %U
+ :END:"))
+ (map-put org-capture-templates "n"
+ '("A simple note" entry (file "") "* Note taken on %U
+ :PROPERTIES:
+ :CREATED: %U
+ :END:
+
+ %?"))
+ (map-put org-capture-templates "N"
+ '("A simple note (on current task)" item (clock) "- Note taken on %U: \\\\
+ %?"))
+ (map-put org-capture-templates "r"
+ '("An Operational Request came in" entry (file "") "* TODO Operation Request %^U
+ :PROPERTIES:
+ :CREATED: %U
+ :END:
+
+ %c")))
+#+end_src
+
+* Diminish
+
+This is used to hide minor mode names.
+
+#+begin_src emacs-lisp
+ (use-package diminish)
+#+end_src
+
+* GCMH
+
+This package helps improve the garbage collection settings to match modern computers better and improve overall performance.
+
+#+begin_src emacs-lisp
+ (use-package gcmh
+ :diminish gcmh-mode
+ :init
+ (gcmh-mode))
+#+end_src
+
+* Hydra
+
+#+begin_src emacs-lisp
+ (use-package hydra)
+#+end_src
+
+* Delete Trailing Whitespace
+
+It bugs me to have whitespace left over.
+
+#+begin_src emacs-lisp
+ (add-hook 'before-save-hook 'delete-trailing-whitespace)
+#+end_src
+
+* Consult
+
+#+begin_src emacs-lisp
+ (use-package consult)
+#+end_src
+
+* Diff-hl
+
+Highlight diffs in the fringe.
+
+#+begin_src emacs-lisp
+ (use-package diff-hl
+ :init
+ (global-diff-hl-mode))
+#+end_src
+
+* Vertico
+
+#+begin_src emacs-lisp
+ (use-package vertico
+ :init (vertico-mode)
+ :bind (:map vertico-map
+ ("<return>" . vertico-directory-enter)
+ ("<backspace>" . vertico-directory-delete-char)
+ ("M-<backspace>" . vertico-directory-delete-word)))
+
+ (use-package vertico-prescient
+ :init (vertico-prescient-mode))
+
+ (use-package vertico-posframe
+ :init (vertico-posframe-mode)
+ :config
+ (setq vertico-posframe-poshandler 'posframe-poshandler-frame-bottom-center))
+#+end_src
+
+* Marginalia
+
+#+begin_src emacs-lisp
+ (use-package marginalia)
+#+end_src
+
+* Ace Window
+
+#+begin_src emacs-lisp
+ (use-package ace-window
+ :bind (("M-o" . ace-window)
+ ("C-x o")))
+#+end_src
+
+* Rest
+
+#+begin_src emacs-lisp
+ (require 'auth-source)
+ (require 'generic-x)
+ (require 'package)
+ (require 'recentf)
+ (require 'which-key)
+
+ (defconst oni-core--auto-save-directory (oni-core-data-dir "auto-save-files")
+ "Directory where auto-saves go.")
+
+ (defalias 'yes-or-no-p 'y-or-n-p)
+
+ (defvar oni-core--recentf-idle-timer nil
+ "Internal variable keeping track of a timer started for ‘recentf-save-list’.")
+
+ (defun oni-core--switch-newline-keys ()
+ "Switch the ‘C-j’ and ‘RET’ keys in the local buffer."
+ (if electric-indent-mode
+ (progn
+ (local-set-key (kbd "C-j") 'newline)
+ (local-set-key (kbd "RET") 'electric-newline-and-maybe-indent))
+ (local-unset-key (kbd "C-j"))
+ (local-unset-key (kbd "RET"))))
+
+ (defun oni-core--ensure-autosave-directory-exists ()
+ "Create the autosave directory if doesn't exist."
+ (mkdir oni-core--auto-save-directory t))
+
+ (defun oni-core-move-beginning-of-dwim ()
+ "Move to beginning of line either after indentation or before."
+ (interactive)
+ (let ((start (point)))
+ (back-to-indentation)
+ (unless (/= start (point))
+ (move-beginning-of-line 1))))
+
+ (defun oni-core-move-end-of-dwim ()
+ "Move to end of line, either before any comments or after."
+ (interactive)
+ (let ((start (point))
+ (eolpos (line-end-position)))
+ (beginning-of-line)
+ (if (and comment-start
+ (not (looking-at (regexp-quote comment-start)))
+ (comment-search-forward eolpos t))
+ (condition-case _
+ (progn
+ (search-backward-regexp (concat "[^ \t" comment-start "]"))
+ (forward-char)
+ (when (or (bolp)
+ (= start (point)))
+ (end-of-line)))
+ (search-failed (end-of-line)))
+ (end-of-line))))
+
+ ;;; From Bastien Guerry’s Emacs configuraiton:
+ ;;; https://github.com/bzg/dotemacs/blob/master/emacs.org
+ (defun oni-core-unfill-paragraph ()
+ "Make a multi-line paragraph into a single line of text."
+ (interactive)
+ (let ((fill-column (point-max)))
+ (fill-paragraph nil)))
+
+ (defun oni-core-recentf-save-list-silently ()
+ "Call ‘recentf-save-list’ but without showing a message about it."
+ (let ((inhibit-message t))
+ (recentf-save-list)))
+
+ (defun mutate-number-at-point (mutator)
+ (let ((bounds (bounds-of-thing-at-point 'symbol)))
+ (replace-region-contents
+ (car bounds)
+ (cdr bounds)
+ (lambda ()
+ (number-to-string
+ (funcall mutator (string-to-number
+ (buffer-substring (point-min) (point-max)))))))))
+
+ (defun increment-number-at-point ()
+ (interactive)
+ (mutate-number-at-point '1+))
+
+ (defun decrement-number-at-point ()
+ (interactive)
+ (mutate-number-at-point '1-))
+
+ (defhydra oni-sort-and-align-hydra (:color teal :hint nil)
+ "
+ ^Sort^
+ ^^--------------
+ _l_: Lines
+ _p_: Paragraph
+ _s_: String list"
+ ("l" sort-lines)
+ ("p" (save-excursion
+ (sort-lines
+ nil
+ (progn (start-of-paragraph-text) (point))
+ (progn (end-of-paragraph-text) (point)))))
+ ("s" (sort-regexp-fields
+ nil
+ (rx "\"" (one-or-more (not "\"")) "\"")
+ (rx (one-or-more (not "\"")))
+ (region-beginning)
+ (region-end))))
+
+ (defhydra oni-core-applications-hydra (:color teal :hint nil)
+ "
+ ^^^Applications^^^
+ ^^--------------------^^-----------------^^--------------
+ _m_: Email (notmuch) _r_: RSS (elfeed) _i_: IRC (circe) "
+ ("m" notmuch)
+ ("r" elfeed)
+ ("i" circe))
+
+ ;;; Get rid of the default help tooltip on the mode-line.
+ (setq mode-line-default-help-echo nil)
+
+ ;;; Remove the top/bottom/% display of the buffer position. I don't think I've
+ ;;; ever looked at it.
+ (setq mode-line-position (cdr mode-line-position))
+
+ (setq user-full-name "Tom Willemsen"
+ user-mail-address "tom@punt.com")
+
+ (setq delete-old-versions t)
+ (setq kept-new-versions 20)
+ (setq kept-old-versions 20)
+ (setq vc-make-backup-files t)
+ (setq version-control t)
+ (setq require-final-newline t)
+ (setq sentence-end-double-space nil)
+ (setq inhibit-startup-screen t)
+ (setq electric-pair-skip-whitespace 'chomp)
+ (setq fit-window-to-buffer-horizontally t)
+ ;; Discovered through
+ ;; https://github.com/novoid/dot-emacs/blob/23c28944f1991c636ea71ec7d5c3d266e6dbeb8a/config.org#deletes-duplicate-entries-of-the-history-of-the-minibuffer
+ (setq history-delete-duplicates t)
+ ;; Save what's in the clipboard into the kill-ring before killing or copying
+ ;; another string.
+ (setq save-interprogram-paste-before-kill t)
+
+ ;; Increase the threshold for garbage collection for increased performance.
+ ;; Apparently there are some (lsp-mode for example) packages that generate a lot
+ ;; of garbage.
+ (setq gc-cons-threshold 100000000)
+
+ ;;; Remove ~/.authinfo from the auth sources since it’s an unencripted file and
+ ;;; I don’t want to accidentally store anything in there.
+ (setq auth-sources
+ (cons "secrets:Login"
+ (remove "~/.netrc"
+ (remove "~/.authinfo" auth-sources))))
+
+ (setq read-mail-command 'gnus)
+
+ (setq-default indent-tabs-mode nil)
+ (setq-default tab-width 4)
+ (setq-default truncate-lines t)
+ (setq-default fill-column 80)
+
+ (add-hook 'Info-mode-hook 'mixed-pitch-mode)
+ (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
+ (add-hook 'auto-save-hook #'oni-core--ensure-autosave-directory-exists)
+ (add-hook 'before-save-hook 'time-stamp)
+ (add-hook 'electric-indent-local-mode-hook #'oni-core--switch-newline-keys)
+ (add-hook 'prog-mode-hook 'goto-address-prog-mode)
+
+ (global-set-key (kbd "C-M-SPC") 'er/expand-region)
+ (global-set-key (kbd "C-S-b") 'windmove-left)
+ (global-set-key (kbd "C-S-f") 'windmove-right)
+ (global-set-key (kbd "C-S-n") 'windmove-down)
+ (global-set-key (kbd "C-S-p") 'windmove-up)
+ (global-set-key (kbd "C-c (") '("Embrace Commander" . embrace-commander))
+ (global-set-key (kbd "C-c q") '("Unfill Paragraph" . oni-core-unfill-paragraph))
+ (global-set-key (kbd "C-c s") '("Sort and Align Commands" . oni-sort-and-align-hydra/body))
+ (global-set-key (kbd "C-c a") '("Applications" . oni-core-applications-hydra/body))
+ (global-set-key (kbd "C-c l") 'imenu)
+ (global-set-key (kbd "C-x C-b") '("List Buffers" . ibuffer-jump))
+ (global-set-key (kbd "C-x M-f") 'ffap)
+ (global-set-key (kbd "M-+") 'mc/mark-next-like-this)
+ (global-set-key [remap insert-char] 'insert-char-preview)
+ (global-set-key [remap move-beginning-of-line] #'oni-core-move-beginning-of-dwim)
+ (global-set-key [remap move-end-of-line] #'oni-core-move-end-of-dwim)
+ (global-set-key [remap upcase-word] #'upcase-dwim)
+ (global-set-key [remap downcase-word] #'downcase-dwim)
+ (global-set-key [remap capitalize-word] #'capitalize-dwim)
+ (global-set-key (kbd "C-c i +") #'increment-number-at-point)
+ (global-set-key (kbd "C-c i -") #'decrement-number-at-point)
+
+ (global-set-key (kbd "C-<left>") 'winner-undo)
+ (global-set-key (kbd "C-<right>") 'winner-redo)
+
+ (unless oni-core--recentf-idle-timer
+ (setq oni-core--recentf-idle-timer
+ (run-with-idle-timer 10 t #'oni-core-recentf-save-list-silently)))
+
+ (with-eval-after-load 'which-key (diminish 'which-key-mode))
+
+ (add-to-list 'display-buffer-alist
+ `(,(rx string-start
+ "*" (any ?h ?H) "elp")
+ display-buffer-in-side-window
+ (side . bottom)
+ (slot . 0)
+ (window-height . 0.33)))
+
+ (when (eql system-type 'windows-nt)
+ (add-to-list 'load-path (locate-user-emacs-file "vendor/p4-vc"))
+ (add-to-list 'exec-path "c:/Program Files/Git/bin")
+ (add-to-list 'exec-path "C:/Program Files/Git/usr/bin")
+ (add-to-list 'exec-path "c:/cygwin64/bin" t)
+
+ (setq delete-by-moving-to-trash t)
+
+ (setq-default buffer-file-coding-system 'utf-8-unix))
+
+ ;; Set up autoloads for all of my configuration files so that when they get
+ ;; installed they get loaded automatically, but don’t require them to be
+ ;; installed.
+
+ ;; (with-eval-after-load 'ahk-mode (require 'oni-autohotkey nil t))
+ ;; (with-eval-after-load 'alert (require 'oni-alert nil t))
+ ;; (with-eval-after-load 'bat-mode (require 'oni-bat nil t))
+ ;; (with-eval-after-load 'bats (require 'oni-bats nil t))
+ ;; (with-eval-after-load 'bookmark (require 'oni-bookmark nil t))
+ ;; (with-eval-after-load 'browse-url (require 'oni-browse-url nil t))
+ ;; (with-eval-after-load 'cc-mode (require 'oni-c nil t))
+ ;; (with-eval-after-load 'cc-mode (require 'oni-cpp nil t))
+ ;; (with-eval-after-load 'cc-mode (require 'oni-java nil t))
+ ;; (with-eval-after-load 'cider (require 'oni-clojure nil t))
+ ;; (with-eval-after-load 'circe (require 'oni-circe nil t))
+ ;; (with-eval-after-load 'clojure-mode (require 'oni-clojure nil t))
+ ;; (with-eval-after-load 'cmake-mode (require 'oni-cmake nil t))
+ ;; (with-eval-after-load 'company (require 'oni-company nil t))
+ ;; (with-eval-after-load 'compile (require 'oni-compilation nil t))
+ ;; (with-eval-after-load 'conf-mode (require 'oni-conf nil t))
+ ;; (with-eval-after-load 'counsel (require 'oni-counsel nil t))
+ ;; (with-eval-after-load 'csharp-mode (require 'oni-csharp nil t))
+ ;; (with-eval-after-load 'css-mode (require 'oni-css nil t))
+ ;; (with-eval-after-load 'diff-hl (require 'oni-diff-hl nil t))
+ ;; (with-eval-after-load 'dired (require 'oni-dired nil t))
+ ;; (with-eval-after-load 'ediff (require 'oni-ediff nil t))
+ ;; (with-eval-after-load 'elfeed (require 'oni-elfeed nil t))
+ ;; (with-eval-after-load 'elisp-mode (require 'oni-elisp nil t))
+ ;; (with-eval-after-load 'elm-mode (require 'oni-elm nil t))
+ ;; (with-eval-after-load 'embrace (require 'oni-embrace nil t))
+ ;; (with-eval-after-load 'emms (require 'oni-emms nil t))
+ ;; (with-eval-after-load 'eshell (require 'oni-eshell nil t))
+ ;; (with-eval-after-load 'fish-mode (require 'oni-fish nil t))
+ ;; (with-eval-after-load 'flycheck (require 'oni-flycheck nil t))
+ ;; (with-eval-after-load 'git-commit (require 'oni-git-commit nil t))
+ ;; (with-eval-after-load 'gnus (require 'oni-gnus nil t))
+ ;; (with-eval-after-load 'grep (require 'oni-grep nil t))
+ ;; (with-eval-after-load 'groovy-mode (require 'oni-groovy nil t))
+ ;; (with-eval-after-load 'haskell-mode (require 'oni-haskell nil t))
+ ;; (with-eval-after-load 'highlight-indent-guides (require 'oni-highlight-indent-guides nil t))
+ ;; (with-eval-after-load 'hydra (require 'oni-hydra nil t))
+ ;; (with-eval-after-load 'ielm (require 'oni-elisp nil t))
+ ;; ;; (with-eval-after-load 'ivy (require 'oni-ivy))
+ ;; (with-eval-after-load 'jabber (require 'oni-jabber nil t))
+ ;; (with-eval-after-load 'js2-mode (require 'oni-js nil t))
+ ;; (with-eval-after-load 'json-mode (require 'oni-json nil t))
+ ;; (with-eval-after-load 'lisp-mode (require 'oni-common-lisp nil t))
+ ;; (with-eval-after-load 'log-edit (require 'oni-log-edit nil t))
+ ;; (with-eval-after-load 'lsp (require 'oni-lsp nil t))
+ ;; (with-eval-after-load 'lua-mode (require 'oni-lua nil t))
+ ;; (with-eval-after-load 'lui (require 'oni-lui nil t))
+ ;; (with-eval-after-load 'magit (require 'oni-magit nil t))
+ ;; (with-eval-after-load 'make-mode (require 'oni-makefile nil t))
+ ;; (with-eval-after-load 'notmuch (require 'oni-notmuch nil t))
+ ;; (with-eval-after-load 'nov (require 'oni-epub nil t))
+ ;; (with-eval-after-load 'org (require 'oni-org nil t))
+ ;; (with-eval-after-load 'org-roam (require 'oni-org-roam nil t))
+ ;; (with-eval-after-load 'package (require 'oni-package nil t))
+ ;; (with-eval-after-load 'package-x (require 'oni-package nil t))
+ ;; (with-eval-after-load 'paredit (require 'oni-paredit nil t))
+ ;; (with-eval-after-load 'php-mode (require 'oni-php nil t))
+ ;; (with-eval-after-load 'prescient (require 'oni-prescient nil t))
+ ;; (with-eval-after-load 'projectile (require 'oni-projectile nil t))
+ ;; (with-eval-after-load 'python (require 'oni-python nil t))
+ ;; (with-eval-after-load 'ruby-mode (require 'oni-ruby nil t))
+ ;; (with-eval-after-load 'rust-mode (require 'oni-rust nil t))
+ ;; (with-eval-after-load 'scheme (require 'oni-scheme nil t))
+ ;; (with-eval-after-load 'sgml-mode (require 'oni-html nil t))
+ ;; (with-eval-after-load 'sh (require 'oni-sh nil t))
+ ;; (with-eval-after-load 'shr (require 'oni-shr nil t))
+ ;; (with-eval-after-load 'smartparens (require 'oni-smartparens nil t))
+ ;; (with-eval-after-load 'sort (require 'oni-sort nil t))
+ ;; (with-eval-after-load 'tramp (require 'oni-tramp nil t))
+ ;; (with-eval-after-load 'web-mode (require 'oni-web nil t))
+
+ (eval-when-compile
+ (require 'calendar))
+
+ (with-eval-after-load 'calendar
+ ;; I’m used to working with Monday as the starting day.
+ (setq calendar-week-start-day 1
+ calendar-date-style 'iso))
+
+ (eval-when-compile (require 'solar))
+ (with-eval-after-load 'solar
+ (setq calendar-latitude 49.2127205
+ calendar-longitude -122.9267927))
+
+ (defun oni-core-in-word-p ()
+ "Check whether the character just typed was part of a word."
+ (save-excursion
+ (backward-char)
+ (looking-back (rx word) (1- (point)))))
+
+ (defun oni-core-ace-window-select-other-window ()
+ "Use ‘ace-window’ to select which window is considered “other”."
+ (interactive)
+ (setq other-window-scroll-buffer (ace-select-window)))
+
+ (with-eval-after-load 'electric
+ (add-hook 'electric-quote-inhibit-functions #'oni-core-in-word-p))
+
+ (eval-when-compile (require 'ispell))
+ (with-eval-after-load 'ispell
+ (setq ispell-program-name "hunspell"
+ ispell-really-hunspell t))
+
+ ;; Enable any modes that I want to have turned on right away.
+
+ (electric-indent-mode -1)
+ (winner-mode)
+ (recentf-mode)
+ (which-key-mode)
+ (auto-insert-mode)
+ ;;; Remember minibuffer history across sessions.
+ (savehist-mode)
+ ;;; Remember the place I left at in files when closing them.
+ (save-place-mode)
+ ;;; Mitigate performance issues with files with _really_ long lines.
+ (global-so-long-mode)
+
+ ;;; Minibuffer
+
+ (add-hook 'minibuffer-setup-hook 'electric-pair-local-mode)
+ (add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
+
+ (setq minibuffer-prompt-properties
+ (append '(cursor-intangible t) minibuffer-prompt-properties))
+
+ (setq read-extended-command-predicate 'command-completion-default-include-p)
+ (setq read-buffer-completion-ignore-case t)
+ (setq read-file-name-completion-ignore-case t)
+ (setq completion-ignore-case t)
+
+ ;;; Vertico
+
+ (vertico-mode)
+ (vertico-prescient-mode)
+
+ (define-key vertico-map (kbd "<return>") 'vertico-directory-enter)
+ (define-key vertico-map (kbd "<backspace>") 'vertico-directory-delete-char)
+ (define-key vertico-map (kbd "M-<backspace>") 'vertico-directory-delete-word)
+
+ ;;; Marginalia
+
+ (define-key minibuffer-local-map (kbd "M-A") 'marginalia-cycle)
+
+ (marginalia-mode)
+
+ ;;; Consult
+
+ (global-set-key (kbd "C-c w d") '("Delete a window" . ace-delete-window))
+ (global-set-key (kbd "C-c w k") '("Keep a single window" . ace-delete-other-windows))
+ (global-set-key (kbd "C-c w o") '("Select other window" . oni-core-ace-window-select-other-window))
+ (global-set-key (kbd "M-g M") '("Jump to a mark anywhere" . consult-global-mark))
+ (global-set-key (kbd "M-g m") '("Jump to a mark" . consult-mark))
+ (global-set-key [remap bookmark-jump] 'consult-bookmark)
+ (global-set-key [remap goto-line] 'consult-goto-line)
+ (global-set-key [remap imenu] 'consult-imenu)
+ (global-set-key [remap project-switch-to-buffer] 'consult-project-buffer)
+ (global-set-key [remap projectile-switch-to-buffer] 'consult-project-buffer)
+ (global-set-key [remap switch-to-buffer] 'consult-buffer)
+ (global-set-key [remap yank-pop] 'consult-yank-pop)
+
+ (global-set-key (kbd "C-x 8 l") "λ")
+
+ (defun oni-core-related-files ()
+ "Return a list of files related to the current buffer."
+ (let* ((jumpers related-files-jumpers)
+ (current-place (buffer-file-name)))
+ (cond ((not jumpers)
+ (user-error "No jumpers. Consider configuring `related-files-jumpers'"))
+ ((not current-place)
+ (user-error "Related-Files only works from file-based buffers"))
+ (t
+ (related-files--collect-existing-places jumpers (list current-place))))))
+
+ (defvar oni-core-related-places-source
+ '(:name "Related File"
+ :category file
+ :items oni-core-related-files
+ :enabled buffer-file-name
+ :action find-file))
+
+ (eval-when-compile
+ (require 'consult))
+
+ (with-eval-after-load 'consult
+ (with-eval-after-load 'related-files
+ (add-to-list 'consult-buffer-sources 'oni-core-related-places-source))
+
+ (consult-customize consult-buffer consult-bookmark :preview-key nil))
+
+ (setq xref-show-definitions-function 'consult-xref)
+
+ ;;; Embark
+
+ (global-set-key (kbd "C-.") 'embark-act)
+ (global-set-key (kbd "C-;") 'embark-dwim)
+ (global-set-key [remap describe-bindings] 'embark-bindings)
+
+ (defun oni-core-fit-window-to-buffer (window)
+ (fit-window-to-buffer window)
+ (with-selected-window window
+ (enlarge-window-horizontally 1)))
+
+ (add-to-list 'display-buffer-alist
+ `(,(rx string-start " *Embark Actions*")
+ display-buffer-in-side-window
+ (window-parameter (mode-line-format . none))
+ (side . right)
+ (slot . 0)
+ (window-width . oni-core-fit-window-to-buffer)))
+
+ ;;; Extra debugging
+
+ ;;; From https://gist.github.com/jdtsmith/1fbcacfe677d74bbe510aec80ac0050c
+ (defun oni-core-reraise-error (func &rest args)
+ "Call function FUNC with ARGS and re-raise any error which occurs.
+ Useful for debugging post-command hooks and filter functions,
+ which normally have their errors suppressed."
+ (condition-case err
+ (apply func args)
+ ((debug error) (signal (car err) (cdr err)))))
+
+ (defun toggle-debug-on-hidden-errors (func)
+ "Toggle hidden error debugging for function FUNC."
+ (interactive "a")
+ (cond
+ ((advice-member-p #'oni-core-reraise-error func)
+ (advice-remove func #'oni-core-reraise-error)
+ (message "Debug on hidden errors disabled for %s" func))
+ (t
+ (advice-add func :around #'oni-core-reraise-error)
+ (message "Debug on hidden errors enabled for %s" func))))
+
+ ;;; Native Compilation
+
+ (setq native-comp-async-report-warnings-errors 'silent)
+
+ ;;; Lazy counting
+
+ (with-eval-after-load 'isearch
+ (setq isearch-lazy-count t))
+
+ ;;; Tree sitter
+
+ (when (treesit-available-p)
+ (add-to-list 'interpreter-mode-alist '("bash" . bash-ts-mode)))
+
+ (defun oni-core-copy-guix-build-hash ()
+ "Try and find the last actual hash in the compilation buffer and insert it."
+ (interactive)
+ (let* ((hash (with-current-buffer next-error-last-buffer
+ (save-excursion
+ (save-match-data
+ (goto-char (point-max))
+ (re-search-backward (rx bol (zero-or-more whitespace) "actual hash:" (one-or-more whitespace)))
+ (goto-char (match-end 0))
+ (buffer-substring-no-properties (point) (line-end-position))))))
+ (struct (let ((obj (save-excursion
+ (beginning-of-defun)
+ (read (current-buffer)))))
+ (setf (cadar (map-elt (cdar (map-elt (cdadr (cdaddr obj)) 'source)) 'sha256))
+ hash)
+ obj)))
+ (beginning-of-defun)
+ (let ((start (point)))
+ (forward-sexp)
+ (delete-region start (point))
+ (insert (pp struct))
+ (indent-region start (point))
+ (skip-syntax-forward "> ")
+ (ensure-empty-lines))))
+
+ (defun oni-core--without-dangerous-directories (directory)
+ "Call ‘directory-files' on DIRECTORY, but remove certain directories."
+ (cl-delete-if
+ (lambda (d) (string-match-p (rx "/" (or "." ".." "foreign" ".git") eos) d))
+ (directory-files directory t)))
+
+ (if (boundp 'safe-local-variable-directories)
+ (setq safe-local-variable-directories
+ (apply 'append (mapcar
+ (lambda (d)
+ (oni-core--without-dangerous-directories d))
+ (oni-core--without-dangerous-directories "~/code/")))))
+
+ ;;; Space cycling
+
+ ;; The ‘-’ argument to each function makes sure that any newlines are also
+ ;; removed along with the other whitespace.
+ (setq cycle-spacing-actions '((just-one-space -) (delete-all-space -) restore))
+
+ ;;; Colorize the unique part of buffers
+
+ (defun oni-core-colored-post-forward-angle-brackets (base extra-strings)
+ "Return BASE<EXTRA-STRINGS> with the second part colorized.
+ This does the same thing as setting ‘uniquify-buffer-name-style' to
+ ‘post-forward-angle-brackets', except that it colorizes the unique part
+ of the buffer name."
+ (concat base
+ (propertize (concat "<" (mapconcat #'identity extra-strings "/") ">")
+ 'face '(:foreground "#72f1f1"))))
+
+ (setq uniquify-buffer-name-style 'oni-core-colored-post-forward-angle-brackets)
+
+ ;;; Make switching buffers obey ‘display-buffer-alist’
+
+ (setq switch-to-buffer-obey-display-actions t)
+#+end_src
+
+* Rainbow Delimiters
+
+#+begin_src emacs-lisp
+ (use-package rainbow-delimiters)
+#+end_src
+
+* Mixed Pitch Mode
+
+#+begin_src emacs-lisp
+ (use-package mixed-pitch)
+#+end_src
+
+* Fennel
+
+#+begin_src emacs-lisp
+ (use-package fennel-mode)
+#+end_src
+
+* Custom
+
+Change the file where =customize= stores its settings.
+
+#+begin_src emacs-lisp
+ (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
+ (load custom-file)
+#+end_src
+
+* Orderless
+
+#+begin_src emacs-lisp
+ (use-package orderless
+ :init
+ (setq completion-styles '(basic partial-completion orderless))
+ :config
+ (add-to-list 'orderless-matching-styles 'orderless-initialism))
+#+end_src
diff --git a/emacs/.emacs.d/oni-compilation.el b/emacs/.emacs.d/oni-compilation.el
new file mode 100644
index 0000000..54e20f0
--- /dev/null
+++ b/emacs/.emacs.d/oni-compilation.el
@@ -0,0 +1,53 @@
+;; Start of oni-stillness
+
+(use-package compile
+ :config
+ (require 'subr-x)
+ (require 'xterm-color)
+
+ (defun oni-compilation--maybe-dont-show-window (buffer-or-name alist plist)
+ "Don't show BUFFER-OR-NAME unless it absolutely must.
+
+ALIST and PLIST contain extra information about the buffer."
+ (if (alist-get 'allow-no-window alist)
+ buffer-or-name
+ (funcall (plist-get plist :fallback) buffer-or-name alist
+ (plist-put (copy-sequence plist) :custom nil))))
+
+ (defun oni-compilation--maybe-display-compilation-window (buffer status)
+ "Display BUFFER if STATUS is not finished."
+ (unless (string= (string-trim status) "finished")
+ (display-buffer buffer)))
+
+ (defun oni-compilation--compilation-finish-notify-function (buffer status)
+ "Show an alert of the status of the compliation.
+
+BUFFER is the `compilation-mode' buffer and STATUS is the exit
+status of the process."
+ (when (string-match-p (rx "*compilation*" "*Chanced Tests*") (buffer-name buffer))
+ (if (string= (string-trim status) "finished")
+ (alert "Compilation finished succesfully")
+ (alert "Compilation finished with an error"))))
+
+ (defun oni-compilation--filter-xterm-colors (func proc string)
+ "Call FUNC with PROC and STRING filtered through ‘xterm-color-filter’."
+ (funcall func proc (xterm-color-filter string)))
+
+ (setq compilation-scroll-output t)
+ (setq compilation-environment '("TERM=xterm-256color"))
+
+ (add-to-list 'display-buffer-alist
+ '("\\`\\*compilation\\*\\'" display-buffer-in-side-window
+ (side . bottom)
+ (slot . 0)
+ (window-height . 0.33)))
+
+ (add-hook 'compilation-finish-functions
+ #'oni-compilation--maybe-display-compilation-window)
+
+ (add-hook 'compilation-finish-functions
+ #'oni-compilation--compilation-finish-notify-function)
+
+ (advice-add 'compilation-filter :around #'oni-compilation--filter-xterm-colors))
+
+;; End of oni-stillness
diff --git a/emacs/.emacs.d/oni-corfu.el b/emacs/.emacs.d/oni-corfu.el
new file mode 100644
index 0000000..7d6859f
--- /dev/null
+++ b/emacs/.emacs.d/oni-corfu.el
@@ -0,0 +1,17 @@
+;; Start of oni-corfu
+
+(use-package corfu
+ :config
+ (setq corfu-auto t)
+
+ (add-hook 'corfu-mode-hook 'corfu-prescient-mode)
+
+ (add-to-list 'completion-at-point-functions 'cape-abbrev)
+ (add-to-list 'completion-at-point-functions 'cape-dabbrev)
+ (add-to-list 'completion-at-point-functions 'cape-file))
+
+(use-package cape)
+
+(use-package corfu-prescient)
+
+;; End of oni-corfu
diff --git a/emacs/.emacs.d/oni-dashboard.el b/emacs/.emacs.d/oni-dashboard.el
new file mode 100644
index 0000000..6cc797e
--- /dev/null
+++ b/emacs/.emacs.d/oni-dashboard.el
@@ -0,0 +1,57 @@
+;; Start of oni-dashboard
+
+(use-package dashboard
+ :init
+ (setq dashboard-navigator-buttons
+ `((("💬";; ,(propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0)))
+ "Conversations" "Open pull requests"
+ (lambda (&rest _)
+ (browse-url "https://github.com/pulls?q=commenter%3Atomw-punt+review%3Achanges_requested+is%3Aopen"))
+ default "[" "]")
+ ("⛙";; ,(propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0)))
+ "PRs" "Open pull requests"
+ (lambda (&rest _)
+ (browse-url "https://github.com/pulls?q=is%3Aopen+is%3Apr+org%3Ajuked-social+draft%3Afalse+review%3Anone+-author%3Aapp%2Fdependabot+-base%3Adev+-base%3Amain+-base%3Achanced_dev"))
+ default "[" "]"))
+ (("⛙" ;; ,(propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0)))
+ "back-end" "Unmerged into back-end"
+ (lambda (&rest _)
+ (browse-url "https://github.com/juked-social/social-api/compare/main...staging"))
+ default "[" "]")
+ ("⛙" ;; ,(propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0)))
+ "chanced" "Unmerged into chanced front-end"
+ (lambda (&rest _)
+ (browse-url "https://github.com/juked-social/chanced-frontend/compare/main...staging"))
+ default "[" "]")
+ ("⛙" ;; ,(propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0)))
+ "punt" "Unmerged into punt front-end"
+ (lambda (&rest _)
+ (browse-url "https://github.com/juked-social/punt-frontend/compare/main...staging"))
+ default "[" "]"))))
+ (dashboard-setup-startup-hook)
+ (run-with-idle-timer 300 t (lambda ()
+ (display-buffer dashboard-buffer-name '(display-buffer-full-frame))))
+ (run-at-time "02:00" 86400 #'dashboard-open)
+ (setq dashboard-set-navigator t)
+ :config
+ (setq dashboard-startup-banner "~/code/personal/dotfiles/oni/home/services/emacs/pop-os-logo.svg")
+ (setq dashboard-set-footer nil)
+ (setq dashboard-projects-show-base t)
+ (setq dashboard-recentf-show-base t)
+ (setq dashboard-startupify-list
+ '(dashboard-insert-banner
+ dashboard-insert-newline
+ dashboard-insert-banner-title
+ dashboard-insert-newline
+ dashboard-insert-init-info
+ dashboard-insert-newline
+ dashboard-insert-navigator
+ dashboard-insert-items
+ dashboard-insert-newline
+ dashboard-insert-footer))
+
+ (add-hook 'server-after-make-frame-hook #'dashboard-open)
+ ;; (add-hook 'dashboard-mode-hook 'olivetti-mode)
+ (add-hook 'dashboard-after-initialize-hook (lambda () (setq truncate-lines t))))
+
+;; End of oni-dashboard
diff --git a/emacs/.emacs.d/oni-dumb-jump.el b/emacs/.emacs.d/oni-dumb-jump.el
new file mode 100644
index 0000000..ad195e5
--- /dev/null
+++ b/emacs/.emacs.d/oni-dumb-jump.el
@@ -0,0 +1,15 @@
+;; Start of oni-dumb-jump
+
+(use-package dumb-jump
+ :ensure-system-package (rg . ripgrep)
+ :init
+ (add-hook 'xref-backend-functions 'dumb-jump-xref-activate)
+ :config
+ (setq dumb-jump-prefer-searcher 'rg)
+ (setq dumb-jump-find-rules
+ (seq-remove (lambda (rule) (and (string= "php" (map-elt rule :language))
+ (string= "type" (map-elt rule :type))
+ (string-prefix-p "\\buse" (map-elt rule :regex))))
+ dumb-jump-find-rules)))
+
+;; End of oni-dumb-jump
diff --git a/emacs/.emacs.d/oni-flycheck.el b/emacs/.emacs.d/oni-flycheck.el
new file mode 100644
index 0000000..6ee6a19
--- /dev/null
+++ b/emacs/.emacs.d/oni-flycheck.el
@@ -0,0 +1,28 @@
+;; Start of oni-flycheck
+
+(use-package flycheck
+ :config
+ (require 'flycheck-posframe)
+
+ (mapc (lambda (c) (delq c flycheck-checkers))
+ '(python-pylint python-pyflakes))
+
+ (setq flycheck-highlighting-mode 'columns)
+
+ (when (not (eql system-type 'windows-nt))
+ (setq flycheck-mode-line-prefix "✓"))
+
+ (setq flycheck-emacs-args
+ (append '("--eval" "(package-initialize)")
+ flycheck-emacs-args))
+
+ (flycheck-posframe-configure-pretty-defaults)
+
+ (add-hook 'flycheck-mode-hook 'flycheck-cask-setup)
+ (add-hook 'flycheck-mode-hook 'flycheck-posframe-mode))
+
+(use-package flycheck-posframe)
+(use-package flycheck-cask)
+(use-package flycheck-phpstan)
+
+;; End of oni-flycheck
diff --git a/emacs/.emacs.d/oni-grep.el b/emacs/.emacs.d/oni-grep.el
new file mode 100644
index 0000000..8f92232
--- /dev/null
+++ b/emacs/.emacs.d/oni-grep.el
@@ -0,0 +1,29 @@
+;; Start of oni-grep
+
+(use-package grep
+ :config
+ (require 'find-dired)
+
+ (add-to-list 'grep-files-aliases '("msbuild" . "*.targets *.proj"))
+
+ (when (eq system-type 'windows-nt)
+ (setq find-program (shell-quote-argument "c:/cygwin64/bin/find.exe"))
+ (setq grep-program (shell-quote-argument "c:/cygwin64/bin/grep.exe"))
+ (setq grep-use-null-device nil)
+
+ (let ((exe (shell-quote-argument "c:/cygwin64/bin/ls.exe")))
+ (setq find-ls-option
+ (cons (concat "-exec " exe " -ld {} \";\"") "-ld"))))
+
+ (setf (map-elt display-buffer-alist (rx bos "*grep*" eos))
+ '(display-buffer-in-side-window
+ (side . bottom)
+ (slot . 0)
+ (window-height . 0.33)))
+
+ (add-to-list 'grep-find-ignored-directories ".cask")
+
+ (add-hook 'grep-mode-hook 'hl-line-mode))
+
+
+;; End of oni-grep
diff --git a/emacs/.emacs.d/oni-gui.el b/emacs/.emacs.d/oni-gui.el
new file mode 100644
index 0000000..e229fb9
--- /dev/null
+++ b/emacs/.emacs.d/oni-gui.el
@@ -0,0 +1,92 @@
+;; Start of oni-gui
+
+(defun oni-gui-setup-faces (frame)
+ "Setup faces for FRAME."
+ (set-face-attribute 'fixed-pitch frame :font "Fantasque Sans Mono-15")
+ (set-face-attribute 'variable-pitch frame :font "Dosis-16"))
+
+(defun oni-gui-setup-fontsets (frame)
+ "Setup fontsets for FRAME.
+If FRAME is nil, they’re set for the current frame."
+ (let ((font-awesome "Font Awesome 5 Free Solid-12"))
+ (set-fontset-font t #xf026 font-awesome frame)
+ (set-fontset-font t #xf027 font-awesome frame)
+ (set-fontset-font t #xf028 font-awesome frame)
+ (set-fontset-font t #xf240 font-awesome frame)
+ (set-fontset-font t #xf241 font-awesome frame)
+ (set-fontset-font t #xf242 font-awesome frame)
+ (set-fontset-font t #xf243 font-awesome frame)
+ (set-fontset-font t #xf244 font-awesome frame)
+ (set-fontset-font t #xf2c9 font-awesome frame)
+ (set-fontset-font t #xf6a9 font-awesome frame)
+ (set-fontset-font t #xf769 font-awesome frame)
+ (set-fontset-font t #xf76b font-awesome frame))
+ (let ((font-awesome "Font Awesome 5 Free Regular-12"))
+ (set-fontset-font t #xf0c8 font-awesome frame)
+ (set-fontset-font t #xf14a font-awesome frame))
+ (let ((dejavu-sans-mono "DejaVu Sans Mono-12"))
+ (set-fontset-font t #x25c9 dejavu-sans-mono frame)
+ (set-fontset-font t #x25cb dejavu-sans-mono frame)
+ (set-fontset-font t #x2738 dejavu-sans-mono frame)
+ (set-fontset-font t #x273f dejavu-sans-mono frame)
+ (set-fontset-font t #x2713 dejavu-sans-mono frame)))
+
+;; Thanks to the article at
+;; https://andreyorst.gitlab.io/posts/2020-07-21-programming-ligatures-in-emacs/
+(defun oni-gui-setup-ligatures (&optional _)
+ "Define ligatures supported by Fantasque Sans Mono."
+ (let ((ligatures
+ `((?= . ,(regexp-opt '("==" "===" "=/=" "=>" "==>" "=>>" "=<<")))
+ (?! . ,(regexp-opt '("!=" "!==")))
+ (?< . ,(regexp-opt '("<-<" "<<-" "<--" "<-" "<->" "<=<" "<<=" "<=="
+ "<=>" "<~>" "<~~" "<~" "<<<" "<<" "<=" "<>"
+ "<|||" "<||" "<|" "<|>" "<!--")))
+ (?- . ,(regexp-opt '("->" "-->" "->>" "-<" "-<<")))
+ (?> . ,(regexp-opt '(">->" ">=>" ">>=" ">>-" ">-" ">=" ">>" ">>>")))
+ (?~ . ,(regexp-opt '("~~" "~>" "~~>")))
+ (?| . ,(regexp-opt '("|>" "||>" "|||>" "||")))
+ (?: . ,(regexp-opt '("::")))
+ (?& . ,(regexp-opt '("&&")))
+ (?/ . ,(regexp-opt '("//" "/*")))
+ (?* . ,(regexp-opt '("*/" "**/"))))))
+ (dolist (char-regexp ligatures)
+ (set-char-table-range composition-function-table (car char-regexp)
+ `([,(cdr char-regexp) 0 font-shape-gstring])))))
+
+(use-package emacs
+ :ensure-system-package (("/opt/homebrew/Caskroom/font-fantasque-sans-mono" . font-fantasque-sans-mono)
+ ("/opt/homebrew/Caskroom/font-dosis" . font-dosis))
+ :config
+ (setf (map-elt default-frame-alist 'font) "Fantasque Sans Mono-15")
+ (setf (map-elt default-frame-alist 'internal-border-width) 15)
+ (setq-default cursor-type '(bar . 2))
+ (setq-default cursor-in-non-selected-windows 'box)
+ (setq frame-resize-pixelwise t)
+
+ (scroll-bar-mode -1)
+
+ (unless (eq system-type 'windows-nt)
+ (if (daemonp)
+ (progn
+ (add-hook 'after-make-frame-functions #'oni-gui-setup-ligatures)
+ (add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets)
+ (add-hook 'after-make-frame-functions #'oni-gui-setup-faces))
+ (oni-gui-setup-fontsets nil)
+ (oni-gui-setup-faces nil)
+ (oni-gui-setup-ligatures)))
+
+ (global-unset-key (kbd "C-z"))
+ (global-set-key (kbd "C-c c") '("Frequently used commands" . oni-gui-hydra/body))
+
+ (when (fboundp 'pixel-scroll-precision-mode)
+ (pixel-scroll-precision-mode)))
+
+(use-package yoshi-theme
+ :vc (:url "https://git.sr.ht/~ryuslash/yoshi-theme"
+ :rev :newest)
+ :init
+ (load-theme 'yoshi :no-confirm)
+ :config
+ (require 'yoshi-mode-line))
+
+;; End of oni-gui
diff --git a/emacs/.emacs.d/oni-hl-todo.el b/emacs/.emacs.d/oni-hl-todo.el
new file mode 100644
index 0000000..b7ee52f
--- /dev/null
+++ b/emacs/.emacs.d/oni-hl-todo.el
@@ -0,0 +1,8 @@
+;; Start of oni-hl-todo
+
+(use-package hl-todo
+ :init (global-hl-todo-mode))
+
+(use-package consult-todo)
+
+;; End of oni-hl-todo
diff --git a/emacs/.emacs.d/oni-outline.el b/emacs/.emacs.d/oni-outline.el
new file mode 100644
index 0000000..8cf5c21
--- /dev/null
+++ b/emacs/.emacs.d/oni-outline.el
@@ -0,0 +1,8 @@
+(use-package outline
+ :config
+ (define-key outline-minor-mode-map
+ (kbd "TAB")
+ '(menu-item "" nil
+ :filter (lambda (&optional _)
+ (when (outline-on-heading-p)
+ 'outline-cycle)))))
diff --git a/emacs/.emacs.d/oni-php.el b/emacs/.emacs.d/oni-php.el
new file mode 100644
index 0000000..eb1f6ba
--- /dev/null
+++ b/emacs/.emacs.d/oni-php.el
@@ -0,0 +1,331 @@
+;; Start of oni-php
+
+(use-package php-mode
+ :config
+ (require 'align)
+ (require 'hydra)
+ (require 'map)
+ (require 'project)
+ (require 'whitespace)
+ (require 'grep)
+
+ (defconst oni-php-root
+ (file-name-directory
+ (or load-file-name
+ (buffer-file-name)))
+ "The directory where ‘oni-php’ was loaded from.")
+
+ (defconst oni-php-snippets-dir
+ (expand-file-name "snippets" oni-php-root)
+ "The directory where ‘oni-php’ stores its snippets.")
+
+ (defconst oni-php-scripts-dir
+ (expand-file-name "scripts" oni-php-root)
+ "The directory where ‘oni-php’ stores its scripts.")
+
+ (defun oni-php--set-require-final-newline ()
+ "Set `require-final-newline' to t.
+This is necessary because the PHP mode configuration sets this to
+nil for some reason."
+ (setq require-final-newline t))
+
+ (defun oni-php--whitespace-mode ()
+ "Enable whitespace mode with only tabs showing."
+ (setq-local whitespace-style '(face tabs))
+ (whitespace-mode))
+
+ (defun oni-php--auto-fill-mode ()
+ "Enable ‘auto-fill-mode’ only for comments."
+ (setq-local comment-auto-fill-only-comments t)
+ (auto-fill-mode))
+
+ (defun oni-php-set-rainbow-identifier-faces ()
+ "Set the faces to override for ‘rainbow-identifiers-mode’."
+ (setq-local rainbow-identifiers-faces-to-override
+ '(font-lock-type-face php-property-name php-function-call-traditional
+ php-doc-variable-sigil php-method-call-traditional
+ php-variable-sigil php-variable-name)))
+
+ (defun oni-php-add-use (class)
+ "Try to add a use statement for CLASS under point."
+ (interactive (list (thing-at-point 'symbol)))
+ (let* ((default-directory (project-root (project-current)))
+ (classes (string-split (string-trim-right (shell-command-to-string (concat (expand-file-name "find-php-class" oni-php-scripts-dir) " " class))) "\n"))
+ (class (cond
+ ((null classes)
+ (user-error "Class ‘%s’ not found" class))
+ ((> (length classes) 1)
+ (completing-read "Use: " classes nil t))
+ (t (car classes)))))
+ (save-excursion
+ (goto-char (point-min))
+
+ (if (search-forward "use " nil t)
+ (forward-paragraph)
+ (search-forward "namespace ")
+ (forward-line)
+ (insert "\n"))
+
+ (unless (re-search-backward (rx "use " (literal class) ";") nil t)
+ (let ((start (point)))
+ (insert "use " class ";\n")
+ (pulse-momentary-highlight-region start (point)))))))
+
+ (defun oni-php--syntax-in-string-p (syntax)
+ "Does SYNTAX indicate point is inside a string?"
+ (nth 3 syntax))
+
+ (defun oni-php--syntax-in-comment-p (syntax)
+ "Does SYNTAX indicate point is inside a comment?"
+ (nth 4 syntax))
+
+ (defun oni-php--in-string-or-comment-p ()
+ "Return whether or not point is within a string or comment."
+ (let ((syntax (syntax-ppss)))
+ (or (oni-php--syntax-in-string-p syntax)
+ (oni-php--syntax-in-comment-p syntax))))
+
+ (defun oni-php-insert-dot-dwim (N)
+ "Insert either a concatenation or access operator depending on context.
+
+Do the insert N times."
+ (interactive "p")
+ (if (or (oni-php--in-string-or-comment-p)
+ (save-excursion
+ (skip-syntax-backward " ")
+ (nth 3 (syntax-ppss (1- (point)))))
+ (save-excursion
+ (skip-syntax-forward " ")
+ (nth 3 (syntax-ppss (1+ (point))))))
+ (self-insert-command N)
+ (let ((op (if (looking-back (rx (or "$" ")") (zero-or-more (any whitespace "\n" alnum "(" ")" "->")))
+ (save-excursion (backward-paragraph) (point)))
+ "->"
+ "::")))
+ (dotimes (_ N) (insert op)))))
+
+ (defun oni-php-doc-comment ()
+ "Insert a PHP documentation comment at point."
+ (interactive)
+ (let ((start (point)))
+ (insert "/**\n * ")
+ (let ((insert-marker (point-marker)))
+ (insert "\n */")
+ (indent-region start (point))
+ (goto-char insert-marker))))
+
+ (defun oni-php-doc-use-comment ()
+ "Insert a PHP documentation comment for a use statement."
+ (interactive)
+ (let ((start (point))
+ (class (save-excursion
+ (save-match-data
+ (search-forward-regexp (rx "use " (group (minimal-match (zero-or-more alnum))) ";"))
+ (match-string 1)))))
+ (insert "/**\n * @use " class)
+ (let ((insert-marker (point-marker)))
+ (insert "\n */")
+ (indent-region start (point))
+ (goto-char insert-marker))))
+
+ (defun oni-php-return-belongs-to-comment ()
+ "Insert a PHP documentation comment for a BelongsTo return type."
+ (interactive)
+ (let ((start (point)))
+ (insert "/**\n * @return BelongsTo<")
+ (save-excursion
+ (insert ", $this>\n */")
+ (indent-region start (point)))))
+
+ (defun oni-php-comment-dwim (func &rest args)
+ "See if a PHP documentation comment should be added and add it.
+Otherwise call FUNC with ARGS. This is meant as advice around
+‘comment-dwim’ to make it smarter for PHP code."
+ (cond ((looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
+ "use "))
+ (oni-php-doc-use-comment))
+ ((looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
+ (one-or-more nonl) ": BelongsTo" eol))
+ (oni-php-return-belongs-to-comment))
+ ((and (derived-mode-p 'php-mode)
+ (not (region-active-p))
+ (looking-back (rx (minimal-match (zero-or-more blank))) (line-beginning-position))
+ (looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
+ (or (regexp php-beginning-of-defun-regexp)
+ (regexp php--re-classlike-pattern)))))
+ (oni-php-doc-comment))
+ (t (apply func args))))
+
+ (defun oni-php-generate-namespace ()
+ (string-join
+ (mapcar
+ (lambda (s)
+ (let ((case-fold-search nil))
+ (if (string-match-p (rx upper-case) s)
+ s
+ (capitalize s))))
+ (cdr (split-string
+ (directory-file-name
+ (file-name-directory
+ (file-relative-name
+ buffer-file-name
+ (project-root (project-current)))))
+ "/")))
+ "\\"))
+
+ (defun oni-php-set-dabbrev-settings ()
+ "Set any settings for dabbrev that make sense for PHP code."
+ (setq-local dabbrev-abbrev-skip-leading-regexp (rx "$")))
+
+ (defun oni-php-ignore-error-at-point (error-type)
+ (interactive
+ (list (let* ((error-types
+ (seq-uniq
+ (mapcar (lambda (e)
+ (let ((str (flycheck-error-message e)))
+ (string-match (rx "🪪" (one-or-more whitespace) (group (one-or-more (any alnum ".")))) str)
+ (match-string 1 str)))
+ (seq-filter (lambda (e) (not (flycheck-error-checker e)))
+ (flycheck-overlay-errors-at (point))))
+ 'string=)))
+ (if (> 1 (length error-types))
+ (completing-read "Ignore type: " error-types)
+ (car error-types)))))
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (indent-for-tab-command)
+ (insert "/** @phpstan-ignore " error-type " */\n")
+ (indent-for-tab-command)))
+
+ (defhydra php-mode-hydra (:color blue)
+ ("a" align-current "Align current selection"))
+
+ (advice-add 'comment-dwim :around #'oni-php-comment-dwim)
+
+ (add-hook 'php-mode-hook #'oni-php--set-require-final-newline)
+ (add-hook 'php-mode-hook #'oni-php--whitespace-mode)
+ (add-hook 'php-mode-hook 'display-fill-column-indicator-mode)
+ (add-hook 'php-mode-hook 'electric-indent-local-mode)
+ (add-hook 'php-mode-hook 'flycheck-mode)
+ (add-hook 'php-mode-hook 'oni-php--auto-fill-mode)
+ (add-hook 'php-mode-hook 'oni-php-set-dabbrev-settings)
+ (add-hook 'php-mode-hook 'oni-php-set-rainbow-identifier-faces)
+ (add-hook 'php-mode-hook 'rainbow-delimiters-mode)
+ (add-hook 'php-mode-hook 'rainbow-identifiers-mode)
+ (add-hook 'php-mode-hook 'smartparens-mode)
+ (add-hook 'php-mode-hook 'subword-mode)
+ (add-hook 'php-mode-hook 'yas-minor-mode)
+ (add-hook 'php-mode-hook 'corfu-mode)
+
+ (define-key php-mode-map (kbd "C-c m") #'php-mode-hydra/body)
+ (define-key php-mode-map (kbd ".") #'oni-php-insert-dot-dwim)
+
+ ;; In PHP code it's nice to have any ~=>~ aligned.
+
+ ;; <?php
+ ;; array(
+ ;; 'foo' => 'bar',
+ ;; 'frob' => 'baz'
+ ;; );
+ ;; ?>
+
+ (add-to-list 'align-rules-list
+ `(php-array-arrow
+ (regexp . ,(rx any (group (zero-or-more whitespace)) "=>" any))
+ (group . (1))
+ (modes . '(php-mode web-mode php-mode))
+ (repeat . t)))
+
+ ;; The WordPress coding standards specify that multiple assignments
+ ;; should have their assignment operators aligned.
+
+ ;; <?php
+ ;; $variable = "value";
+ ;; $other_variable = "other value";
+ ;; $one_more_variable = "one more variable";
+
+ (add-to-list 'align-rules-list
+ `(php-assignment-equals
+ (regexp . ,(rx any (group (zero-or-more whitespace)) "="
+ (zero-or-more whitespace) any))
+ (group . (1))
+ (modes . '(php-mode web-mode php-ts-mode))
+ (repeat . t)))
+
+;;;###autoload
+ (add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode))
+
+;;;###autoload
+ (add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode))
+
+;;;###autoload
+ (with-eval-after-load 'grep
+ (add-to-list 'grep-files-aliases '("php" . "*.php *.inc *.module")))
+
+ (with-eval-after-load 'autoinsert
+ (setf (map-elt auto-insert-alist (rx ".php" eos))
+ '(nil
+ "<?php\n"
+ "\n"
+ "declare(strict_types=1);\n"
+ "\n"
+ "namespace " (oni-php-generate-namespace) ";\n"
+ "\n"
+ "class " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) "\n"
+ "{\n"
+ > _ "\n"
+ "}\n")
+ (map-elt auto-insert-alist (rx "Test.php" eos))
+ '(nil
+ "<?php\n"
+ "\n"
+ "declare(strict_types=1);\n"
+ "\n"
+ "namespace " (oni-php-generate-namespace) ";\n"
+ "\n"
+ "use Illuminate\\Foundation\\Testing\\RefreshDatabase;\n"
+ "use Illuminate\\Foundation\\Testing\\WithFaker;\n"
+ "use Tests\\TestCase;\n"
+ "\n"
+ "class " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) " extends TestCase\n"
+ "{\n"
+ > "use RefreshDatabase;\n"
+ > "use WithFaker;\n"
+ "\n"
+ > "/** @test */\n"
+ > "public function " (replace-regexp-in-string (rx whitespace) "_" (downcase (skeleton-read "Test function name: "))) "(): void\n"
+ "{" > "\n"
+ > _ "\n"
+ "}" > "\n"
+ "}")))
+
+ (defun oni-php-in-expression-context-p ()
+ (not (oni-php-in-static-call-context-p)))
+
+ (defun oni-php-in-test-file ()
+ (string-suffix-p "Test.php" buffer-file-name))
+
+ (defun oni-php-in-static-call-context-p ()
+ (looking-back "::\\w+" (- (point) (line-beginning-position))))
+
+ (defun oni-php-grep-symbol (symbol)
+ "Use ‘rgrep’ to find SYMBOL.
+If there is an active region when this command is called interactively
+SYMBOL will be the text in the region. Otherwise it's the symbol at
+point."
+ (interactive (list
+ (if (region-active-p)
+ (buffer-substring-no-properties (region-beginning) (region-end))
+ (thing-at-point 'symbol))))
+ (rgrep (rx (literal symbol))
+ (map-elt grep-files-aliases "php")
+ (project-root (project-current))))
+
+ (define-key php-mode-map (kbd "C-c .") nil t)
+ (define-key php-mode-map (kbd "C-c . g") '("Search for symbol at point" . oni-php-grep-symbol))
+ (define-key php-mode-map (kbd "C-c . a") '("Import symbol at point" . oni-php-add-use))
+ (define-key php-mode-map (kbd "C-c . i") '("Ignore error at point" . oni-php-ignore-error-at-point)))
+
+(use-package rainbow-identifiers)
+
+;; End of oni-php
diff --git a/emacs/.emacs.d/oni-prescient.el b/emacs/.emacs.d/oni-prescient.el
new file mode 100644
index 0000000..9687b68
--- /dev/null
+++ b/emacs/.emacs.d/oni-prescient.el
@@ -0,0 +1,11 @@
+;; Start of oni-prescient
+
+(use-package prescient
+ :config
+ (setq prescient-save-file (expand-file-name "data/prescient-save.el" user-emacs-directory))
+
+ (run-with-idle-timer 10 t 'prescient--save)
+
+ (prescient-persist-mode))
+
+;; End of oni-prescient
diff --git a/emacs/.emacs.d/oni-smartparens.el b/emacs/.emacs.d/oni-smartparens.el
new file mode 100644
index 0000000..83aae3e
--- /dev/null
+++ b/emacs/.emacs.d/oni-smartparens.el
@@ -0,0 +1,12 @@
+;; Start of oni-smartparens
+
+(use-package smartparens
+ :config
+ (require 'smartparens-config)
+
+ (define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-barf-sexp)
+ (define-key smartparens-mode-map (kbd "C-<right>") 'sp-slurp-hybrid-sexp)
+ (define-key smartparens-mode-map (kbd "C-M-<right>") 'sp-backward-barf-sexp)
+ (define-key smartparens-mode-map (kbd "M-<up>") 'sp-splice-sexp-killing-backward))
+
+;; End of oni-smartparens
diff --git a/emacs/.emacs.d/oni-stillness.el b/emacs/.emacs.d/oni-stillness.el
new file mode 100644
index 0000000..b7b5567
--- /dev/null
+++ b/emacs/.emacs.d/oni-stillness.el
@@ -0,0 +1,6 @@
+;; Start of oni-stillness
+
+(use-package stillness-mode
+ :init (stillness-mode))
+
+;; End of oni-stillness
diff --git a/emacs/.emacs.d/oni-xterm-color.el b/emacs/.emacs.d/oni-xterm-color.el
new file mode 100644
index 0000000..5ab78d6
--- /dev/null
+++ b/emacs/.emacs.d/oni-xterm-color.el
@@ -0,0 +1,5 @@
+;; Start of oni-xterm-color
+
+(use-package xterm-color)
+
+;; End of oni-xterm-color
diff --git a/emacs/.emacs.d/oni-yasnippet.el b/emacs/.emacs.d/oni-yasnippet.el
new file mode 100644
index 0000000..06e6d18
--- /dev/null
+++ b/emacs/.emacs.d/oni-yasnippet.el
@@ -0,0 +1,34 @@
+;; Start of oni-yasnippet
+
+(use-package yasnippet
+ :init
+ (yas-global-mode)
+ :config
+ (require 'diminish)
+
+ (defun oni-yasnippet-remove-snippet-by-name (name mode)
+ "Remove the snippet NAME from MODE's snippet tables."
+ (and-let* ((mode-table (gethash mode yas--tables))
+ (uuidhash-table (yas--table-uuidhash mode-table))
+ (hash-table (yas--table-hash mode-table))
+ (snippet (gethash name uuidhash-table))
+ (key (yas--template-key snippet)))
+ (remhash key hash-table)
+ (remhash name uuidhash-table)))
+
+ (defun oni-yasnippet-cleanup-snippets ()
+ "Remove some snippets that I don't like."
+ (oni-yasnippet-remove-snippet-by-name "defun" 'lisp-interaction-mode))
+
+ (with-eval-after-load 'yasnippet (diminish 'yas-minor-mode))
+
+ (setq-default yas-buffer-local-condition yas-not-string-or-comment-condition)
+
+ (define-key yas-minor-mode-map (kbd "<tab>") nil)
+ (define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand)
+ (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
+ (define-key yas-minor-mode-map (kbd "TAB") nil)
+
+ (add-hook 'yas-after-reload-hook #'oni-yasnippet-cleanup-snippets))
+
+;; End of oni-yasnippet
diff --git a/emacs/.emacs.d/scripts/find-php-class b/emacs/.emacs.d/scripts/find-php-class
new file mode 100755
index 0000000..4268dcf
--- /dev/null
+++ b/emacs/.emacs.d/scripts/find-php-class
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# ;; #!/usr/bin/env -S scsh -e main -o srfi-1 -s
+# ;; !#
+
+# ;; (define (main args)
+# ;; (let* ((class-name (cadr args))
+# ;; (file-names
+# ;; (run/strings (find "."
+# ;; -path "./cdk.out" -prune -o
+# ;; -type f
+# ;; -name ,(string-append class-name ".php")
+# ;; -exec grep "^namespace" "{}" ";")
+# ;; (> 2 "/dev/null"))))
+# ;; (format #t "~s"
+# ;; (delete-duplicates
+# ;; (map (lambda (n)
+# ;; (string-append
+# ;; (match:substring
+# ;; (regexp-search (rx "namespace " (submatch (+ any)) ";") n)
+# ;; 1)
+# ;; "\\"
+# ;; class-name))
+# ;; file-names)))))
+
+main() {
+ local classname=$1
+
+ find . \( \
+ -path "./cdk.out" \
+ -o -path "./punt/tmp" \
+ -o -path "./punt/vendor" \
+ -o -path "./filament/storage/larastan/cache" \
+ -o -path "./filament/vendor" \
+ -o -path "./chanced/tmp" \
+ -o -path "./chanced/node_modules" \
+ -o -path "./chanced/.phpunit.cache" \
+ -o -path "./.git" \
+ -o -path "./chanced/storage" \
+ \) -prune \
+ -o -type f -name "${classname}.php" \
+ -exec grep '^namespace' '{}' \; \
+ | awk "{ print substr(\$0, 11, length(\$0) - 11) \"\\\\${classname}\" }"
+ # for f in "$(git ls-files | grep "${classname}.php")"; do
+ # grep '^namespace' "$f" | awk '{ print substr($0, 11, length($0) - 11) }'
+ # done
+}
+
+main "$@"