view README.md @ 2:67a6071afec7

Rename tmuxinator -> pmuxinator $ zmv **/*tmuxinator* **/*pmuxinator* $ gsed -e 's/tmuxinator/pmuxinator/g' -i **/*.* $ gsed -e 's/Tmuxinator/Pmuxinator/g' -i **/*.*
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Mon, 21 Jul 2014 08:32:00 +0900
parents 39b72942a4d2
children
line wrap: on
line source

# Pmuxinator

[![Gem Version](https://badge.fury.io/rb/pmuxinator.png)](http://badge.fury.io/rb/pmuxinator) [![Build Status](https://secure.travis-ci.org/pmuxinator/pmuxinator.png)](http://travis-ci.org/pmuxinator/pmuxinator?branch=master) [![Coverage Status](https://coveralls.io/repos/pmuxinator/pmuxinator/badge.png)](https://coveralls.io/r/pmuxinator/pmuxinator) [![Code Climate](https://codeclimate.com/github/pmuxinator/pmuxinator.png)](https://codeclimate.com/github/pmuxinator/pmuxinator) [![Dependency Status](https://gemnasium.com/pmuxinator/pmuxinator.png)](https://gemnasium.com/pmuxinator/pmuxinator)

Create and manage tmux sessions easily.

![Screenshot](https://f.cloud.github.com/assets/141213/916084/065fef7c-fe82-11e2-9c23-a9622c7d83c3.png)

## Installation

```
gem install pmuxinator
```

## Editor and Shell

pmuxinator uses your shell's default editor for opening files. If you're not
sure what that is type:

``` bash
echo $EDITOR
```

For me that produces "vim" If you want to change your default editor simply
put a line in ~/.bashrc that changes it. Mine looks like this:

```
export EDITOR='vim'
```

## tmux

The recommended version of tmux to use is 1.8. Your mileage may vary for
earlier versions. Refer to the FAQ for any odd behaviour.

### base-index

If you use a `base-index` other than the default, please be sure to also set the `pane-base-index`

```
set-window-option -g pane-base-index 1
```

## Completion

Download the appropriate completion file from the repo and `source` the file.
The following are example where the completion file has been downloaded into
`~/.bin`.

### bash

Add the following to your `~/.bashrc`:

    source ~/.bin/pmuxinator.bash

### zsh

Add the following to your `~/.zshrc`:

    source ~/.bin/pmuxinator.zsh

### fish

Move `pmuxinator.fish` to your `completions` folder:

    cp ~/.bin/pmuxinator.fish ~/.config/completions/

## Usage

A working knowledge of tmux is assumed. You should understand what windows and
panes are in tmux. If not please consult the [man pages](http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html#contenttoc6) for tmux.

### Create a project

Create or edit your projects with:

```
pmuxinator new [project]
```

For editing you can also use `pmuxinator 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:

```yaml
# ~/.pmuxinator/sample.yml

name: sample
root: ~/

# 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

windows:
  - editor:
      layout: main-vertical
      panes:
        - vim
        - guard
  - server: bundle exec rails s
  - logs: tail -f log/development.log
```

## Windows

The windows option allows the specification of any number of tmux windows. Each window is denoted by a YAML array entry, followed by a name
and command to be run.

```
windows:
  - editor: vim
```

## Panes

**_Note that if you wish to use panes, make sure that you do not have `.` in your project name. tmux uses `.` to delimit between window and pane indices,
and pmuxinator uses the project name in combination with these indices to target the correct pane or window._**

Panes are optional and are children of window entries, but unlike windows, they do not need a name. In the following example, the `editor` window has 2 panes, one running vim, the other guard.

```yaml
windows:
  - editor:
      layout: main-vertical
      panes:
        - vim
        - guard
```

The layout setting gets handed down to tmux directly, so you can choose from
one of [the five standard layouts](http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html#contenttoc6)
or [specify your own](http://stackoverflow.com/a/9976282/183537).

## Interpreter Managers & Environment Variables

To use pmuxinator with rbenv, RVM, NVM etc, use the `pre_window` option.

```
pre_window: rbenv shell 2.0.0-p247
```

These command(s) will run before any subsequent commands in all panes and windows.

## Passing directly to send-keys

pmuxinator passes commands directly to send keys. This differs from simply chaining commands together using `&&` or `;`, in that
tmux will directly send the commands to a shell as if you typed them in. This allows commands to be executed on a remote server over
SSH for example.

To support this both the window and pane options can take an array as an argument:

```
name: sample
root: ~/

windows:
  - stats:
    - ssh stats@example.com
    - tail -f /var/log/stats.log
  - logs:
    layout: main-vertical
    panes:
      - logs:
        - ssh logs@example.com
        - cd /var/logs
        - tail -f development.log
```

## Starting a session

This will fire up tmux with all the tabs and panes you configured.

```
pmuxinator start [project]
```

## Shorthand

A shorthand alias for pmuxinator can also be used.

```
mux [command]
```

## Other Commands

Copy an existing project. Aliased to `c` and `cp`
```
pmuxinator copy [existing] [new]
```

List all the projects you have configured. Aliased to `l` and `ls`
```
pmuxinator list
```

Remove a project. Aliased to `rm`
```
pmuxinator delete [project]
```

Remove all pmuxinator configs, aliases and scripts. Aliased to `i`
```
pmuxinator implode
```

Examines your environment and identifies problems with your configuration
```
pmuxinator doctor
```

Shows pmuxinator's help. Aliased to `h`
```
pmuxinator help
```

Shows the shell commands that get executed for a project
```
pmuxinator debug [project]
```

Shows pmuxinator's version.
```
pmuxinator version
```

## FAQ

### Window names are not displaying properly?

Add `export DISABLE_AUTO_TITLE=true` to your `.zshrc` or `.bashrc`

## Contributing

To contribute, please read the [contributing guide](https://github.com/pmuxinator/pmuxinator/blob/master/CONTRIBUTING.md).

## Copyright

Copyright (c) 2010-2013 Allen Bargi. See LICENSE for further details.