- Install things
Install tmux
and tmuxinator
(I used brew and gem install tmuxinator
)
- Create a new tmuxinator project
Run in terminal: tmuxinator new [projectname]
(replace [projectname] with a project name)
This should open the new configuration file on your editor.
Use tmuxinator open [projectname]
to edit the config file.
- Configure tmuxinator session
This is my tmuxinator config:
You might want to replace the following options:
root:
to your project's directory
panes:
These are the commands that run in each windown pane at startup. Use these to get all the servers started and navigate to the correct directories.
# ~/.tmuxinator/mapstory.yml
name: projectname
root: ~/code/project01/projectname
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
# startup_window: logs
# Controls whether the tmux session should be attached to automatically. Defaults to true.
# attach: false
# Runs after everything. Use it to attach to tmux with custom options etc.
# post: tmux -CC attach -t mapstory
windows:
- main:
layout: tiled
panes:
- cd scripts/provision; vagrant reload && vagrant ssh
- cd app/tests; ./startWebDriver.sh
- cd app/tests; subl .;cowsay "Hello"
- Start your environment
Start the session with: tmuxinator start [yourprojectname]
- (Optional) Configure tmux
This is my tmux config file:
# Soruce: https://danielmiessler.com/study/tmux/#intro
# Sets Ctrl-b + r as a reload shortcut
bind r source-file ~/.tmux.conf
# Rename the terminal
set -g set-titles on
# set -g set-titles-string '#(whoami)::#h::#(curl ipecho.net/plain;echo)'
set -g set-titles-string '#(whoami) :: #h'
# Status bar config
# set -g status-utf8 on
set-option -g prefix C-a
set -g status-bg white
set -g status-fg black
# For mac mouse scrolling
set -g mouse on
bind-key -t vi-copy WheelUpPane scroll-up
bind-key -t vi-copy WheelDownPane scroll-down
set-option -g default-command "reattach-to-user-namespace -l bash"