Skip to content

Instantly share code, notes, and snippets.

View ItzaMi's full-sized avatar
🎧

Rui Sousa ItzaMi

🎧
View GitHub Profile
@ItzaMi
ItzaMi / tmux-add-right.sh
Created April 14, 2026 12:00
runtime / live-edit for tmux panes - on exiting session, ask for one more pane and it sorts out a reasonable spot for it
#!/bin/bash
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
panes=$(tmux list-panes | wc -l | tr -d ' ')
if [ "$panes" -eq 1 ]; then
tmux split-window -h -l 33% -c "#{pane_current_path}"
else
target=$(tmux list-panes -F '#{pane_id} #{pane_left} #{pane_top}' \
| sort -k2,2nr -k3,3nr | head -1 | awk '{print $1}')