From 43ec46f699b0f87dcfdfd15c9f293b40e1d38f8d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 11 May 2026 18:21:44 +0200 Subject: [PATCH] Add tds 4-way --- default/bash/fns/tmux | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/default/bash/fns/tmux b/default/bash/fns/tmux index 0144f2eb..de62c625 100644 --- a/default/bash/fns/tmux +++ b/default/bash/fns/tmux @@ -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" }