From 8b6e2466a3db74bfba5a03fe1b43cf349e51818d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 16 Feb 2026 10:33:56 +0100 Subject: [PATCH] Add the tmux dev layout --- default/bash/functions | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/default/bash/functions b/default/bash/functions index 14c17aa6..d7f6f2d4 100644 --- a/default/bash/functions +++ b/default/bash/functions @@ -108,3 +108,41 @@ dip() { lip() { pgrep -af "ssh.*-L [0-9]+:localhost:[0-9]+" || echo "No active forwards" } + +# Create a tmux layout for dev with editor, ai, and terminal +tml() { + local current_dir="${PWD}" + local editor_pane ai_pane + local ai="$1" + + # Get current pane ID (will become editor pane after splits) + editor_pane=$(tmux display-message -p '#{pane_id}') + + # Split window vertically - top 90%, bottom 10% + tmux split-window -v -p 10 -c "$current_dir" + + # Go back to top pane (editor_pane) and split it horizontally + tmux select-pane -t "$editor_pane" + tmux split-window -h -p 30 -c "$current_dir" + + # After horizontal split, cursor is in the right pane (new pane) + # Get its ID and run ai there + ai_pane=$(tmux display-message -p '#{pane_id}') + tmux send-keys -t "$ai_pane" "$ai" C-m + + # Run nvim in the left pane + tmux send-keys -t "$editor_pane" "$EDITOR ." C-m + + # Select the nvim pane for focus + tmux select-pane -t "$editor_pane" +} + +# Create a dev layout using tmux with editor, opencode, and terminal +nic() { + tml c +} + +# Create a dev layout using tmux with editor, claude, and terminal +nicx() { + tml cx +}