Compare commits

..

3 Commits

Author SHA1 Message Date
00ca94a9f3 Install: Add pdfarranger 2026-02-09 08:27:01 -08:00
8a1511f689 Install: Add beans 2026-02-09 08:26:53 -08:00
26b147b929 Install: Add worktrunk 2026-02-09 08:25:57 -08:00
10 changed files with 24 additions and 212 deletions

View File

@@ -181,3 +181,5 @@ fi
# ble.sh
# https://github.com/akinomyoga/ble.sh#13-set-up-bashrc
[[ ${BLE_VERSION-} ]] && ble-attach
if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init bash)"; fi

View File

@@ -1 +0,0 @@
complete -c dev-switch -f -a '(git worktree list --porcelain 2>/dev/null | string match "worktree *" | string replace "worktree " "" | while read -l p; basename $p; end)'

View File

@@ -0,0 +1,2 @@
# worktrunk completions for fish
complete --keep-order --exclusive --command wt --arguments "(test -n \"\$WORKTRUNK_BIN\"; or set -l WORKTRUNK_BIN (type -P wt 2>/dev/null); and COMPLETE=fish \$WORKTRUNK_BIN -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"

View File

@@ -1,52 +0,0 @@
function __dev_repo_name
# Use the main worktree (first entry) for consistent naming across worktrees
set -l lines (git worktree list --porcelain | string replace -rf "^worktree " "")
basename $lines[1]
end
function __dev_create_session -a session dir
if test -z "$dir"
set dir (pwd)
end
if not tmux has-session -t "$session" 2>/dev/null
# Unset any devbox environment variables so they can be re-sourced
# in the new directory.
set -l shell env
for var in (set --names --export | string match 'DEVBOX_*')
set -a shell -u $var
end
set -a shell (command -s fish) --login
tmux new-session -d -s "$session" -c "$dir" -n dev $shell
# Ensure that new panes in this session also start with the clean environment.
tmux set-option -t "$session" default-command (string join ' ' -- $shell)
set -l left (tmux display-message -t "$session:dev" -p '#{pane_id}')
tmux split-window -h -t "$left" -c "$dir" $shell
set -l right (tmux display-message -t "$session:dev" -p '#{pane_id}')
tmux split-window -v -t "$right" -c "$dir" $shell
set -l bottom_right (tmux display-message -t "$session:dev" -p '#{pane_id}')
tmux send-keys -t "$left" 'vim' Enter
tmux send-keys -t "$right" 'claude' Enter
tmux select-pane -t "$bottom_right"
end
end
function __dev_attach_session -a session
if test -z "$TMUX"
tmux attach-session -t "$session"
else
set -l current_session (tmux display-message -p '#S')
if test "$current_session" != "$session"
tmux switch-client -t "$session"
end
end
end
function __dev_wt_session_name -a repo branch
set -l name "$repo-"(string replace -a '/' '-' -- $branch | string replace -a '\\' '-')
string replace -a '.' '-' -- $name
end

View File

@@ -7,7 +7,6 @@
#
set AUTOENV_AUTH_FILE ~/.autoenv_authorized
set AUTOENV_TRUSTED_FILE ~/.autoenv_trusted
if [ -z "$AUTOENV_ENV_FILENAME" ]
set AUTOENV_ENV_FILENAME ".env"
end
@@ -78,27 +77,6 @@ function autoenv_hashline
echo "$envfile:$hash"
end
function autoenv_content_hash
set envfile $argv[1]
shasum "$envfile" | cut -d' ' -f 1
end
function autoenv_check_trusted
set envfile $argv[1]
set hash (autoenv_content_hash "$envfile")
touch $AUTOENV_TRUSTED_FILE
grep -Fxq "$hash" $AUTOENV_TRUSTED_FILE
end
function autoenv_trust_env
set envfile $argv[1]
set hash (autoenv_content_hash "$envfile")
touch $AUTOENV_TRUSTED_FILE
if not grep -Fxq "$hash" $AUTOENV_TRUSTED_FILE
echo "$hash" >>$AUTOENV_TRUSTED_FILE
end
end
function autoenv_check_authz
# typeset envfile hash
set envfile $argv[1]
@@ -109,7 +87,7 @@ end
function autoenv_check_authz_and_run
set envfile $argv[1]
if autoenv_check_authz "$envfile"; or autoenv_check_trusted "$envfile"
if autoenv_check_authz "$envfile"
autoenv_source "$envfile"
return 0
end
@@ -122,16 +100,11 @@ function autoenv_check_authz_and_run
autoenv_indent "$envfile"
autoenv_env " --- (end contents) -----------------------------------------"
autoenv_env
autoenv_printf "Are you sure you want to allow this? (y/t/N) \n"
autoenv_env " y - approve for this path only"
autoenv_env " t - trust these contents everywhere"
autoenv_printf "Are you sure you want to allow this? (y/N) \n"
read answer
if [ "$answer" = y -o "$answer" = Y ]
if [ $answer = y -o $answer = Y ]
autoenv_authorize_env "$envfile"
autoenv_source "$envfile"
else if [ "$answer" = t -o "$answer" = T ]
autoenv_trust_env "$envfile"
autoenv_source "$envfile"
end
end
end
@@ -158,7 +131,3 @@ function autoenv_source
#set -e AUTOENV_CUR_FILE
#set -e AUTOENV_CUR_DIR
end
# Run once on shell startup so .env files are sourced in the initial
# working directory (PWD is already set, so --on-variable PWD won't fire).
autoenv_init

View File

@@ -1,74 +0,0 @@
function dev-wt -d "Switch to a tmux dev session for a worktree, creating it if needed" -a name
set -l repo (__dev_repo_name 2>/dev/null)
if test -z "$repo"
echo "Not in a git repository"
return 1
end
# Default to current branch when no argument given
if test -z "$name"
set name (git branch --show-current 2>/dev/null)
if test -z "$name"
echo "Usage: dev-wt [worktree-name]"
return 1
end
end
set -l wt_path ""
set -l wt_branch ""
# Search for worktree by directory basename or branch name
set -l current_path ""
set -l current_branch ""
for line in (git worktree list --porcelain)
if string match -q "worktree *" -- $line
set current_path (string replace "worktree " "" -- $line)
set current_branch ""
else if string match -q "branch *" -- $line
set current_branch (string replace "branch refs/heads/" "" -- $line)
if test (basename "$current_path") = "$name"; or test "$current_branch" = "$name"
set wt_path $current_path
set wt_branch $current_branch
break
end
end
end
# If worktree not found, create it
if test -z "$wt_path"
set -l main_wt_path (git worktree list --porcelain | head -1 | string replace "worktree " "")
set -l parent_dir (dirname "$main_wt_path")
set wt_path "$parent_dir/$repo-$name"
set wt_branch "$name"
if test -d "$wt_path"
echo "Error: directory already exists: $wt_path"
return 1
end
# Create branch from main if it doesn't exist
if not git rev-parse --verify "$wt_branch" >/dev/null 2>&1
echo "Creating branch '$wt_branch' from main..."
git branch "$wt_branch" main
end
echo "Creating worktree at $wt_path..."
git worktree add "$wt_path" "$wt_branch"
# Run repo-specific setup hook if present
set -l setup_hook "$main_wt_path/.worktree-setup.sh"
if test -x "$setup_hook"
echo "Running worktree setup hook..."
bash "$setup_hook" "$wt_path" "$main_wt_path" "$wt_branch"
end
end
if test -z "$wt_branch"
echo "Worktree '$name' has no branch (detached HEAD)"
return 1
end
set -l session (__dev_wt_session_name $repo $wt_branch)
__dev_create_session $session $wt_path
__dev_attach_session $session
end

View File

@@ -1,5 +0,0 @@
function dev -d "Create and attach to a tmux dev session for the current directory"
set -l session (basename (pwd) | string replace -a '.' '-')
__dev_create_session $session
__dev_attach_session $session
end

View File

@@ -1,45 +0,0 @@
function __create_session
set session "process-compose"
set dir "/home/tgrosinger/obsidian"
if not tmux has-session -t "$session" 2>/dev/null
# Unset any devbox environment variables so they can be re-sourced
# in the new directory.
set -l shell env
for var in (set --names --export | string match 'DEVBOX_*')
set -a shell -u $var
end
set -a shell (command -s fish) --login
tmux new-session -d -s "$session" -c "$dir" -n dev $shell
# Ensure that new panes in this session also start with the clean environment.
tmux set-option -t "$session" default-command (string join ' ' -- $shell)
set -l left (tmux display-message -t "$session:dev" -p '#{pane_id}')
tmux split-window -h -t "$left" -c "$dir" $shell
set -l right (tmux display-message -t "$session:dev" -p '#{pane_id}')
tmux send-keys -t "$left" 'devbox services attach' Enter
tmux select-pane -t "$right"
end
end
function __attach_session
set session "process-compose"
if test -z "$TMUX"
tmux attach-session -t "$session"
else
set -l current_session (tmux display-message -p '#S')
if test "$current_session" != "$session"
tmux switch-client -t "$session"
end
end
end
function pc -d "Create and attach to a tmux session for process compose in Obsidian"
__create_session
__attach_session
end

View File

@@ -0,0 +1,15 @@
# worktrunk shell integration for fish
# Sources full integration from binary on first use.
# Docs: https://worktrunk.dev/config/#shell-integration
# Check: wt config show | Uninstall: wt config shell uninstall
function wt
command wt config shell init fish | source
# Check both command exit code ($pipestatus[1]) and source exit code ($pipestatus[2])
# If source fails, the function isn't replaced and we'd infinite-loop calling ourselves
set -l wt_status $pipestatus[1]
set -l source_status $pipestatus[2]
test $wt_status -eq 0; or return $wt_status
test $source_status -eq 0; or return $source_status
wt $argv
end

View File

@@ -28,7 +28,8 @@ brew install \
restic \
ripgrep \
stow \
tmux
tmux \
worktrunk
#crane \
#deno \
#go \