GitHub - remi/teamocil at 0.4-stable (original) (raw)

Teamocil

Teamocil is a simple tool used to automatically create sessions, windows and panes in tmux with YAML files.

Usage

$ gem install teamocil $ mkdir ~/.teamocil $ teamocil --edit sample $ tmux $ teamocil sample

Options

Layout file structure

A layout file is a single YAML file located in ~/.teamocil or $TEAMOCIL_PATH (eg. ~/.teamocil/my-project.yml).

Session

You can wrap your entire layout file in a session and Teamocil will rename the current session (so that you can find it more easily when running tmux list-sessions) before creating your windows.

Keys

Example

session: name: "my-awesome-session" windows: [windows list]

Windows

If you are not using a top-level session key, then the first key of your layout file will be windows, an array of window items.

Item keys

Notes

If you want to use a custom value for the layout key, running this command will give you the layout of the current window:

$ tmux list-windows -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f 2

You can then use the value as a string, like so:

Example

windows:

Panes

Every window must define an array of panes that will be created within it. A vertical or horizontal pane will be created, depending on whether the width or height parameter is used. If a layout option is used for the window, the width and height attributes won’t have any effect.

Item keys

Example

windows:

Layout examples

See more example files in the examples directory.

Simple two panes window

Content of ~/.teamocil/sample-1.yml

windows:

Result of $ teamocil sample-1

.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Four tiled panes window

Content of ~/.teamocil/sample-2.yml

windows:

Result of $ teamocil sample-2

.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|------------------|------------------|
| (3)              | (2)              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Extras

Zsh autocompletion

To get autocompletion when typing teamocil <Tab> in a zsh session, add this line to your ~/.zshrc file:

compctl -g '~/.teamocil/*(:t:r)' teamocil

Bash autocompletion

To get autocompletion when typing teamocil <Tab> in a bash session, add this line to your ~/.bashrc file:

complete -W "$(teamocil --list)" teamocil

ERB support

You can use ERB in your layouts. For example, you can use an environment variable in a layout like so:

windows:

Todo list

Contributors

Feel free to contribute and submit issues/pull requests on GitHub, just like these fine folks did:

Take a look at the spec folder before you do, and make sure bundle exec rake spec passes after your modifications :)

License

Teamocil is © 2011-2014 Rémi Prévost and may be freely distributed under the MIT license. See the LICENSE file.