Automate tmux and get to coding quicker

30/03/2012

Here is an example of how to automate startup of your development environment with tmux. I use Ruby/Rails, Rspec and Vim so this shows their use, but it would equally apply to any terminal based setup.

 

Update: I wrote a rubygem to automate the creating of tmux configurations like the one below: tmuxinator

Create a function which starts a tmux session, sends key strokes to create windows and run commands, then attach to the session. I put this file in ~/bin/zsh.

 

Source the function so its always available and has autocomplete (tested with zsh).

Now start a new terminal and type matripa. Or even ma and press tab.

This works well with RVM if you have a .rvmrc file in your project root.

Note that this has been tested in zsh, not bash. However I would expect, apart from the autocomplete, it would work just fine.

Alternative options: Tmuxinator and Teamocil, of the two I prefer Teamocil. Update: And now I must include my own Tmuxinator.