aziz/tmuxinator — pull request #69 by yrammos (2012-06-19 11:43:00+00:00)
Title: Command-specific windows & panes by passing the cmd directly, without send-keys.

Hello Allen!

Thanks for this excellent tool — I am only now adopting tmux and greatly appreciate your work.

I went ahead and made a small change that you may find worthy of merging. In your current master, commands are passed to new windows and new panes via the shell prompt (`tmux send-keys…`). As a result, exiting/stopping that command merely takes us to the shell prompt. While this works fine in many cases, it makes it impossible to create "command-specific" windows or panes, i.e. windows/panes that are directly declared "dead" once the command is exited. Let's take the following script as an example:

```tabs:
…
- Editor
panes:
…
- log git
```

In the current master, `log git` will exit and take you to the shell prompt. In my proposed implementation, the pane is instead declared as "dead" and no prompt appears, whereby it is very easy to refresh the pane by pressing the key-binding for `:respawn-pane` to rerun the command. We also enjoy the neatness of having a pane permanently associated with the command, without a shell prompt there tempting us to use the pane for other purposes, and cruft gradually making the original purpose of the pane less distinctive.

This is done by dispensing with `send-keys` and instead passing the window/pane command as a parameter to `new-window` and `splitw` respectively:

tmux <%= socket %> new-window -t <%= window(i+1) %> -n <%=s tab.name %> <%=s tab.command %>

and

tmux <%= socket %> splitw -t <%= window(i+1) %> <%=s pane %>

The only downside that I see in this is that the pane- or window- specific `pre` field, which is intended to be an initializer for the new pane/window, is now ignored. But in most cases this could be easily circumnavigated, for example, by prepending the value of the `pre` field in some way to the pane command (much as I have not tried this).