From ee9ad10b5cc9850c3e2ed1946f70e0cef429fb48 Mon Sep 17 00:00:00 2001 From: Hunt Date: Tue, 3 Jun 2025 11:58:25 -0700 Subject: Refactor --- dots/git/.gitconfig.j2 | 2 +- dots/gpg/.gnupg/gpg-agent.conf | 2 -- dots/gpg/.gnupg/gpg-agent.conf.j2 | 2 ++ dots/gpg/.pubkey.j2 | 1 + dots/home/.local/bin/.gitkeep | 0 dots/home/.pubkey.j2 | 1 - dots/home/scripts/pinentry.sh | 20 -------------------- dots/home/scripts/pinentry.sh.j2 | 16 ++++++++++++++++ dots/zed/.config/zed/keymap.json | 2 +- dots/zsh/.config/zsh/.zshrc | 18 +++++++++++++----- dots/zsh/.config/zsh/linux/init.zsh | 6 ------ dots/zsh/.config/zsh/linux/linux.init.zsh | 1 + dots/zsh/.config/zsh/osx/armin.zsh | 2 -- dots/zsh/.config/zsh/osx/init.zsh | 13 ------------- dots/zsh/.config/zsh/osx/osx.init.zsh | 9 +++++++++ dots/zsh/.config/zsh/osx/work.zsh | 7 ------- dots/zsh/.config/zsh/setup/device.zsh | 10 +++++----- dots/zsh/.config/zsh/setup/env.zsh.j2 | 17 +++++++++++++++++ dots/zsh/.config/zsh/setup/gpg.zsh.j2 | 7 ++----- dots/zsh/.config/zsh/setup/keybinds.zsh | 11 +++++++++++ dots/zsh/.config/zsh/setup/misc.zsh | 11 ----------- 21 files changed, 79 insertions(+), 79 deletions(-) delete mode 100755 dots/gpg/.gnupg/gpg-agent.conf create mode 100755 dots/gpg/.gnupg/gpg-agent.conf.j2 create mode 100644 dots/gpg/.pubkey.j2 create mode 100644 dots/home/.local/bin/.gitkeep delete mode 100644 dots/home/.pubkey.j2 delete mode 100755 dots/home/scripts/pinentry.sh create mode 100755 dots/home/scripts/pinentry.sh.j2 delete mode 100755 dots/zsh/.config/zsh/linux/init.zsh create mode 100755 dots/zsh/.config/zsh/linux/linux.init.zsh delete mode 100755 dots/zsh/.config/zsh/osx/init.zsh create mode 100755 dots/zsh/.config/zsh/osx/osx.init.zsh create mode 100644 dots/zsh/.config/zsh/setup/env.zsh.j2 create mode 100755 dots/zsh/.config/zsh/setup/keybinds.zsh delete mode 100755 dots/zsh/.config/zsh/setup/misc.zsh (limited to 'dots') diff --git a/dots/git/.gitconfig.j2 b/dots/git/.gitconfig.j2 index 015ad96..dc8d3e3 100644 --- a/dots/git/.gitconfig.j2 +++ b/dots/git/.gitconfig.j2 @@ -1,7 +1,7 @@ [user] signingkey = {{ pgp.signing }} user = {{ user.name }} - email = {{ user.email }} + email = {{ user.work_email if features.work_mode else user.email }} [commit] gpgsign = true [core] diff --git a/dots/gpg/.gnupg/gpg-agent.conf b/dots/gpg/.gnupg/gpg-agent.conf deleted file mode 100755 index 3578512..0000000 --- a/dots/gpg/.gnupg/gpg-agent.conf +++ /dev/null @@ -1,2 +0,0 @@ -pinentry-program /tmp/pinentry -enable-ssh-support diff --git a/dots/gpg/.gnupg/gpg-agent.conf.j2 b/dots/gpg/.gnupg/gpg-agent.conf.j2 new file mode 100755 index 0000000..7f1ed6a --- /dev/null +++ b/dots/gpg/.gnupg/gpg-agent.conf.j2 @@ -0,0 +1,2 @@ +pinentry-program {{ user.home }}/scripts/pinentry.sh +enable-ssh-support diff --git a/dots/gpg/.pubkey.j2 b/dots/gpg/.pubkey.j2 new file mode 100644 index 0000000..e4e3602 --- /dev/null +++ b/dots/gpg/.pubkey.j2 @@ -0,0 +1 @@ +{{ pgp.asc }} diff --git a/dots/home/.local/bin/.gitkeep b/dots/home/.local/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dots/home/.pubkey.j2 b/dots/home/.pubkey.j2 deleted file mode 100644 index e4e3602..0000000 --- a/dots/home/.pubkey.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ pgp.asc }} diff --git a/dots/home/scripts/pinentry.sh b/dots/home/scripts/pinentry.sh deleted file mode 100755 index f02ee6f..0000000 --- a/dots/home/scripts/pinentry.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -source log.sh "pinentry.sh" - -#-- -- -bin="${HOMEBREW_PREFIX:-"/usr"}/bin" -case "$PINENTRY_USER_DATA" in - *USE_TTY*) pe=$bin/pinentry-tty ;; - *USE_CURSES*) pe=$bin/pinentry-curses ;; - *USE_QT*) pe=$bin/pinentry-qt ;; - *USE_MAC*) pe=$bin/pinentry-mac ;; - *USE_GTK2*) pe=$bin/pinentry-gtk-2 ;; - *USE_GNOME3*) pe=$bin/pinentry-gnome3 ;; - *USE_X11*) pe=$bin/pinentry-x11 ;; -esac - -log DEBUG "$pe" - -exec $pe "$@" -#-- -- diff --git a/dots/home/scripts/pinentry.sh.j2 b/dots/home/scripts/pinentry.sh.j2 new file mode 100755 index 0000000..98352ac --- /dev/null +++ b/dots/home/scripts/pinentry.sh.j2 @@ -0,0 +1,16 @@ +#!/bin/bash + +#-- -- +bin="${HOMEBREW_PREFIX:-"/usr"}/bin" +case "$PINENTRY_USER_DATA" in + *USE_TTY*) pinentry=$bin/pinentry-tty ;; + *USE_CURSES*) pinentry=$bin/pinentry-curses ;; + *USE_QT*) pinentry=$bin/pinentry-qt ;; + *USE_MAC*) pinentry=$bin/pinentry-mac ;; + *USE_GTK2*) pinentry=$bin/pinentry-gtk-2 ;; + *USE_GNOME3*) pinentry=$bin/pinentry-gnome3 ;; + *USE_X11*) pinentry=$bin/pinentry-x11 ;; +esac + +exec $pinentry "$@" +#-- -- diff --git a/dots/zed/.config/zed/keymap.json b/dots/zed/.config/zed/keymap.json index 816b7c6..674412b 100644 --- a/dots/zed/.config/zed/keymap.json +++ b/dots/zed/.config/zed/keymap.json @@ -8,7 +8,7 @@ { "context": "Editor", "bindings": { - // "j k": ["workspace::SendKeystrokes", "escape"] + "ctrl-enter": "editor::AcceptEditPrediction" } } ] diff --git a/dots/zsh/.config/zsh/.zshrc b/dots/zsh/.config/zsh/.zshrc index bc445ae..e05eddf 100644 --- a/dots/zsh/.config/zsh/.zshrc +++ b/dots/zsh/.config/zsh/.zshrc @@ -3,15 +3,23 @@ #-- -- export XDG_CONFIG_HOME="$HOME/.config" export ZDOTDIR=${XDG_CONFIG_HOME:-$HOME/.config}/zsh -export PATH=$PATH:$HOME/scripts:$HOME/.local/bin +#-- -- + +#-- -- +. "$ZDOTDIR/setup/env.zsh" +#-- -- +#-- -- source log.sh ".zshrc" +#-- -- + +#-- -- greet.sh -#-- -- +#-- -- -#-- -- -. "$ZDOTDIR/setup/misc.zsh" -#-- -- +#-- -- +. "$ZDOTDIR/setup/keybinds.zsh" +#-- -- #-- -- . "$ZDOTDIR/setup/aliases.zsh" diff --git a/dots/zsh/.config/zsh/linux/init.zsh b/dots/zsh/.config/zsh/linux/init.zsh deleted file mode 100755 index 49db77e..0000000 --- a/dots/zsh/.config/zsh/linux/init.zsh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/zsh - -#-- -- -export PINENTRY_USER_DATA="PINENTRY_USE_QT" -#-- -- - diff --git a/dots/zsh/.config/zsh/linux/linux.init.zsh b/dots/zsh/.config/zsh/linux/linux.init.zsh new file mode 100755 index 0000000..f7df9c2 --- /dev/null +++ b/dots/zsh/.config/zsh/linux/linux.init.zsh @@ -0,0 +1 @@ +#!/bin/zsh diff --git a/dots/zsh/.config/zsh/osx/armin.zsh b/dots/zsh/.config/zsh/osx/armin.zsh index cc54a2e..f7df9c2 100755 --- a/dots/zsh/.config/zsh/osx/armin.zsh +++ b/dots/zsh/.config/zsh/osx/armin.zsh @@ -1,3 +1 @@ #!/bin/zsh - - diff --git a/dots/zsh/.config/zsh/osx/init.zsh b/dots/zsh/.config/zsh/osx/init.zsh deleted file mode 100755 index 0cb288d..0000000 --- a/dots/zsh/.config/zsh/osx/init.zsh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/zsh - -#-- -- -# HOMEBREW_PREFIX, MANPATH, INFOPATH, etc. -eval "$(/opt/homebrew/bin/brew shellenv)" - -# use gnu coreutils -export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" -#-- -- - -#-- -- -export PINENTRY_USER_DATA="PINENTRY_USE_MAC" -#-- -- diff --git a/dots/zsh/.config/zsh/osx/osx.init.zsh b/dots/zsh/.config/zsh/osx/osx.init.zsh new file mode 100755 index 0000000..f60c2bc --- /dev/null +++ b/dots/zsh/.config/zsh/osx/osx.init.zsh @@ -0,0 +1,9 @@ +#!/bin/zsh + +#-- -- +# HOMEBREW_PREFIX, MANPATH, INFOPATH, etc. +eval "$(/opt/homebrew/bin/brew shellenv)" + +# use gnu coreutils +export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" +#-- -- diff --git a/dots/zsh/.config/zsh/osx/work.zsh b/dots/zsh/.config/zsh/osx/work.zsh index 6fff676..19b9bcd 100755 --- a/dots/zsh/.config/zsh/osx/work.zsh +++ b/dots/zsh/.config/zsh/osx/work.zsh @@ -1,13 +1,7 @@ #!/bin/zsh #-- -- -export AWS_REGION=us-west-2 - -# finch -export DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock - # bb ... -export PATH="$PATH:$HOME/.toolbox/bin" alias bb='brazil-build' alias bba='brazil-build apollo-pkg' alias bre='brazil-runtime-exec' @@ -26,4 +20,3 @@ alias brazil-recursive-cmd='brazil-recursive-cmd-parallel' # run java repl with class path of package! :D alias jshell='jshell --class-path "`brazil-path build.classpath`:`brazil-path run.classpath`"' #-- -- - diff --git a/dots/zsh/.config/zsh/setup/device.zsh b/dots/zsh/.config/zsh/setup/device.zsh index d3f8c4b..cd7965e 100755 --- a/dots/zsh/.config/zsh/setup/device.zsh +++ b/dots/zsh/.config/zsh/setup/device.zsh @@ -5,23 +5,23 @@ source log.sh "setup/device.zsh" #-- -- platform="$(platform.sh)" platform_setup="$ZDOTDIR/$platform" -init_platform="$platform_setup/init.zsh" +init_platform="$platform_setup/$platform.init.zsh" if [ ! -d "$platform_setup" ]; then log ERROR "misconfigured platform $platform: $platform_setup is not a directory" exit 1 fi -if [ -e "$init_platform" ]; then +if [ -e "$init_platform" ]; then log DEBUG "executing $init_platform" . "$init_platform" -else +else log DEBUG "no platform-specific init for $platform at $init_platform" fi #-- -- #-- -- machine="$(system_name.sh)" -machine_init="$platform_setup/$machine.zsh" -if [ -e "$machine_init" ]; then +machine_init="$platform_setup/$machine.zsh" +if [ -e "$machine_init" ]; then log DEBUG "executing $platform.$machine $machine_init" . "$machine_init" else diff --git a/dots/zsh/.config/zsh/setup/env.zsh.j2 b/dots/zsh/.config/zsh/setup/env.zsh.j2 new file mode 100644 index 0000000..194e20e --- /dev/null +++ b/dots/zsh/.config/zsh/setup/env.zsh.j2 @@ -0,0 +1,17 @@ +#!/bin/zsh + +#-- -- +{% for key,val in env.items() %} +export {{ key }}={{ val }} +{% endfor %} +#-- -- + +#-- -- +# {{ paths.prefix.keys() | join(", ") }} +export PATH="{{ paths.prefix.values() | join(":") }}:$PATH" +#-- -- + +#-- -- +# {{ paths.suffix.keys() | join(", ") }} +export PATH="$PATH:{{ paths.suffix.values() | join(":") }}" +#-- -- diff --git a/dots/zsh/.config/zsh/setup/gpg.zsh.j2 b/dots/zsh/.config/zsh/setup/gpg.zsh.j2 index 4ffb38f..ea5a418 100755 --- a/dots/zsh/.config/zsh/setup/gpg.zsh.j2 +++ b/dots/zsh/.config/zsh/setup/gpg.zsh.j2 @@ -1,20 +1,17 @@ #!/bin/zsh - # -- -- KEY_ID="{{ pgp.id }}" gpg -k "$KEY_ID" >/dev/null 2>&1 || gpg --import "$HOME/.pubkey" -cp $HOME/scripts/pinentry.sh /tmp/pinentry - - export PINENTRY_USER_DATA="${PINENTRY_USER_DATA:-PINENTRY_USE_TTY}" if [ "$SSH_CLIENT" ]; then export PINENTRY_USER_DATA=PINENTRY_USE_CURSES exit 0 fi -# yubikey! +# yubikey ssh, gpg, and the works! +# https://github.com/drduh/YubiKey-Guide unset SSH_AGENT_PID export GPG_TTY=$(tty) export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) diff --git a/dots/zsh/.config/zsh/setup/keybinds.zsh b/dots/zsh/.config/zsh/setup/keybinds.zsh new file mode 100755 index 0000000..f301dcc --- /dev/null +++ b/dots/zsh/.config/zsh/setup/keybinds.zsh @@ -0,0 +1,11 @@ +#!/bin/zsh + +backward-kill-dir () { + local WORDCHARS=${WORDCHARS/\/} + zle backward-kill-word + zle -f kill +} +zle -N backward-kill-dir +bindkey '^[^?' backward-kill-dir + +bindkey \^K kill-line diff --git a/dots/zsh/.config/zsh/setup/misc.zsh b/dots/zsh/.config/zsh/setup/misc.zsh deleted file mode 100755 index f301dcc..0000000 --- a/dots/zsh/.config/zsh/setup/misc.zsh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/zsh - -backward-kill-dir () { - local WORDCHARS=${WORDCHARS/\/} - zle backward-kill-word - zle -f kill -} -zle -N backward-kill-dir -bindkey '^[^?' backward-kill-dir - -bindkey \^K kill-line -- cgit v1.2.3-70-g09d2