Example tmux script for Rails
Public
10 Jan 08:41

#!/bin/bash
SESSION=$PWD

tmux -2 new-session -d -s $SESSION

# Create main window
tmux rename-window -t $SESSION:1 'Main'

# Open rails console in top right corner
tmux split-window -h
tmux select-pane -t 2
tmux send-keys "bin/rails c" C-m

# Open rails server in bottom right corner
tmux split-window -v
tmux select-pane -t 3
tmux send-keys "bin/rails s" C-m

# Select the main window and pane
tmux select-window -t $SESSION:1
tmux select-pane -t 1
tmux resize-pane -R 20

# Attach to the session
tmux -2 attach-session -t $SESSION

Just cd into your project root and run the script. I keep it under ~/.bin/tmux-rails

Comments

Empty! You must sign in to add comments.