Chapter 3: Scripting Customized Environments
Chapter Overview
Topics covered:
-
Creating a Custom Setup with tmux Commands
-
Using tmux Configuration Files for Setup
-
Managing Configuration with tmuxinator
Key Concepts
Shell Script Approach
#!/bin/bash
# Example project setup script
SESSION="project"
tmux new-session -d -s $SESSION
# Window 1: Editor
tmux rename-window -t $SESSION:1 'editor'
tmux send-keys -t $SESSION:1 'nvim .' C-m
# Window 2: Server
tmux new-window -t $SESSION:2 -n 'server'
tmux send-keys -t $SESSION:2 'npm run dev' C-m
# Attach
tmux attach -t $SESSION
tmux Config File Approach
# project.tmux - source with: tmux source-file project.tmux
tmuxinator Approach
# ~/.config/tmuxinator/project.yml
name: project
root: ~/projects/myproject
windows:
- editor:
panes:
- nvim .
- server: npm run dev
- logs: tail -f logs/app.log
Current tmuxinator Configs
Your existing configs in ~/.config/tmuxinator/:
ls ~/.config/tmuxinator/*.yml | head -10
Exercises
Exercise 3.1: Shell Script Setup
Create a setup script for a development project:
#!/bin/bash
# ~/bin/tmux-dev.sh
Exercise 3.2: tmux Config File
Create a project-specific tmux config:
# ~/.config/tmux/projects/domus-captures.conf
Exercise 3.3: tmuxinator Project
Create or improve a tmuxinator config:
# ~/.config/tmuxinator/quantum.yml
Notes
Write your observations, insights, and questions here as you read.
Config Ideas
Scripting patterns to use in quantum workflow:
# Ideas for automation
Comparison: Approaches
| Aspect | Shell Script | tmux Config | tmuxinator |
|---|---|---|---|
Complexity |
|||
Portability |
|||
Maintainability |
|||
Your preference |
Chapter Completed
-
Read chapter
-
Completed exercises
-
Created/improved tmuxinator configs
-
Noted automation patterns
Date completed: _