Tmuxinator
Create and manage tmux sessions easily.
Example
Installation
$ gem install tmuxinator
Editor and Shell
tmuxinator uses your shell's default editor for opening files. If you're not sure what that is type:
$ echo $EDITOR
For me that produces "vim" If you want to change your default editor simple put a line in ~/.bashrc that changes it. Mine looks like this:
export EDITOR='vim'
Completion
Download the appropriate completion file from the repo.
bash
Add the following to your ~/.bashrc
:
source `which tmuxinator.bash`
zsh
Add the following to your ~/.zshrc
:
source `which tmuxinator.zsh`
Usage
Create a project
Create or edit your projects with:
$ tmuxinator new [project]
For editing you can also use tmuxinator open [project]
. new
is aliased to
o
,open
and n
. Your default editor ($EDITOR
) is used to open the file.
If this is a new project you will see this default config:
name: Tmuxinator
root: ~/Code/tmuxinator
socket_name: foo # Remove to use default socket
pre: sudo /etc/rc.d/mysqld start # Runs before everything
pre_window: rbenv shell 2.0.0-p247 # Runs in each tab and pane
tmux_options: -v -2 # Pass arguments to tmux
windows:
- editor:
layout: main-vertical
panes:
- vim
- #empty, will just run plain bash
- top
- shell: git pull
- database: rails db
- server: rails s
- logs: tail -f logs/development.log
- console: rails c
- capistrano:
- server: ssh me@myhost
If a tab contains multiple commands, they will be joined together with &&
.
If you want to have your own default config, place it into
$HOME/.tmuxinator/default.yml
The pre
command allows you to run anything before starting the tmux session.
Could be handy to make sure you database daemons are running. Multiple commands
can be specified, just like for tabs.
Panes Support
You can define your own panes inside a window likes this:
- window_with_panes
layout: main-vertical
panes:
- vim
- #empty, will just run plain bash
- top
The layout setting gets handed down to tmux directly, so you can choose from one of the five standard layouts or specify your own.
Starting a session
This will fire up tmux with all the tabs and panes you configured.
$ tmuxinator start [project]
Shorthand
You can also use this shorthand alias for tmuxinator
$ mux [command]
Interpreter Managers & Environment Variables
To use tmuxinator with rbenv, RVM, NVM etc, use the pre_window
option.
pre_window: rbenv shell 2.0.0-p247
These commands will run before any pane or window.
Other Commands
Copy an existing project. Aliased to c
and cp
$ tmuxinator copy [existing] [new]
List all the projects you have configured. Aliased to l
and ls
$ tmuxinator list
Remove a project. Aliased to rm
$ tmuxinator delete [project]
Remove all tmuxinator configs, aliases and scripts. Aliased to i
$ tmuxinator implode
Examines your environment and identifies problems with your configuration
$ tmuxinator doctor
Shows tmuxinator's help. Aliased to h
$ tmuxinator help
Shows the shell commands that get executed for a project
$ tmuxinator debug [project]
Shows tmuxinator's version.
$ tmuxinator version
FAQ
Window names are not displayed properly?
Add export DISABLE_AUTO_TITLE=true
to your .zshrc
or .bashrc
Contributing
To contribute, please read the contributing guide.
Copyright
Copyright (c) 2010-2013 Allen Bargi. See LICENSE for further details.