Add tds 4-way

This commit is contained in:
David Heinemeier Hansson
2026-05-11 18:21:45 +02:00
parent 1acaa7ba4d
commit 43ec46f699
+27
View File
@@ -34,6 +34,33 @@ tdl() {
tmux send-keys -t "$editor_pane" "$EDITOR ." C-m
# Select the nvim pane for focus
tmux select-pane -t "$opencode_pane"
}
# Create a Tmux Dev Square layout with editor, diff watch, terminal, and opencode
# Usage: tds
tds() {
[[ -n $1 ]] && { echo "Usage: tds"; return 1; }
[[ -z $TMUX ]] && { echo "You must start tmux to use tds."; return 1; }
local current_dir="${PWD}"
local editor_pane diff_pane terminal_pane opencode_pane
editor_pane="$TMUX_PANE"
tmux rename-window -t "$editor_pane" "$(basename "$current_dir")"
terminal_pane=$(tmux split-window -v -p 50 -t "$editor_pane" -c "$current_dir" -P -F '#{pane_id}')
diff_pane=$(tmux split-window -h -p 50 -t "$editor_pane" -c "$current_dir" -P -F '#{pane_id}')
opencode_pane=$(tmux split-window -h -p 50 -t "$terminal_pane" -c "$current_dir" -P -F '#{pane_id}')
tmux send-keys -t "$editor_pane" -l "nvim ."
tmux send-keys -t "$editor_pane" C-m
tmux send-keys -t "$diff_pane" -l "hunk diff --watch"
tmux send-keys -t "$diff_pane" C-m
tmux send-keys -t "$opencode_pane" -l "opencode"
tmux send-keys -t "$opencode_pane" C-m
tmux select-pane -t "$editor_pane"
}