diff options
47 files changed, 2365 insertions, 1180 deletions
@@ -5,4 +5,6 @@ --ignore PKGBUILD --ignore pkg.tar.xz --ignore src +--ignore Brewfile +--ignore .gitignore --no-folding diff --git a/GNUmakefile b/GNUmakefile index 1f44fbd..5d7b856 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,7 +8,7 @@ SCHEME_IMPLEMENTATION = guile .PRECIOUS: %.el define tangle = - @echo -e "\e[35mOBT\e[0m" $< + @printf "\e[35mOBT\e[0m %s\n" $< @$(EMACS) -quick -batch \ -eval "(package-initialize)" \ -load ob-tangle \ @@ -48,11 +48,11 @@ picom-clean: ## Emacs -emacs: emacs/.config/shepherd/init.d/emacs.scm emacs/.config/emacs/init.elc +before-emacs-install: emacs/.emacs.d/init.elc emacs-clean: - rm -f emacs/.config/shepherd/init.d/emacs.scm emacs/.config/emacs/init.el \ - emacs/.config/emacs/init.elc + rm -f emacs/.config/shepherd/init.d/emacs.scm emacs/.emacs.d/init.el \ + emacs/.emacs.d/init.elc ## Xmodmap @@ -131,8 +131,15 @@ nyxt: nyxt/.config/nyxt/init.lisp $(call tangle,emacs-lisp) %.elc: %.el - @echo -e "\e[36mELC\e[0m" $< - $(EMACS) -batch -f package-initialize -f batch-byte-compile $< + @printf "\e[36mELC\e[0m %s\n" $< + @$(EMACS) -q -batch -f package-initialize -f batch-byte-compile $< + +%.fnl: %.org + $(call tangle,fennel) + +%.lua: %.fnl + @printf "\e[32mFNL\e[0m %s\n" $< + @fennel --compile $^ > $@ %: %.org $(call tangle) @@ -146,6 +153,9 @@ nyxt: nyxt/.config/nyxt/init.lisp check: $(SCHEME_IMPLEMENTATION) --no-auto-compile test.scm +$(HOME)/code/%/: + mkdir -p $@ + new-dotfiles: ## Surfingkeys @@ -154,6 +164,62 @@ surfingkeys/dist/home.js: surfingkeys/home.ts surfingkeys/dist/punt.js: surfingkeys/punt.ts surfingkeys/home.ts cd surfingkeys && guix shell nodejs -- npx webpack -c webpack.config.js +## Diamond Interactive MacOS + +diamond-interactive: ssh-keygen brew-install wezterm-install glide-install git-install zsh-install _mbsetupuser-install change-macos-defaults + +ssh-keygen: $(HOME)/.ssh/id_ed25519.pub + +$(HOME)/.ssh/id_ed25519.pub: + ssh-keygen -t ed25519 -C "Tom Punt Macos Laptop" + +brew-install: _mbsetupuser/Brewfile + brew bundle --quiet --file $^ + +before-_mbsetupuser-install: \ + _mbsetupuser/.emacs.d/init.elc \ + _mbsetupuser/.emacs.d/scripts/find-php-class + +before-wezterm-install: wezterm/.config/wezterm/wezterm.lua + +_mbsetupuser/.config/zsh/conf.d/postgresql.sh: _mbsetupuser/Brewfile + $(call tangle,shell) + +_mbsetupuser/.emacs.d/init.el: \ + emacs/.emacs.d/init.el \ + emacs/.emacs.d/oni-outline.el \ + emacs/.emacs.d/oni-gui.el \ + emacs/.emacs.d/oni-dashboard.el \ + emacs/.emacs.d/oni-stillness.el \ + emacs/.emacs.d/oni-xterm-color.el \ + emacs/.emacs.d/oni-compilation.el \ + emacs/.emacs.d/oni-php.el \ + emacs/.emacs.d/oni-prescient.el \ + emacs/.emacs.d/oni-corfu.el \ + emacs/.emacs.d/oni-yasnippet.el \ + emacs/.emacs.d/oni-smartparens.el \ + emacs/.emacs.d/oni-flycheck.el \ + emacs/.emacs.d/oni-dumb-jump.el \ + emacs/.emacs.d/oni-grep.el \ + oni/home/config/pop-os/emacs.el + mkdir -p $$(dirname $@) + cat $^ > $@ + +_mbsetupuser/.emacs.d/scripts/%: emacs/.emacs.d/scripts/% + mkdir -p $$(dirname $@) + cp $^ $@ + +project-directories: \ + $(HOME)/code/personal/ \ + $(HOME)/code/diamond-interactive/ \ + $(HOME)/code/foreign/ \ + $(HOME)/code/study/ + +change-macos-defaults: +# https://macos-defaults.com/dock/autohide.html + defaults write com.apple.dock "autohide" -bool "true" + killall Dock + # Local Variables: # outline-regexp: "##+" # End: @@ -2,3 +2,13 @@ Here is my dotfiles repository, it shows my configuration for several programs I use. [[file:emacs/.emacs.d/init.org][Emacs]] + +* bootstrap + +To initialize this configuration on a new system we can run this command to make sure we're running with the right context: + +#+begin_src sh + touch secrets.scm + guix time-machine -C channels.scm -- home reconfigure config.scm + guix pull +#+end_src diff --git a/_mbsetupuser/.gitignore b/_mbsetupuser/.gitignore new file mode 100644 index 0000000..e4c7250 --- /dev/null +++ b/_mbsetupuser/.gitignore @@ -0,0 +1 @@ +Brewfile
\ No newline at end of file diff --git a/_mbsetupuser/Brewfile.org b/_mbsetupuser/Brewfile.org new file mode 100644 index 0000000..f2cf741 --- /dev/null +++ b/_mbsetupuser/Brewfile.org @@ -0,0 +1,83 @@ +#+title: Brewfile +#+PROPERTY: header-args:ruby :tangle Brewfile + +This file defines all the software that needs to be installed on the system. + +First off, of course, needs to be Emacs. This is done through a cask, which is what all graphical applications are installed as. + +Although the default Emacs cask doesn't work well with macos, so I've had to install emacs-plus instead, which needs a separate tap first. + +#+begin_src ruby + tap "d12frosted/emacs-plus" + cask "emacs-plus-app" +#+end_src + +Then comes Glide, the browser that's configurable and extensible through TypeScript. It lets me configure things that Firefox generally doesn't, but it's still based on Firefox, so I don't have to use Chrome. + +#+begin_src ruby + cask "glide-browser" +#+end_src + +Third is the terminal that I use, Wezterm, which can be configured through Lua. + +#+begin_src ruby + cask "wezterm" +#+end_src + +Then I need some things for configuration and development purposes: + +- git :: Version control system that I use. +- stow :: Mainly used with this repository, "installs" configuration files by making and maintaining symbolic links. +- make :: The bundled version with macos is really old and doesn't support some of the features that I use. +- tailscale :: Mesh VPN that lets me connect to my self-hosted services like music streaming. +- hammerspoon :: Automation framework like AutoHotKey for Windows. But different. +- fennel :: Fennel is a lisp -> lua compiler, it allows me to write lua config (like Wezterm and Hammerspoon) in lisp. + + +#+begin_src ruby + brew "git" + brew "stow" + brew "make" + cask "tailscale-app" + cask "hammerspoon" + brew "fennel" +#+end_src + +And there are some development projects that I need to be able to install. + +- docker :: This runs all of my development projects. +- docker-compose :: This is used to organize the different docker containers. +- colima :: This is apparently needed to run the docker daemon if you don't want to run Docker Desktop. I can't run Docker Desktop because you have to pay quite a bit of money for that. +- postgres@16 :: We use PostgreSQL here and I need the client to be able to connect to the containers in docker. +- php :: It's what we use. + +#+begin_src ruby + brew "docker" + brew "docker-compose" + brew "colima" + brew "postgresql" + brew "php" +#+end_src + +For postgresql we also need to have a shell script to add the tools to the path. + +#+begin_src shell :tangle .config/zsh/conf.d/postgresql.sh :mkdirp t + export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH" +#+end_src + +Fonts too! + +- fantasque-sans-mono :: This is my main coding font. I've been attached to this font for years, I can't let it go. It has the nicest parentheses that I've found so far. +- dosis :: This is a variable-width font that I'm trying out for any text that isn't code. I haven't found anything that I like as much as Fantasque Sans Mono for code yet. + +#+begin_src ruby + cask "font-fantasque-sans-mono" + cask "font-dosis" +#+end_src + +I also created my own tap: + +#+begin_src ruby + tap "ryuslash/scsh", "https://git.sr.ht/~ryuslash/homebrew-scsh", trusted: true + brew "scsh" +#+end_src 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 "$@" diff --git a/git/.config/git/config b/git/.config/git/config index bf4f18e..83804a3 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -4,9 +4,11 @@ [diff "org"] xfuncname = "^\\*+ +(.+)" [diff "lisp"] - xfuncname = "^[[:space:]]*?\\(def\\w+? ((\\w|-|'|:|=|<|>)+)" + xfuncname = "^[[:space:]]*\\(def\\w+ ((\\w|-|'|:|=|<|>)+)" [sendemail] sendmailcmd = /usr/bin/msmtp [init] defaultBranchname = main defaultBranch = main +[includeIf "gitdir:~/code/diamond-interactive/"] + path = diamond-interactive.cfg diff --git a/git/.config/git/diamond-interactive-social-api-ignore b/git/.config/git/diamond-interactive-social-api-ignore new file mode 100644 index 0000000..f12bfaa --- /dev/null +++ b/git/.config/git/diamond-interactive-social-api-ignore @@ -0,0 +1,5 @@ +.dir-locals.el +.wakatime-project +GPATH +GTAGS +GRTAGS
\ No newline at end of file diff --git a/git/.config/git/diamond-interactive-social-api.cfg b/git/.config/git/diamond-interactive-social-api.cfg new file mode 100644 index 0000000..50ddb41 --- /dev/null +++ b/git/.config/git/diamond-interactive-social-api.cfg @@ -0,0 +1,2 @@ +[core] + excludesFile = ~/.config/git/diamond-interactive-social-api-ignore
\ No newline at end of file diff --git a/git/.config/git/diamond-interactive.cfg b/git/.config/git/diamond-interactive.cfg new file mode 100644 index 0000000..9ac0376 --- /dev/null +++ b/git/.config/git/diamond-interactive.cfg @@ -0,0 +1,9 @@ +[user] + name = Tom Willemsen + email = tom@punt.com + +[github] + user = tomw-punt + +[includeIf "gitdir:social-api/"] + path = diamond-interactive-social-api.cfg
\ No newline at end of file diff --git a/git/.config/git/personal.cfg b/git/.config/git/personal.cfg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/git/.config/git/personal.cfg diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index a155010..af5d1bf 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -78,52 +78,55 @@ glide.keymaps.set('normal', '<A-v>', 'scroll_page_up'); glide.keymaps.del('normal', '<C-u>'); // Commandline -glide.keymaps.set('normal', '<A-x>', 'commandline_show'); +glide.keymaps.set(['normal', 'insert'], '<A-x>', 'commandline_show'); glide.keymaps.set('normal', 't', 'commandline_show tab_new '); glide.keymaps.del('normal', ':'); +glide.keymaps.set('insert', '<C-n>', async () => await glide.keys.send("<down>")); +glide.keymaps.set('insert', '<C-p>', async () => await glide.keys.send('<up>')); + const keyboard_quit = glide.excmds.create({ - name: "keyboard_quit", - description: 'Cancel whatever is going on and return to normal', + name: "keyboard_quit", + description: 'Cancel whatever is going on and return to normal', }, () => { - if (glide.findbar.is_open()) { - glide.findbar.close(); - } + if (glide.findbar.is_open()) { + glide.findbar.close(); + } - if (glide.commandline.is_active()) { - glide.commandline.close(); - } + if (glide.commandline.is_active()) { + glide.commandline.close(); + } - glide.excmds.execute('mode_change normal'); + glide.excmds.execute('mode_change normal'); }); glide.keymaps.set(['insert', 'command', 'normal'], '<C-g>', 'keyboard_quit'); // Search const search_next = glide.excmds.create({ - name: "search_next", - description: "Open search or find the next result", + name: "search_next", + description: "Open search or find the next result", }, () => { - if (glide.findbar.is_focused()) { - glide.findbar.next_match(); - } - else { - glide.findbar.open(); - glide.excmds.execute('mode_change insert'); - } + if (glide.findbar.is_focused()) { + glide.findbar.next_match(); + } + else { + glide.findbar.open(); + glide.excmds.execute('mode_change insert'); + } }); const search_prev = glide.excmds.create({ - name: "search_prev", - description: "Open search of find the previous result", + name: "search_prev", + description: "Open search of find the previous result", }, () => { - if (glide.findbar.is_focused()) { - glide.findbar.previous_match(); - } - else { - glide.findbar.open(); - glide.excmds.execute('mode_change insert'); - } + if (glide.findbar.is_focused()) { + glide.findbar.previous_match(); + } + else { + glide.findbar.open(); + glide.excmds.execute('mode_change insert'); + } }); glide.keymaps.set('normal', '<C-s>', 'search_next'); @@ -132,51 +135,51 @@ glide.keymaps.set('insert', '<C-s>', 'search_next'); glide.keymaps.set('insert', '<C-r>', 'search_prev'); async function installPuntAddons() { - await glide.addons.install("https://addons.mozilla.org/firefox/downloads/file/4677239/1password_x_password_manager-8.12.1.3.xpi"); - await glide.addons.install('https://addons.mozilla.org/firefox/downloads/file/4508409/vue_js_devtools-7.7.7.xpi'); + await glide.addons.install("https://addons.mozilla.org/firefox/downloads/file/4677239/1password_x_password_manager-8.12.1.3.xpi"); + await glide.addons.install('https://addons.mozilla.org/firefox/downloads/file/4508409/vue_js_devtools-7.7.7.xpi'); } async function installPersonalAddons() { - await glide.addons.install('https://addons.mozilla.org/firefox/downloads/file/4628286/keepassxc_browser-1.9.11.xpi'); + await glide.addons.install('https://addons.mozilla.org/firefox/downloads/file/4628286/keepassxc_browser-1.9.11.xpi'); } glide.keymaps.set('normal', '<leader>m', async function() { - const tabs = await glide.tabs.query({url: 'https://meet.google.com/*'}); + const tabs = await glide.tabs.query({url: 'https://meet.google.com/*'}); - if (tabs.length === 0) { - return; - } + if (tabs.length === 0) { + return; + } - await glide.content.execute(() => { - document.querySelector('[data-is-muted]').click(); - }, { tab_id: tabs[0] }); + await glide.content.execute(() => { + document.querySelector('[data-is-muted]').click(); + }, { tab_id: tabs[0] }); }); async function open_or_activate(url) { - const tabs = await glide.tabs.query({url: `*://${url.hostname}/*`}); - const tab = tabs.find(t => t.url.startsWith(url.href)); + const tabs = await glide.tabs.query({url: `*://${url.hostname}/*`}); + const tab = tabs.find(t => t.url.startsWith(url.href)); - if (tab) { - await browser.tabs.update(tab.id, { active: true }); - } else { - glide.excmds.execute(`tab_new ${url}`); - } + if (tab) { + await browser.tabs.update(tab.id, { active: true }); + } else { + glide.excmds.execute(`tab_new ${url}`); + } } glide.keymaps.set('normal', '<leader>gd', async function() { - glide.commandline.show({ - title: "Shortcut", - options: [ - { label: 'Chanced Local', execute() { open_or_activate(new URL('http://localhost:8081')); } }, - { label: 'Punt Local', execute() { open_or_activate(new URL("http://localhost:8082")); } }, - { label: 'Local Filament', execute() { open_or_activate(new URL("http://localhost:8002")); } }, - { label: 'Chanced Staging', execute() { open_or_activate(new URL("https://gambleh.com")); } }, - { label: 'Chanced Staging Filament', execute() { open_or_activate(new URL("https://filament.gambleh.com")); } }, - { label: 'Punt Staging', execute() { open_or_activate(new URL("https://goldsink.com")); } }, - { label: 'Punt Staging Filament', execute() { open_or_activate(new URL("https://filament.goldsink.com")); } }, - { label: 'Back-end Github', execute() { open_or_activate(new URL("https://github.com/juked-social/social-api")); } }, - ], - }); + glide.commandline.show({ + title: "Shortcut", + options: [ + { label: 'Chanced Local', execute() { open_or_activate(new URL('http://localhost:8081')); } }, + { label: 'Punt Local', execute() { open_or_activate(new URL("http://localhost:8082")); } }, + { label: 'Local Filament', execute() { open_or_activate(new URL("http://localhost:8002")); } }, + { label: 'Chanced Staging', execute() { open_or_activate(new URL("https://gambleh.com")); } }, + { label: 'Chanced Staging Filament', execute() { open_or_activate(new URL("https://filament.gambleh.com")); } }, + { label: 'Punt Staging', execute() { open_or_activate(new URL("https://goldsink.com")); } }, + { label: 'Punt Staging Filament', execute() { open_or_activate(new URL("https://filament.goldsink.com")); } }, + { label: 'Back-end Github', execute() { open_or_activate(new URL("https://github.com/juked-social/social-api")); } }, + ], + }); }); glide.addons.install("https://addons.mozilla.org/firefox/downloads/file/4675310/ublock_origin-1.69.0.xpi"); @@ -198,9 +201,9 @@ glide.keymaps.set("normal", "gh", async () => { function isVisible(element: HTMLElement): boolean { const style = window.getComputedStyle(element); return style.display !== 'none' && - style.visibility !== 'hidden' && - style.opacity !== '0' && - element.offsetParent !== null; + style.visibility !== 'hidden' && + style.opacity !== '0' && + element.offsetParent !== null; } function getXPath(element: Element): string { @@ -226,7 +229,7 @@ glide.keymaps.set("normal", "gh", async () => { tag: heading.tagName.toLowerCase(), id: heading.id || '', xpath: getXPath(heading) - })); + })); }, { tab_id: activeTabId }); if (headings.length === 0) { @@ -270,87 +273,97 @@ glide.keymaps.set("normal", "gh", async () => { }); }, { description: "Jump to heading in current page" }); -glide.keymaps.set('normal', 'ab', async () => { - const currentTab = await glide.tabs.get_first({ active: true }); +// Bookmarks - glide.commandline.show({ - title: 'Add', - options: [{ - label: currentTab.title, - async execute({ input }) { - await browser.bookmarks.create({ - url: currentTab.url, - title: input || currentTab.title, - }); - } - }], - }); +const add_bookmark = glide.excmds.create({ + name: 'add_bookmark', + description: 'Create a bookmark for the current page, asking for the title.', +}, async () => { + const currentTab = await glide.tabs.get_first({ active: true }); + + glide.commandline.show({ + title: 'Add', + options: [{ + label: currentTab.title, + async execute({ input }) { + await browser.bookmarks.create({ + url: currentTab.url, + title: input || currentTab.title, + }); + } + }], + }); }); -glide.keymaps.set('normal', 'kb', async () => { - const bookmarks = await browser.bookmarks.search({}); +const remove_bookmark = glide.excmds.create({ + name: 'remove_bookmark', + description: 'Remove a bookmark for the current page.', +}, async () => { + const bookmarks = await browser.bookmarks.search({}); - glide.commandline.show({ - title: 'Remove', - options: bookmarks.map((b) => ({ - label: b.title, - async execute() { - await browser.bookmarks.remove(b.id); - }, - })), - }); + glide.commandline.show({ + title: 'Remove', + options: bookmarks.map((b) => ({ + label: b.title, + async execute() { + await browser.bookmarks.remove(b.id); + }, + })), + }); }); +glide.keymaps.set('normal', 'ab', 'add_bookmark'); +glide.keymaps.set('normal', 'kb', 'remove_bookmark'); // Split windows const split_window = glide.excmds.create({ - name: 'split_window', - description: 'Ask for a tab and show it in a split with this window', + name: 'split_window', + description: 'Ask for a tab and show it in a split with this window', }, async () => { - const activeTab = await glide.tabs.active(); - const tabs = await glide.tabs.query({}); + const activeTab = await glide.tabs.active(); + const tabs = await glide.tabs.query({}); - glide.commandline.show({ - title: "Show other", - options: tabs.map(t => ({ - label: t.title, - async execute() { - glide.unstable.split_views.create([activeTab.id, t.id]); - } - })), - }); + glide.commandline.show({ + title: "Show other", + options: tabs.map(t => ({ + label: t.title, + async execute() { + glide.unstable.split_views.create([activeTab.id, t.id]); + } + })), + }); }); const keep_window = glide.excmds.create({ - name: 'keep_window', - description: 'Remove the current split of windows, keeping the focused window', + name: 'keep_window', + description: 'Remove the current split of windows, keeping the focused window', }, ({ tab_id }) => { - if (glide.unstable.split_views.has_split_view(tab_id)) { - glide.unstable.split_views.separate(tab_id); - } + if (glide.unstable.split_views.has_split_view(tab_id)) { + glide.unstable.split_views.separate(tab_id); + } }); const delete_window = glide.excmds.create({ - name: 'delete_window', - description: 'Remove the current split of windows, removing the focused window', + name: 'delete_window', + description: 'Remove the current split of windows, removing the focused window', }, async ({ tab_id }) => { - glide.excmds.execute(`other_window`); - glide.excmds.execute(`keep_window`); + glide.excmds.execute(`other_window`); + glide.excmds.execute(`keep_window`); }); const other_window = glide.excmds.create({ - name: 'other_window', - description: 'Focus other window', + name: 'other_window', + description: 'Focus other window', }, async ({ tab_id }) => { - if (!glide.unstable.split_views.has_split_view(tab_id)) { - return; - } + if (!glide.unstable.split_views.has_split_view(tab_id)) { + return; + } - const split_tabs = await glide.unstable.split_views.get(tab_id); - const other_tab = split_tabs.tabs.filter(t => t.id !== tab_id)[0]; + const split_tabs = await glide.unstable.split_views.get(tab_id); + const other_tab = split_tabs.tabs.filter(t => t.id !== tab_id)[0]; - await browser.tabs.update(other_tab.id, { active: true }); + await browser.tabs.update(other_tab.id, { active: true }); }); glide.keymaps.set('normal', '<C-x>4b', 'split_window'); @@ -358,12 +371,65 @@ glide.keymaps.set('normal', '<C-x>1', 'keep_window'); glide.keymaps.set('normal', '<C-x>0', 'delete_window'); glide.keymaps.set('normal', '<A-o>', 'other_window'); +// Groups + +const group_tab = glide.excmds.create({ + name: 'group_tab', + description: 'Add the current tab to a group.' +}, async ({ tab_id }) => { + let groups = await browser.tabGroups.query({}); + + if (groups.length === 0) { + groups = [{title: ''}]; + } + + glide.commandline.show({ + title: "group", + options: groups.map((group) => ({ + label: group.title, + async execute({ input }) { + if (group.title.indexOf(input) >= 0) { + await browser.tabs.group({ + groupId: group.id, + tabIds: [tab_id], + }); + } else { + const groupId = await browser.tabs.group({ + tabIds: [tab_id], + }); + await browser.tabGroups.update(groupId, { + title: input, + }); + } + }, + })), + }); +}); + +const ungroup_tab = glide.excmds.create({ + name: 'ungroup_tab', + description: 'Remove the current tab from any group.' +}, async ({ tab_id }) => { + await browser.tabs.ungroup([ tab_id ]); +}); + +glide.keymaps.set('normal', 'ag', 'group_tab'); +glide.keymaps.set('normal', 'kg', 'ungroup_tab'); + glide.include('sitesearch.glide.ts'); glide.include('tabbar.glide.ts'); const toggle_reader_mode = glide.excmds.create({ - name: 'toggle_reader_mode', - description: 'Toggle Reader Mode for the current tab', + name: 'toggle_reader_mode', + description: 'Toggle Reader Mode for the current tab', +}, () => { + browser.tabs.toggleReaderMode(); +}); + +glide.autocmds.create("UrlEnter", { + hostname: "staging.goldsink.com", }, () => { - browser.tabs.toggleReaderMode(); + glide.buf.prefs.set( + 'geo.provider.network.url', + 'data:application/json,{"location": {"lat": 45.542805, "lng": -122.7369563}, "accuracy": 100.0}'); }); diff --git a/glide/.config/glide/tabbar.glide.ts b/glide/.config/glide/tabbar.glide.ts index 3ad7817..5cc6647 100644 --- a/glide/.config/glide/tabbar.glide.ts +++ b/glide/.config/glide/tabbar.glide.ts @@ -122,6 +122,8 @@ async function update_status_bar() { return } + const mode = glide.ctx.mode; + try { const current_window = await browser.windows.getCurrent(); const tabs = await browser.tabs.query({ @@ -132,21 +134,27 @@ async function update_status_bar() { const url = active_tab.url; const title = active_tab.title || "Untitled"; + let groupDisplay = ""; + if (active_tab.groupId >= 0) { + const group = await browser.tabGroups.get(active_tab.groupId); + groupDisplay = `[${group.title}] | `; + } + let display_url = url || "about:blank"; if (display_url.length > 50) { display_url = display_url.substring(0, 47) + "..."; } - tabs_container.textContent = `[${tab_index + 1}/${tabs.length}]`; - right.textContent = `${title} | ${display_url}`; + tabs_container.textContent = `${mode} [${tab_index + 1}/${tabs.length}]`; + right.textContent = `${groupDisplay}${title} | ${display_url}`; } catch (e) { tabs_container.textContent = e; right.textContent = "Error loading tabs" } } -glide.autocmds.create("ModeChanged", "*", (args) => { +glide.autocmds.create("ModeChanged", "*", async (args) => { const style_id = "glide-custom-mode-indicator" glide.styles.remove(style_id) glide.styles.add(` @@ -154,6 +162,7 @@ glide.autocmds.create("ModeChanged", "*", (args) => { border-bottom: 3px solid var(${mode_colors[args.new_mode] ?? fallback_mode_color}) } `, { id: style_id }) + await update_status_bar(); }) glide.autocmds.create("UrlEnter", /.*/, async () => { diff --git a/oni/home/config/data.scm b/oni/home/config/data.scm index 2cf41a0..6636ab3 100644 --- a/oni/home/config/data.scm +++ b/oni/home/config/data.scm @@ -20,18 +20,7 @@ #:use-module (gnu services) #:use-module (guix gexp) #:use-module (oni home config common) - #:use-module ((oni home services emacs) - #:select (home-emacs-service-type - home-emacs-configuration - home-emacs-helpful-configuration - home-emacs-yasnippet-capf-configuration - home-emacs-eros-service-type - home-emacs-ace-link-service-type - home-emacs-ace-link-configuration - home-emacs-golden-ratio-service-type - home-emacs-pinentry-service-type - home-emacs-org-caldav-service-type - home-emacs-envrc-configuration)) + #:use-module (oni home services emacs) #:use-module (oni home services environment) #:use-module (oni home services git) #:use-module (oni home services kdeconnect) @@ -56,7 +45,11 @@ "openssh" "keepassxc" "font-dosis" - "swaybg")) + "swaybg" + "emacs-geiser-hoot" + "wayland" + "emacs-org-journal" + "emacs-nginx-mode")) (list pick-random-wallpaper emacs-org-contacts @@ -64,7 +57,6 @@ emacs-outli emacs-guix - (emacs-oni-org-roam emacs-pgtk) emacs-oni-vterm emacs-oni-elisp emacs-oni-core @@ -178,4 +170,10 @@ xfuncname = \"^[[:space:]]*?\\\\(def\\\\w+? ((\\\\w|-|'|:|=|<|>)+)\" "))) - (service home-niri-service-type))))) + (service home-niri-service-type) + + (service home-wakatime-service-type + (home-wakatime-configuration + (api-url "https://waka.ryuslash.org/api") + (exclude '("COMMIT_EDITMSG$" + "TAG_EDITMSG$")))))))) diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm index 80edc2a..fe28d66 100644 --- a/oni/home/config/pop-os.scm +++ b/oni/home/config/pop-os.scm @@ -5,10 +5,12 @@ #:select (home-gpg-agent-service-type home-gpg-agent-configuration)) #:use-module (gnu home services mail) + #:use-module (gnu home services ssh) #:use-module (gnu packages) #:use-module (gnu packages emacs) #:use-module (gnu packages music) #:use-module (gnu packages pulseaudio) + #:use-module (gnu packages rust-apps) #:use-module ((gnu services) #:select (service)) #:use-module ((guix gexp) @@ -198,7 +200,8 @@ "emacs-dockerfile-mode" "emacs-slack" "emacs-combobulate" - "emacs-prodigy")) + "emacs-prodigy" + "emacs-vertico-posframe")) (list emacs-oni-core emacs-oni-compilation emacs-oni-common-lisp @@ -234,11 +237,17 @@ emacs-oni-sql emacs-oni-logview emacs-oni-notmuch + emacs-oni-dumb-jump + ripgrep emacs-flycheck-phpstan emacs-vue-ts-mode + emacs-stillness-mode - shutdown-rofi))) + shutdown-rofi + + emacs-related-files + ))) (services (append home-zsh-services (list home-channels-service @@ -283,10 +292,12 @@ (service home-gpg-agent-service-type (home-gpg-agent-configuration - (ssh-support? #t) + (ssh-support? #f) (extra-content "allow-emacs-pinentry\n"))) + (service home-ssh-agent-service-type) + (service home-git-service-type (home-git-configuration (user-name "Tom Willemse") diff --git a/oni/home/config/pop-os/emacs.el b/oni/home/config/pop-os/emacs.el index c681c94..ffd0c79 100644 --- a/oni/home/config/pop-os/emacs.el +++ b/oni/home/config/pop-os/emacs.el @@ -46,7 +46,8 @@ ("ac" "Run Command" artisan-chanced-run-command) ("am" "Migrate" artisan-chanced-migrate) ("asc" "Create Saloon Connector" artisan-create-saloon-connector) - ("asr" "Create Saloon Request" artisan-create-saloon-request)] + ("asr" "Create Saloon Request" artisan-create-saloon-request) + ("aMs" "Create Settings Migration" artisan-create-settings-migration)] ["Commands" ;; ("t" "Test" artisan-test-transient) @@ -84,6 +85,14 @@ connector." (find-file good-file-name)) (vc-register))) +(defun artisan-create-settings-migration (name) + "Create a new saloon connector. +INTEGRATION is the related integration. NAME is the name of the saloon +connector." + (interactive "MName: ") + (let ((default-directory (expand-file-name "chanced" (project-root (project-current))))) + (shell-command (format "docker exec chanced-backend php artisan make:settings-migration %s ../common/database/settings/" (shell-quote-argument name))))) + (defun artisan-punt-composer-install () (interactive) (let ((default-directory (expand-file-name "punt" (project-root (project-current))))) @@ -394,41 +403,6 @@ Optional argument STOPP means stop on any defect." (find-file good-file-name) (vc-register))) -(require 'dashboard) -(dashboard-setup-startup-hook) -(run-with-idle-timer 300 t (lambda () (switch-to-buffer dashboard-buffer-name))) -(run-at-time "02:00" 86400 #'dashboard-open) -;;; -(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 "[" "]")))) -(setq dashboard-startup-banner "~/code/personal/dotfiles/oni/home/services/emacs/pop-os-logo.svg") -(setq dashboard-set-navigator t) -(setq dashboard-set-footer nil) -(setq dashboard-projects-show-base t) -(setq dashboard-recentf-show-base t) - -(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))) - (setq browse-url-browser-function #'browse-url-generic) (setq browse-url-generic-args nil) (setq browse-url-generic-program "~/Downloads/glide/glide") @@ -485,810 +459,6 @@ Optional argument STOPP means stop on any defect." (sql-server "localhost") (sql-port 5432)))) -(with-eval-after-load 'web-mode - (defun web-mode-scan-blocks (reg-beg reg-end) - "Identifies blocks (with block-side, block-beg, block-end text properties)." - (save-excursion - - (let ((i 0) open close closing-string sub1 sub2 pos tagopen tmp delim-open delim-close part-beg part-end tagclose) - - (goto-char reg-beg) - - ;;(message "%S: %Sx%S" (point) reg-beg reg-end) - ;;(message "regexp=%S" web-mode-block-regexp) - (while (and (< i 2000) - (> reg-end (point)) - web-mode-block-regexp - (re-search-forward web-mode-block-regexp reg-end t) - (not (eobp))) - - (setq i (1+ i) - closing-string nil - close nil - tagopen (match-string 0) - open (match-beginning 0) - delim-open nil - delim-close nil - pos nil) - - (let ((l (length tagopen))) - (when (member (string-to-char tagopen) '(?\s ?\t)) - (setq tagopen (replace-regexp-in-string "\\`[ \t]*" "" tagopen)) - (setq open (+ open (- l (length tagopen)))) - (setq l (length tagopen)) - ) - (setq sub1 (substring tagopen 0 1) - sub2 (substring tagopen 0 (if (>= l 2) 2 1))) - ) - ;;(message " found block #(%S) at pos=(%S), part-type=(%S)" i open (get-text-property open 'part-side)) - (cond - - ((string= web-mode-engine "php") - (unless (member (char-after) '(?x ?X)) - (setq closing-string '("<\\?". "\\?>"))) - (cond - ((looking-at-p "<?php") - (setq delim-open "<?php") - (setq delim-close "?>")) - ((eq (char-after) ?\=) - (setq delim-open "<?=") - (setq delim-close "?>")) - (t - (setq delim-open "<?") - (setq delim-close "?>")) - ) ;cond - ) ;php - - ((string= web-mode-engine "erb") - (cond - ((string= sub2 "<%") - (setq closing-string '("<%". "%>") - delim-open "<%\\(==\\|[=-]\\)?" - delim-close "[-]?%>")) - (t - (setq closing-string "EOL" - delim-open "%")) - ) - ) ;erb - - ((string= web-mode-engine "django") - (cond - ((string= sub2 "{{") - (setq closing-string "EODQ" - ;;(setq closing-string '("{{" . "}}") - delim-open "{{" - delim-close "}}")) - ((string= sub2 "{%") - (setq closing-string "%}" - delim-open "{%[+-]?" - delim-close "[-]?%}")) - ((string= sub2 "{#") - (setq closing-string "#}")) - (t - (setq closing-string "EOL" - delim-open "#[#]?")) - ) - ) ;django - - ((string= web-mode-engine "anki") - (setq closing-string "}}" - delim-open "{{[#/^]?" - delim-close "}}") - ) ;anki - - ((string= web-mode-engine "ejs") - (setq closing-string "%>" - delim-open "<%[=-]?" - delim-close "[-]?%>") - ) ;ejs - - ((string= web-mode-engine "lsp") - (setq closing-string "%>" - delim-open "<%[%#]?" - delim-close "%>") - ) ;lsp - - ((string= web-mode-engine "mako") - (cond - ((and (string= tagopen "<%") - (member (char-after) '(?\s ?\n ?\!))) - (setq closing-string "%>" - delim-open "<%[!]?" - delim-close "%>")) - ((member sub2 '("<%" "</")) - (setq closing-string ">" - delim-open "</?%" - delim-close "/?>")) - ((string= sub2 "${") - (setq closing-string "}" - delim-open "${" - delim-close "}")) - (t - (setq closing-string "EOL" - delim-open "%")) - ) - ) ;mako - - ((string= web-mode-engine "cl-emb") - (cond - ((string= tagopen "<%#") - (setq closing-string "#%>")) - ((string= sub2 "<%") - (setq closing-string "%>" - delim-open "<%[=%]?" - delim-close "%>")) - ) - ) ;cl-emb - - ((string= web-mode-engine "artanis") - (cond - ((string= tagopen "<%;") - (setq closing-string "%>")) - ((string= tagopen "<%#|") - (setq closing-string "|#%>")) - ((string= sub2 "<@") - (setq closing-string "%>" - delim-open "<@\\(css\\|icon\\|include\\|js\\)" - delim-close "%>")) - ((string= sub2 "<%") - (setq closing-string "%>" - delim-open "<%[=]?" - delim-close "%>")) - ) - ) ;artanis - - ((string= web-mode-engine "elixir") - (cond - ((member (char-after) '(?\#)) - (setq closing-string "%>")) - (t - (setq closing-string "%>" - delim-open "<%[=%]?" - delim-close "%>")) - ) - ) ;elixir - - ((string= web-mode-engine "mojolicious") - (cond - ((string= tagopen "<%#") - (setq closing-string "%>")) - ((string= sub2 "<%") - (setq closing-string "%>" - delim-open "<%\\(==\\|[=%]\\)?" - delim-close "%>")) - ((string= sub2 "%#") - (setq closing-string "EOL")) - (t - (setq closing-string "EOL" - delim-open "%\\(==\\|[=%]\\)?")) - ) - ) ;mojolicious - - ((string= web-mode-engine "ctemplate") - (cond - ((member tagopen '("{{{" "{{~")) - (setq closing-string "}~?}}" - delim-open "{{~?{" - delim-close "}~?}}") - ) - ((string= tagopen "{~{") - (setq closing-string "}~?}" - delim-open "{~{" - delim-close "}~?}") - ) - ((string= tagopen "{{!") - (setq closing-string (if (looking-at-p "--") "--}}" "}}")) - ) - ((string= sub2 "{{") - (setq closing-string "}~?}" - delim-open "{{[>#/%^&]?" - delim-close "}~?}")) - (t - (setq closing-string "}}" - delim-open "${{" - delim-close "}}")) - ) - ) ;ctemplate - - ((string= web-mode-engine "antlers") - (cond - ((string= tagopen "{{$") - (setq closing-string "$}}" - delim-open "{{$" - delim-close "$}}") - ) - ((string= tagopen "{{?") - (setq closing-string "?}}" - delim-open "{{?" - delim-close "?}}") - ) - ((string= tagopen "{{$") - (setq closing-string "$}}" - delim-open "{{$" - delim-close "$}}") - ) - ((string= sub2 "{{") - (setq closing-string "}}" - delim-open "{{" - delim-close "}}")) - ) - ) ;antlers - - ((string= web-mode-engine "astro") - (cond - ((string= tagopen "---") - (setq closing-string "---" - delim-open "---" - delim-close "---") - ) - ) - ) ;astro - - ((string= web-mode-engine "aspx") - (setq closing-string "%>" - delim-open "<%[:=#@$]?" - delim-close "%>") - ) ;aspx - - ((string= web-mode-engine "asp") - (cond - ((string= sub2 "<%") - (setq closing-string "%>" - delim-open "<%[:=#@$]?" - delim-close "%>")) - (t - (setq closing-string ">" - delim-open "</?" - delim-close "/?>")) - ) - ) ;asp - - ((string= web-mode-engine "jsp") - (cond - ((looking-at-p "--") - (setq closing-string "--%>")) - ((string= sub2 "<%") - (setq closing-string "%>" - delim-open "<%\\([!=@]\\|#=\\)?" - delim-close "[-]?%>")) - ((string= sub2 "${") - (setq closing-string "}" - delim-open "${" - delim-close "}")) - ) - ) ;jsp - - ((string= web-mode-engine "clip") - (setq closing-string ">" - delim-open "</?" - delim-close "/?>") - ) ;clip - - ((string= web-mode-engine "perl") - (setq closing-string ">" - delim-open "</?" - delim-close "/?>") - ) ;perl - - ((string= web-mode-engine "blade") - (cond - ((string= tagopen "{{-") - (setq closing-string "--}}")) - ((string= tagopen "{!!") - (setq closing-string "!!}" - delim-open "{!!" - delim-close "!!}")) - ((string= tagopen "@{{") - (setq closing-string nil)) - ((string= tagopen "{{{") - (setq closing-string "}}}" - delim-open "{{{" - delim-close "}}}")) - ((string= sub2 "{{") - (setq closing-string "}}" - delim-open "{{" - delim-close "}}")) - ((looking-at-p "[[:alnum:]]+\\.[[:alpha:]]+") - ) - ((string= sub1 "@") - (setq closing-string "EOB" - delim-open "@")) - ((looking-at-p "[[:alnum:]]+(") - (setq closing-string ")" - delim-open "@")) - ) - ;;(message "closing-string=%S delim-open=%S delim-close=%S" closing-string delim-open delim-close) - ) ;blade - - ((string= web-mode-engine "smarty") - (cond - ((string= tagopen "{*") - (setq closing-string "*}") - ) - ((string= tagopen "{#") - (setq closing-string "#}" - delim-open "{#" - delim-close "#}") - ) - (t - (setq closing-string (cons "{" "}") - delim-open "{/?" - delim-close "}") - ) ;t - ) ;cond - ) ;smarty - - ((string= web-mode-engine "hero") - (setq closing-string "%>" - delim-open "<%==?\\([biufsv]\\|bs\\)?\\|<%[:~@+!]?" - delim-close "%>") - ) ;hero - - ((string= web-mode-engine "xoops") - (cond - ((string= tagopen "<{*") - (setq closing-string "*}>") - ) - ((string= tagopen "<{#") - (setq closing-string "#}>" - delim-open "<{#" - delim-close "#}>") - ) - (t - (setq closing-string (cons "<{" "}>") - delim-open "<{/?" - delim-close "}>") - ) ;t - ) ;cond - ) ;xoops - - ((string= web-mode-engine "web2py") - (setq closing-string "}}" - delim-open "{{[=]?" - delim-close "}}") - ) ;web2py - - ((string= web-mode-engine "expressionengine") - (cond - ((string= sub2 "{!--") - (setq closing-string "--}")) - (t - (setq closing-string '("{". "}") - delim-open "{/?" - delim-close "}") - ) - ) - ) ;expressionengine - - ((string= web-mode-engine "dust") - (cond - ((string= sub2 "{!") - (setq closing-string "!}")) - (t - (setq closing-string '("{". "}") - delim-open "{[#/:?@><+^]?" - delim-close "/?}") - ) - ) - ) ;dust - - ((string= web-mode-engine "svelte") - (cond - ((string= sub2 "{!") - (setq closing-string "!}")) - ((string= sub2 "{}") - (setq closing-string nil - delim-open nil - delim-close nil)) - (t - (setq closing-string '("{". "}") - delim-open "{[#/:?@><+^]?" - delim-close "/?}") - ) - ) - ) ;svelte - - ((string= web-mode-engine "closure") - (cond - ((string= sub2 "//") - (setq closing-string "EOL") - ) - ((string= sub2 "/*") - (setq closing-string "*/") - ) - (t - (setq closing-string "}" - delim-open "{/?" - delim-close "/?}") - ) - ) - ) ;closure - - ((string= web-mode-engine "go") - (setq closing-string "}}" - delim-open "{{-?" - delim-close "-?}}") - ) ;go - - ((string= web-mode-engine "angular") - (setq closing-string "}}" - delim-open "{{" - delim-close "}}") - ) ;angular - - ((string= web-mode-engine "vue") - (cond - ((string-match-p "[:@][-[:alpha:].]+=\"" tagopen) - (setq closing-string "\"" - delim-open tagopen - delim-close "\"")) - ((string= tagopen "{{") - (setq closing-string "}}" - delim-open "{{" - delim-close "}}"))) - ) ;vue - - ((string= web-mode-engine "mason") - (cond - ((and (member sub2 '("<%" "</")) - (looking-at "[[:alpha:]]+")) - (if (member (match-string-no-properties 0) '("after" "around" "augment" "before" "def" "filter" "method" "override")) - (setq closing-string ">" - delim-open "<[/]?%" - delim-close ">") - (setq closing-string (concat "</%" (match-string-no-properties 0) ">") - delim-open "<[^>]+>" - delim-close "<[^>]+>") - ) ;if - ) - ((and (string= sub2 "<%") - (eq (char-after) ?\s)) - (setq closing-string "%>" - delim-open "<%" - delim-close "%>")) - ((string= tagopen "</&") - (setq closing-string ">" - delim-open "</&" - delim-close ">") - ) - ((string= sub2 "<&") - (setq closing-string "&>" - delim-open "<&[|]?" - delim-close "&>")) - (t - (setq closing-string "EOL" - delim-open "%")) - ) - ) ;mason - - ((string= web-mode-engine "underscore") - (setq closing-string "%>" - delim-open "<%" - delim-close "%>") - ) ;underscore - - ((string= web-mode-engine "template-toolkit") - (cond - ((string= tagopen "%%#") - (setq closing-string "EOL")) - ((string= tagopen "[%#") - (setq closing-string "%]")) - (t - (setq closing-string "%]" - delim-open "\\[%[-+]?" - delim-close "[-=+]?%\\]")) - ) - ) ;template-toolkit - - ((string= web-mode-engine "freemarker") - (cond - ((and (string= sub2 "<#") (eq (char-after) ?\-)) - (setq closing-string "-->")) - ((string= sub1 "<") - (setq closing-string ">" - delim-open "</?[#@]" - delim-close "/?>")) - ((string= sub1 "[") - (setq closing-string "]" - delim-open "\\[/?[#@]" - delim-close "/?\\]")) - (t - (setq closing-string "}" - delim-open "${" - delim-close "}")) - ) - ) ;freemarker - - ((string= web-mode-engine "velocity") - (cond - ((string= sub2 "##") - (setq closing-string "EOL")) - ((string= sub2 "#*") - (setq closing-string "*#")) - (t - (setq closing-string "EOV" - delim-open "#")) - ) - ) ;velocity - - ((string= web-mode-engine "razor") - (cond - ((string= sub2 "@@") - (forward-char 2) - (setq closing-string nil)) - ((string= sub2 "@*") - (setq closing-string "*@")) - ((string= sub1 "@") - (setq closing-string "EOR" - delim-open "@")) - ((and (string= sub1 "}") - (looking-at-p "[ ]*\n")) - ;;(setq closing-string "EOC") - (save-excursion - (let (paren-pos) - (setq paren-pos (web-mode-part-opening-paren-position (1- (point)))) - (if (and paren-pos (get-text-property paren-pos 'block-side)) - (setq closing-string "EOC") - (setq closing-string nil) - ) ;if - ) ;let - ) ;save-excursion - ;;(message "%s %S %S" sub2 (point) (get-text-property (point) 'part-side)) - ) - ((string= sub1 "}") - ;;(message "%s: %s" (point) sub1) - (save-excursion - (let (paren-pos) - (setq paren-pos (web-mode-part-opening-paren-position (1- (point)))) - (if (and paren-pos (get-text-property paren-pos 'block-side)) - (setq closing-string "EOR") - (setq closing-string nil) - ) ;if - ) ;let - ) ;save-excursion - ) ;case } - ) ;cond - ) ;razor - - ((and (string= web-mode-engine "riot") - (not (get-text-property open 'part-side))) - (setq closing-string (if (string= tagopen "{") "}" "/// end script") - delim-open "{" - delim-close "}") - ) ;riot - - ((string= web-mode-engine "spip") - (cond - ((and (string= sub1 "#") - (looking-at "[A-Z0-9_]+")) - (setq closing-string (match-string-no-properties 0))) - ((string= sub1 "(") - (setq closing-string '("(" . ")"))) - ((string= sub1 "{") - (setq closing-string '("{" . "}"))) - ((string= sub2 "<:") - (setq closing-string ":>")) - (t - (setq closing-string "]")) - )) - - ((string= web-mode-engine "marko") - (setq closing-string "}" - delim-open "${" - delim-close "}") - ) ;marko - - ) ;cond - - (when closing-string - (cond - - ((listp closing-string) - (cond - ((web-mode-rsf-balanced (car closing-string) (cdr closing-string) reg-end t) - (setq close (match-end 0) - pos (point)) - ) - ((and (string= web-mode-engine "php") - (string= "<?" sub2)) - - (if (or (text-property-not-all (1+ open) (point-max) 'tag-beg nil) - (text-property-not-all (1+ open) (point-max) 'block-beg nil) - (looking-at-p "[ \t\n]*<")) - (setq close nil - delim-close nil - pos (point)) - (setq close (point-max) - delim-close nil - pos (point-max)) - ) ;if - ) ;case - ) ;cond - ) ;case listp - - ((and (string= web-mode-engine "smarty") - (string= closing-string "}")) - (goto-char open) - (setq tmp (web-mode-closing-delimiter-position - "}" - (point) - (line-end-position))) - (if tmp - (setq tmp (1+ tmp)) - (setq tmp (line-end-position))) - (goto-char tmp) - (setq close (point) - pos (point)) - ) - - ((and (member web-mode-engine '("closure")) - (string= closing-string "}")) - (when (web-mode-closure-skip reg-beg reg-end) - (setq close (point) - pos (point)) - ;;(message "close=%S pos=%S" close pos) - ) ;when - ) - - ((string= closing-string "EOB") - (web-mode-blade-skip open) - (setq close (point) - pos (point))) - - ((string= closing-string "EOL") - (end-of-line) - (setq close (point) - pos (point))) - - ((string= closing-string "EOC") - (setq close (point) - pos (point))) - - ((string= closing-string "EODQ") - (when (web-mode-django-skip reg-beg reg-end) - (setq close (point) - pos (point)) - )) - - ((string= closing-string "EOR") - (web-mode-razor-skip open) - (setq close (if (> (point) reg-end) reg-end (point)) - pos (if (> (point) reg-end) reg-end (point))) - (goto-char pos)) - - ((string= closing-string "EOV") - (web-mode-velocity-skip open) - (setq close (point) - pos (point))) - - ((and (member web-mode-engine '("ctemplate")) - (re-search-forward closing-string reg-end t)) - (setq close (match-end 0) - pos (point))) - - ((and (member web-mode-engine '("antlers")) - (re-search-forward closing-string reg-end t)) - (setq close (match-end 0) - pos (point))) - - ((and (member web-mode-engine '("astro")) - (re-search-forward closing-string reg-end t)) - (setq close (match-end 0) - pos (point))) - - ((search-forward closing-string reg-end t) - (setq close (match-end 0) - pos (point))) - ) ;cond - - (when (and close (>= reg-end pos)) - ;;(message "pos(%S) : open(%S) close(%S)" pos open close) - (put-text-property open (1+ open) 'block-beg 0) - (put-text-property open (1+ open) 'block-controls 0) - (put-text-property open close 'block-side t) - (put-text-property (1- close) close 'block-end t) - (when delim-open - (web-mode-block-delimiters-set open close delim-open delim-close)) - (web-mode-block-scan open close) - (cond - ((and (string= web-mode-engine "erb") - (looking-at-p "<%= javascript_tag do %>")) - (setq tagopen "<%= javascript_tag do %>")) - ((and (string= web-mode-engine "mojolicious") - (looking-at-p "%= javascript begin")) - (setq tagopen "%= javascript begin")) - ((and (string= web-mode-engine "mako") - (looking-at-p "<%block filter=\"collect_js\">")) - (setq tagopen "<%block filter=\"collect_js\">")) - ((and (string= web-mode-engine "mako") - (looking-at-p "<%block filter=\"collect_css\">")) - (setq tagopen "<%block filter=\"collect_css\">")) - ((and (string= web-mode-engine "django") - (looking-at-p "{% javascript %}")) - (setq tagopen "{% javascript %}")) - ((and (string= web-mode-engine "django") - (looking-at-p "{% schema %}")) - (setq tagopen "{% schema %}")) - ((and (string= web-mode-engine "django") - (looking-at-p "{% stylesheet %}")) - (setq tagopen "{% stylesheet %}")) - ) - ;;(message "%S %s" (point) tagopen) - (when (and (member tagopen '("<r:script" "<r:style" - "<c:js" "<c:css" - "<%= javascript_tag do %>" - "<%block filter=\"collect_js\">" - "<%block filter=\"collect_css\">" - "{% javascript %}" - "{% schema %}" - "{% stylesheet %}" - "%= javascript begin" - "---")) - (setq part-beg close) - (setq tagclose - (cond - ((string= tagopen "<r:script") "</r:script") - ((string= tagopen "<r:style") "</r:style") - ((string= tagopen "<c:js") "</c:js") - ((string= tagopen "<c:css") "</c:css") - ((string= tagopen "{% javascript %}") "{% endjavascript %}") - ((string= tagopen "{% schema %}") "{% endschema %}") - ((string= tagopen "{% stylesheet %}") "{% endstylesheet %}") - ((string= tagopen "%= javascript begin") "% end") - ((string= tagopen "---") "---") - ((string= tagopen "<%= javascript_tag do %>") "<% end %>") - ((member tagopen '("<%block filter=\"collect_js\">" - "<%block filter=\"collect_css\">")) "</%block") - )) - (web-mode-sf tagclose) - (setq part-end (match-beginning 0)) - (> part-end part-beg)) - ;;(message "tagopen=%S tagclose=%S end=%S" tagopen tagclose (point)) - (put-text-property part-beg part-end - 'part-side - (cond - ((member tagopen '("<r:style" "<c:css" "<%block filter=\"collect_css\">" "{% stylesheet %}")) 'css) - (t 'javascript))) - (setq pos part-beg - part-beg nil - part-end nil) - ) ;when - ) ;when close - - (if pos (goto-char pos)) - - ) ;when closing-string - - ) ;while - - (cond - ((>= i 2000) - (message "scan-blocks ** warning (%S) **" i)) - ((string= web-mode-engine "razor") - (web-mode-block-foreach reg-beg reg-end 'web-mode-block-scan)) - ((string= web-mode-engine "django") - (web-mode-scan-engine-comments reg-beg reg-end - "{% comment %}" "{% endcomment %}")) - ((string= web-mode-engine "mako") - (web-mode-scan-engine-comments reg-beg reg-end - "<%doc>" "</%doc>")) - ((string= web-mode-engine "mason") - (web-mode-scan-engine-comments reg-beg reg-end - "<%doc>" "</%doc>")) - ) ;cond - - ))) - - (setf (map-elt web-mode-engine-open-delimiter-regexps "vue") - "{{\\|[:@][-[:alpha:].]+=\"")) - -(require 'oni-js) - -(with-eval-after-load 'sh-script (require 'oni-sh)) -(with-eval-after-load 'sql (require 'oni-sql)) -(with-eval-after-load 'outline (require 'oni-outline)) -(with-eval-after-load 'logview (require 'oni-logview)) - (eval-when-compile (require 'magit-section)) diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index d9da737..357bafa 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -63,8 +63,6 @@ #:use-module ((nongnu packages emacs) #:select (emacs-org-roam-ui)) #:use-module (oni home config common) - #:use-module ((oni home services autokey) - #:select (home-autokey-service-type)) #:use-module ((oni home services copyq) #:select (home-copyq-service-type)) #:use-module ((oni home services dunst) @@ -113,6 +111,7 @@ home-stumpwm-stumptray-configuration)) #:use-module ((oni home services syncthing) #:select (home-syncthing-service-type)) + #:use-module (oni home services terminals) #:use-module ((oni home services utilities) #:select (home-inkplate-display-service-type)) #:use-module ((oni home services zsh) @@ -251,8 +250,7 @@ (packages (append foreign-distro-compatibility-packages archlinux-compatibility-packages - (list easytag - (specification->package+output "font-fantasque-sans") + (list (specification->package+output "font-fantasque-sans") (specification->package+output "font-comic-neue") (specification->package+output "font-dosis") (specification->package "zathura") @@ -473,6 +471,7 @@ (service home-stumpwm-service-type (home-stumpwm-configuration (package stumpwm+swank) + (locker-program "/usr") (configurations (list (local-file "../services/stumpwm/stumpwm.lisp"))))) (service home-stumpwm-gaps-service-type @@ -495,7 +494,6 @@ (new-ignore '(".nnmaildir" ".mbsyncstate" ".uidvalidity" ".mbsyncstate.journal" ".mbsyncstate.new")))) - (service home-autokey-service-type) (service home-copyq-service-type) (service home-msmtp-service-type @@ -571,4 +569,9 @@ ("sidebar.visibility" "hide-sidebar") ("ui.key.menuAccessKeyFocuses" #f))))) - (service home-udiskie-service-type))))) + (service home-udiskie-service-type) + + (service home-wezterm-service-type + (home-wezterm-configuration + (configurations + (list (local-file "../../../wezterm/.config/wezterm/wezterm.lua"))))))))) diff --git a/oni/home/services/emacs/org-mem.el b/oni/home/services/emacs/org-mem.el index 55b521f..0c16308 100644 --- a/oni/home/services/emacs/org-mem.el +++ b/oni/home/services/emacs/org-mem.el @@ -2,5 +2,9 @@ :ensure nil :init (setq org-mem-watch-dirs (list (expand-file-name "~/documents/gtd/")) - org-mem-do-sync-with-org-id t) - (org-mem-updater-mode)) + org-mem-do-sync-with-org-id t + org-mem-suffixes '(".org")) + (org-mem-updater-mode) + :config + (add-to-list 'org-mem-exclude "health/harp-") + (add-to-list 'org-mem-exclude "archive/")) diff --git a/oni/home/services/freedesktop.scm b/oni/home/services/freedesktop.scm new file mode 100644 index 0000000..8b29fc6 --- /dev/null +++ b/oni/home/services/freedesktop.scm @@ -0,0 +1,45 @@ +(define-module (oni home services freedesktop) + #:use-module (gnu services configuration) + #:use-module (gnu packages freedesktop) + #:use-module (gnu home services) + #:use-module (gnu home services utils) + #:use-module (gnu home services shepherd) + #:use-module (guix packages) + #:use-module (guix gexp) + + #:export (home-udiskie-service-type + home-udiskie-configuration)) + +(define-configuration home-udiskie-configuration + (package + (package udiskie) + "Package to use for setting udiskie")) + +(define (add-udiskie-packages config) + (list (home-udiskie-configuration-package config))) + +(define (home-udiskie-shepherd-service config) + (list + (shepherd-service + (documentation "Start udiskie") + (provision '(udiskie)) + (auto-start? #t) + (start + #~(make-forkexec-constructor + (list #$(file-append (home-udiskie-configuration-package config) "/bin/udiskie")) + #:log-file (format #f "~a/.local/var/log/udiskie.log" (getenv "HOME")))) + (stop #~(make-kill-destructor))))) + +(define home-udiskie-service-type + (service-type + (name 'home-udiskie) + (extensions + (list (service-extension + home-profile-service-type + add-udiskie-packages) + (service-extension + home-shepherd-service-type + home-udiskie-shepherd-service))) + (compose identity) + (default-value (home-udiskie-configuration)) + (description "Install and configure udiskie."))) diff --git a/oni/home/services/stumpwm/stumpwm.lisp b/oni/home/services/stumpwm/stumpwm.lisp index 93484a4..45f4664 100644 --- a/oni/home/services/stumpwm/stumpwm.lisp +++ b/oni/home/services/stumpwm/stumpwm.lisp @@ -165,7 +165,7 @@ after it has been unlocked." (0 t t :class "teams-for-linux" :create t) (0 t t :class "Slack")) -(sb-ext:run-program *shell-program* '("-c" "feh --bg-center ~/pictures/wallpaper/5120x1440/wallhaven-v9ydgl.jpg")) +(sb-ext:run-program *shell-program* '("-c" "feh --bg-center ~/pictures/wallpaper/5120x1440/Dragonfish-restaurant_by_David_Revoy.jpg")) (define-key *top-map* (kbd "s-.") "gnext") (define-key *top-map* (kbd "s-,") "gprev") diff --git a/oni/home/services/terminals.scm b/oni/home/services/terminals.scm new file mode 100644 index 0000000..7a86c60 --- /dev/null +++ b/oni/home/services/terminals.scm @@ -0,0 +1,40 @@ +(define-module (oni home services terminals) + #:use-module (gnu home services) + #:use-module (gnu packages terminals) + #:use-module (gnu services configuration) + #:use-module (guix gexp) + #:use-module (guix packages) + + #:export (home-wezterm-configuration + home-wezterm-service-type)) + +(define-configuration home-wezterm-configuration + (package + (package wezterm) + "Package to use for setting wezterm") + (configurations + (text-config '()) + "The rest of the configurations")) + +(define (add-wezterm-packages config) + (list (home-wezterm-configuration-package config))) + +(define (home-wezterm-config-files config) + `(("wezterm/wezterm.lua" + ,(mixed-text-file + "config" + (serialize-text-config config (home-wezterm-configuration-configurations config)))))) + +(define home-wezterm-service-type + (service-type + (name 'home-wezterm) + (extensions + (list (service-extension + home-profile-service-type + add-wezterm-packages) + (service-extension + home-xdg-configuration-files-service-type + home-wezterm-config-files))) + (compose identity) + (default-value (home-wezterm-configuration)) + (description "Install and configure wezterm."))) diff --git a/oni/home/services/zsh.scm b/oni/home/services/zsh.scm index aa2eb60..582c4dc 100644 --- a/oni/home/services/zsh.scm +++ b/oni/home/services/zsh.scm @@ -1,13 +1,13 @@ (define-module (oni home services zsh) #:use-module (ice-9 string-fun) #:use-module (gnu services configuration) + #:use-module (gnu packages rust-apps) #:use-module (gnu packages shellutils) #:use-module (gnu home services) #:use-module (gnu home services shells) #:use-module (gnu home services utils) #:use-module (guix packages) #:use-module (guix gexp) - #:use-module (rosenthal packages rust-apps) #:use-module (oni packages zsh) #:export (home-zsh-autosuggestions-service-type diff --git a/oni/packages/emacs-config.scm b/oni/packages/emacs-config.scm index 6794a62..fd1bbd4 100644 --- a/oni/packages/emacs-config.scm +++ b/oni/packages/emacs-config.scm @@ -38,7 +38,7 @@ (define-public emacs-oni-config (let - ((commit "b3b63e7322acd6fe373454bf5c8a41a97f000938") + ((commit "09a4099586657170cbdcff071b2d0fac5ed133b7") (revision "0")) (package (name "emacs-oni-config") (version (git-version "0.0.1" revision commit)) @@ -52,7 +52,7 @@ (file-name (git-file-name name version)) (sha256 (base32 - "0nj8gyzvajza2bsq20a2k1hljsmqw6a18l6bakff4d8l0wbmamzn")))) + "1lhn76r08b2zin45xjpzq60am8jw445s73b0yl4cdq107g0cbk0i")))) (build-system emacs-build-system) (home-page "https://code.ryuslash.org/emacs-config/") (synopsis "My Emacs configuration") @@ -311,7 +311,11 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-yasnippet") (arguments - '(#:include '("oni-yasnippet.el"))) + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir-oni-yasnippet + (λ _ (chdir "oni-yasnippet")))) + #:include '("\\.el$" "^snippets\\/"))) (propagated-inputs `(("emacs-yasnippet" ,emacs-yasnippet) ("emacs-diminish" ,emacs-diminish))) @@ -323,15 +327,10 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-bats") (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-bats - (λ _ (chdir "oni-bats")))) - #:include '("\\.el$" "^snippets\\/bats-mode\\/"))) + '(#:include '("\\.el$"))) (propagated-inputs `(("emacs-bats" ,emacs-bats) ("emacs-oni-sh" ,emacs-oni-sh) - ("emacs-oni-yasnippet" ,emacs-oni-yasnippet) ("bats" ,bats))) (synopsis "My Emacs Bats coding configuration") (description "This package provides my configuration for coding in Bats"))) @@ -346,15 +345,13 @@ Emacs"))) (add-after 'unpack 'chdir-oni-org (λ _ (chdir "oni-org")))) #:include '("\\.el$" - "^snippets\\/org-mode\\/" "^capture-templates\\/" "^icons\\/") ;; The default #:emacs (emacs-minimal) doesn't include `range.el' and ;; throws an error while trying to byte-compile oni-org. #:emacs ,emacs)) (propagated-inputs - (list emacs-oni-yasnippet - emacs-oni-hydra + (list emacs-oni-hydra my-emacs-org-roam emacs-org emacs-org-contrib @@ -429,14 +426,9 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-python") (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-python - (λ _ (chdir "oni-python")))) - #:include '("\\.el$" "^snippets\\/python-mode\\/"))) + '(#:include '("oni-python\\.el$"))) (propagated-inputs - (list emacs-oni-yasnippet - emacs-oni-company + (list emacs-oni-company emacs-oni-flycheck emacs-oni-hydra emacs-oni-lsp @@ -521,14 +513,7 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-conf") (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-conf - (λ _ (chdir "oni-conf")))) - #:include '("\\.el$" - "^snippets\\/conf-mode\\/"))) - (propagated-inputs - `(("emacs-oni-yasnippet" ,emacs-oni-yasnippet))) + '(#:include '("oni-conf\\.el$"))) (synopsis "My Emacs Conf mode configuration") (description "This pakcage provides my configuation for Conf mode"))) @@ -562,16 +547,11 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-csharp") (arguments - '(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-csharp - (λ _ (chdir "oni-csharp")))) - #:include '("\\.el$" "^snippets\\/"))) + '(#:include '("oni-csharp\\.el$"))) (propagated-inputs `(("emacs-csharp-mode" ,emacs-csharp-mode) ("emacs-oni-company" ,emacs-oni-company) ("emacs-oni-flycheck" ,emacs-oni-flycheck) - ("emacs-oni-yasnippet" ,emacs-oni-yasnippet) ("emacs-oni-hydra" ,emacs-oni-hydra) ("emacs-oni-lsp" ,emacs-oni-lsp) ("emacs-oni-smartparens" ,emacs-oni-smartparens))) @@ -583,16 +563,11 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-css") (arguments - '(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-css - (λ _ (chdir "oni-css")))) - #:include '("\\.el$" "^snippets\\/"))) + '(#:include '("oni-css\\.el$"))) (propagated-inputs `(("emacs-oni-company" ,emacs-oni-company) ("emacs-oni-hydra" ,emacs-oni-hydra) - ("emacs-rainbow-mode" ,emacs-rainbow-mode) - ("emacs-oni-yasnippet" ,emacs-oni-yasnippet))) + ("emacs-rainbow-mode" ,emacs-rainbow-mode))) (synopsis "My Emacs CSS configuration") (description "This package provides my configuration for writing CSS."))) @@ -612,16 +587,11 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-elisp") (arguments - '(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-elisp - (λ _ (chdir "oni-elisp")))) - #:include '("\\.el$" "^snippets\\/"))) + '(#:include '("oni-elisp\\.el$"))) (propagated-inputs `(("emacs-oni-company" ,emacs-oni-company) ("emacs-oni-flycheck" ,emacs-oni-flycheck) ("emacs-oni-paredit" ,emacs-oni-paredit) - ("emacs-oni-yasnippet" ,emacs-oni-yasnippet) ("emacs-oni-hydra" ,emacs-oni-hydra) ("emacs-rainbow-delimiters" ,emacs-rainbow-delimiters) ("emacs-nameless" ,emacs-nameless) @@ -678,7 +648,6 @@ Emacs"))) (propagated-inputs (list emacs-hy-mode emacs-oni-paredit - emacs-oni-yasnippet emacs-rainbow-delimiters)) (synopsis "My Hy configuration") (description "This package provides my configuration for Hy."))) @@ -741,7 +710,7 @@ Emacs"))) (arguments '(#:include '("oni-epub\\.el$"))) (propagated-inputs - (list emacs-nov-el)) + (list emacs-nov)) (synopsis "My configuration for reading ePub files") (description "This package provides my configuration for reading ePub files."))) @@ -795,13 +764,7 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-html") (arguments - '(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-html - (λ _ (chdir "oni-html")))) - #:include '("\\.el$" "^snippets\\/"))) - (propagated-inputs - (list emacs-oni-yasnippet)) + '(#:include '("oni-html\\.el$"))) (synopsis "My HTML configuration") (description "This package provides my configuration for HTML."))) @@ -865,14 +828,9 @@ Emacs"))) (inherit emacs-oni-config) (name "emacs-oni-nxml") (arguments - '(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir-oni-nxml - (λ _ (chdir "oni-nxml")))) - #:include '("\\.el$" "^snippets\\/"))) + '(#:include '("oni-nxml\\.el$"))) (propagated-inputs - (list emacs-oni-yasnippet - emacs-reformatter)) + (list emacs-reformatter)) (synopsis "My XML configuration") (description "This package provides my configuration for writing XML."))) @@ -970,12 +928,11 @@ Emacs"))) (modify-phases %standard-phases (add-after 'unpack 'chdir-oni-php (λ _ (chdir "oni-php")))) - #:include '("\\.el$" "^snippets\\/" "^scripts\\/"))) + #:include '("\\.el$" "^scripts\\/"))) (propagated-inputs (list emacs-php-mode - emacs-oni-yasnippet emacs-oni-flycheck - emacs-oni-company + emacs-oni-corfu emacs-oni-hydra emacs-ggtags emacs-fic-mode @@ -1053,3 +1010,29 @@ Emacs"))) (list emacs-logview)) (description "This package provides my configuration for logview mode."))) + +(define-public emacs-oni-dumb-jump + (package + (inherit emacs-oni-config) + (name "emacs-oni-dumb-jump") + (arguments + '(#:include '("oni-dumb-jump\\.el$"))) + (synopsis "My configuration for dumb-jump") + (propagated-inputs + (list emacs-dumb-jump)) + (description + "This package provides my configuration for dumb-jump"))) + +(define-public emacs-oni-corfu + (package + (inherit emacs-oni-config) + (name "emacs-oni-corfu") + (arguments + '(#:include '("oni-corfu\\.el$"))) + (synopsis "My configuration for corfu") + (propagated-inputs + (list emacs-corfu + emacs-cape + emacs-oni-prescient)) + (description + "This package provides my configuration for corfu."))) diff --git a/oni/packages/emacs.scm b/oni/packages/emacs.scm index 105a855..5629998 100644 --- a/oni/packages/emacs.scm +++ b/oni/packages/emacs.scm @@ -610,7 +610,7 @@ dot-separated path form like @code{jobs.build.docker} and (license license:gpl3)))) (define-public emacs-yoshi-theme - (let ((commit "6e436a34cc56a73eec49f8d5f8fbcfcaa5cae808") + (let ((commit "dc7b512dbe29db8f61f1485dad4213f5c5fd2669") (revision "0")) (package (name "emacs-yoshi-theme") @@ -623,7 +623,7 @@ dot-separated path form like @code{jobs.build.docker} and (method git-fetch) (file-name (git-file-name name version)) (sha256 - (base32 "1xidzl08sf2hndd7jazc1f5b9gwnbasq7p5901bbbnr898b7r407")))) + (base32 "0qjcqrj1k8mlkjlahjn83l7hq76dmjvn1n9xnj0rz3drk114wxb0")))) (build-system emacs-build-system) (arguments `(#:include '("icons/*" . ,%default-include))) @@ -843,7 +843,7 @@ flycheck-phpstan) (flycheck-mode t)) (add-hook php-mode-hook my-php-mode-setup). (license #f))) (define-public emacs-org-mem - (let ((commit "0a33650ccb79c9bd49d7598fbb8f09beb2153350") + (let ((commit "07094dac902e452d59533e4d01e8177afaa0cfd1") (revision "0")) (package (name "emacs-org-mem") @@ -856,9 +856,12 @@ flycheck-phpstan) (flycheck-mode t)) (add-hook php-mode-hook my-php-mode-setup). (commit commit))) (file-name (git-file-name name version)) (sha256 - (base32 "0jrisa0w6khiv2mndhyrr0yjsg191yix4gpj2g57nvp80l3xbnbl")))) + (base32 "09c2s9yz3288g0z66wxqhhk7nwwqri7wgprk3k9h41l0l2hswssc")))) (build-system emacs-build-system) - (propagated-inputs (list emacs-el-job emacs-emacsql emacs-llama)) + (propagated-inputs (list emacs-el-job + emacs-emacsql + emacs-llama + emacs-truename-cache)) (home-page "https://github.com/meedstrom/org-node") (synopsis "Cache metadata on all Org files") (description @@ -1019,3 +1022,82 @@ enabled.") (synopsis "Emacs major mode for Vue based on Tree-sitter") (description "Emacs major mode for Vue based on Tree-sitter") (license license:gpl3+)))) + +(define-public emacs-stillness-mode + (package + (name "emacs-stillness-mode") + (version "20250307.1608") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/neeasade/stillness-mode.el") + (commit "05029febdb451941ed218e6ddbef5294776e31d4"))) + (file-name (git-file-name name version)) + (sha256 + (base32 "06gj5fjjq922fafn2wi8i0c6sx3s95zi17crmgv2dy0k1f4ljvkz")))) + (build-system emacs-build-system) + (propagated-inputs (list emacs-dash)) + (home-page "https://github.com/neeasade/stillness-mode.el") + (synopsis "Prevent windows from jumping on minibuffer activation") + (description + "stillness-mode is a minor mode that prevents Emacs from scrolling the main +editing window when a multi-line minibuffer appears. It automatically adjusts +point just enough so that Emacs doesn't force a jump in the visible buffer.") + (license license:expat))) + +(define-public emacs-related-files + (package + (name "emacs-related-files") + (version "20230903.851") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/DamienCassou/related-files") + (commit "8020f375013d5e83c9b8117d118d2402c63e66bb"))) + (file-name (git-file-name name version)) + (sha256 + (base32 "09czvj7rcvcb8h6fh6f2i1fiwk0ghg7n0lx1xppnf9yvwpdxld1s")))) + (build-system emacs-build-system) + (arguments + '(#:tests? #f)) + (home-page "https://www.gnu.org/software/emacs/") + (synopsis "Easily find files related to the current one") + (description + "Thousands times a day you want to jump from a file to its test file (or to its +CSS file, or to its header file, or any other related file) and just as many +times you want to go back to the initial file. Jumping to related files is what +this package is about. The question is: how does a user specify that a file is +related to a set of other files? One way is to create a function that takes a +file as argument and returns a list of related filenames: (defun +my/related-files-jumper (file) (let ((without-ext (file-name-sans-extension +file))) (list (concat without-ext \".js\") (concat without-ext \".css\")))) (setq +related-files-jumpers (list #'my/related-files-jumper)) `my/related-files-jumper +is called a jumper. With this setup, `related-files-jump will let the user jump +from Foo.js to Foo.css and back. This is working good but has several +limitations: 1. If Foo.css is not in the same directory as Foo.js or if you +want to include test files which end with \"-tests.js\", `my/related-files-jumper +has to be modified in a non-obvious way or a complicated new jumper must be +written and added to `related-files-jumpers'; 2. The function +`my/related-files-jumper has to be shared with all Emacs users working on the +same project So related-files recommends another approach that is less powerful +but much simpler. Here is another way to define the same jumper: (recipe +:remove-suffix \".js\" :add-suffix \".css\") This list must replace +`my/related-files-jumper in `related-files-jumpers'. This jumper lets the user +go from Foo.js to Foo.css. related-files will automatically inverse the meaning +of :remove-suffix and :add-suffix arguments so the user can also go from Foo.css +to Foo.js with this jumper. See `related-files-jumpers and THE MANUAL (TODO) +for more information. This kind of jumper can easily be shared with the members +of a team through a .dir-locals.el file. See (info \"(Emacs) Directory +Variables\"). `related-files-make also makes it easy to create a related file and +fill it with some content. If the content is always the same, a string can be +used to specify it: (recipe :remove-suffix \".js\" :add-suffix \".css\" :filler +\"Fill the CSS file\") There is also an `auto-insert'-based way to fill new files +and new kinds of fillers can easily be implemented. See the manual for more +information. If you want to add a new kind of jump, override +`related-files-apply and optionally `related-files-get-filler', call +`related-files-add-jumper-type and add a function to +`related-files-jumper-safety-functions'. If you want to add a new kind of +filler, override `related-files-fill and call `related-files-add-filler-type'.") + (license license:gpl3+))) diff --git a/oni/packages/utilities.scm b/oni/packages/utilities.scm index 9b2cafa..d4d6633 100644 --- a/oni/packages/utilities.scm +++ b/oni/packages/utilities.scm @@ -24,7 +24,7 @@ (base32 "1w35wqw9y77gcx7rcc74b0f7n0vjk4yh8xicjkfc5by5vzffrhc6")) (file-name (git-file-name name version)))) (propagated-inputs - (list guile-3.0 guile-inkplate)) + (list guile-3.0-latest guile-inkplate)) (build-system gnu-build-system) (arguments `(#:tests? #f diff --git a/wezterm/.config/wezterm/wezterm.fnl b/wezterm/.config/wezterm/wezterm.fnl new file mode 100644 index 0000000..fcf6ac3 --- /dev/null +++ b/wezterm/.config/wezterm/wezterm.fnl @@ -0,0 +1,73 @@ +(local wezterm (require :wezterm)) + +(local colors { :foreground "#bfbfbf" + :background "#222424" }) + +(local open-url-key + { :key "E" + :mods "CTRL|SHIFT" + :action (wezterm.action.QuickSelectArgs + { :label "open url" + :patterns [ "https?://[[:alnum:]./-]+[[:alnum:]/]" ] + :action (wezterm.action_callback + (fn [window pane] + (let [url (window:get_selection_text_for_pane pane)] + (wezterm.log_info (.. "opening: " url)) + (wezterm.open_with url)))) }) }) + +(local copy-guix-hash-key + { :key "G" + :mods "LEADER" + :action (wezterm.action.QuickSelectArgs + { :label "copy hash" + :patterns [ "[a-z0-9]{52}" ] + :action (wezterm.action_callback + (fn [window pane] + (let [text (window:get_selection_text_for_pane pane)] + (wezterm.log_info (.. "copying: " text)) + (window:copy_to_clipboard text)))) }) }) +(local keys + [ open-url-key + copy-guix-hash-key + { :key "o" :mods "ALT" :action wezterm.action.PaneSelect } + { :key "p" :mods "ALT" :action (wezterm.action.ScrollToPrompt -1) } + { :key "n" :mods "ALT" :action (wezterm.action.ScrollToPrompt 1) } ]) + +(local inactive_pane_hsb + { :saturation 0.8 + :brightness 0.7 }) + +{ + ;; I use a tiling window manager, so the window size can't change when the font + ;; size changes. + :adjust_window_size_when_changing_font_size false + + :default_cursor_style "SteadyBar" + + :leader { :key "c" :mods "CTRL" :timeout_seconds 1000 } + + : colors + : keys + : inactive_pane_hsb + + ;; :command_palette_font (wezterm.font "Fantasque Sans Mono") + :command_palette_font_size 14 + :command_palette_bg_color "#111414" + :command_palette_fg_color "#bfbfbf" + :command_palette_rows 10 + + :font (wezterm.font "Fantasque Sans Mono") + :font_size 20 + + :hide_tab_bar_if_only_one_tab true + + :quick_select_alphabet "arstdhneio" + + ;; "INTEGRATED_BUTTONS|RESIZE" keeps the borders resizable and puts the + ;; Min/Max/Close buttons in the tab bar (modern look). + :window_decorations "INTEGRATED_BUTTONS|RESIZE" + + ;; Don't use the compose key in the terminal. + :send_composed_key_when_right_alt_is_pressed false + + } diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index c122e66..3459deb 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -1,58 +1,19 @@ -local wezterm = require 'wezterm' -local config = {} - -config.default_cursor_style = 'SteadyBar' - -config.colors = { - foreground = '#bfbfbf', - background = '#222424', -} - -config.keys = { - { - key = 'E', - mods = 'CTRL|SHIFT', - action = wezterm.action.QuickSelectArgs { - label = 'open url', - patterns = { - 'https?://[[:alnum:]./-]+[[:alnum:]/]', - }, - action = wezterm.action_callback(function(window, pane) - local url = window:get_selection_text_for_pane(pane) - wezterm.log_info('opening: ' .. url) - wezterm.open_with(url) - end), - }, - }, - { - key = 'G', - mods = 'CTRL|SHIFT', - action = wezterm.action.QuickSelectArgs { - label = 'copy hash', - patterns = { - '[a-z0-9]{52}', - }, - action = wezterm.action_callback(function(window, pane) - local text = window:get_selection_text_for_pane(pane) - wezterm.log_info('copying: ' .. text) - window:copy_to_clipboard(text) - end), - }, - }, - { - key = 'o', - mods = 'ALT', - action = wezterm.action.PaneSelect, - }, - { key = 'p', mods = 'ALT', action = wezterm.action.ScrollToPrompt(-1) }, - { key = 'n', mods = 'ALT', action = wezterm.action.ScrollToPrompt(1) }, -} - -config.color_scheme = 'Dracula' --- config.font_dirs = { "/home/tomwillemsen/.guix-home/profile/share/fonts/truetype" } -config.font = wezterm.font 'Fantasque Sans Mono' -config.font_size = 14 - -config.quick_select_alphabet = "arstdhneio" - -return config +local wezterm = require("wezterm") +local colors = {foreground = "#bfbfbf", background = "#222424"} +local open_url_key +local function _1_(window, pane) + local url = window:get_selection_text_for_pane(pane) + wezterm.log_info(("opening: " .. url)) + return wezterm.open_with(url) +end +open_url_key = {key = "E", mods = "CTRL|SHIFT", action = wezterm.action.QuickSelectArgs({label = "open url", patterns = {"https?://[[:alnum:]./-]+[[:alnum:]/]"}, action = wezterm.action_callback(_1_)})} +local copy_guix_hash_key +local function _2_(window, pane) + local text = window:get_selection_text_for_pane(pane) + wezterm.log_info(("copying: " .. text)) + return window:copy_to_clipboard(text) +end +copy_guix_hash_key = {key = "G", mods = "CTRL|SHIFT", action = wezterm.action.QuickSelectArgs({label = "copy hash", patterns = {"[a-z0-9]{52}"}, action = wezterm.action_callback(_2_)})} +local keys = {open_url_key, copy_guix_hash_key, {key = "o", mods = "ALT", action = wezterm.action.PaneSelect}, {key = "p", mods = "ALT", action = wezterm.action.ScrollToPrompt(-1)}, {key = "n", mods = "ALT", action = wezterm.action.ScrollToPrompt(1)}} +local inactive_pane_hsb = {saturation = 0.8, brightness = 0.7} +return {default_cursor_style = "SteadyBar", colors = colors, keys = keys, inactive_pane_hsb = inactive_pane_hsb, command_palette_font_size = 14, command_palette_bg_color = "#111414", command_palette_fg_color = "#bfbfbf", command_palette_rows = 10, font = wezterm.font("Fantasque Sans Mono"), font_size = 20, hide_tab_bar_if_only_one_tab = true, quick_select_alphabet = "arstdhneio", window_decorations = "INTEGRATED_BUTTONS|RESIZE", adjust_window_size_when_changing_font_size = false} diff --git a/zsh/.zsh/functions/settitle b/zsh/.zsh/functions/settitle new file mode 100644 index 0000000..6bc64d8 --- /dev/null +++ b/zsh/.zsh/functions/settitle @@ -0,0 +1,2 @@ +# -*- mode: sh; -*- +printf "\\e]0;$1\\a" diff --git a/zsh/zshrc.org b/zsh/zshrc.org index dcdc1cd..27af335 100644 --- a/zsh/zshrc.org +++ b/zsh/zshrc.org @@ -210,3 +210,13 @@ Autoload any ZSH function from =$HOME/.zsh/functions=. PROMPT='%T $(spwd) %B%(?.%F{2}.%F{1}[%?])>%b%f ' RPROMPT='${vcs_info_msg_0_}' #+end_src + +* Other configurations + +Other setups might also make ZSH files, these should all be loaded. + +#+begin_src sh + for f in ~/.config/zsh/conf.d/*.sh; do + source $f + done +#+end_src |
