atom/terminal — pull request #27 by lackac (2014-03-20 00:18:13+00:00)
Title: Ability to run command in a terminal when it is not the active tab

It is many times useful to be able to run a command remotely. Think unit tests or build tasks. This is a first shot at providing that feature.

The new `terminal:run-command` (mapped to `ctrl-r`) command opens a command prompt at the top of the window and sends the provided command as input to the terminal session that was activated first. It tracks active sessions, and removes sessions when they are exited or their tab closed.

There's also a `terminal:run-last-command` (mapped to `ctrl-shift-r`) command which runs the last command again.

I also included a little bit of refactoring in `terminal.coffee` making the `createTerminalSession` function a method on `Terminal`. It made sense for easier tracking of active sessions. I know it's best to keep refactoring as separate commits, but I was already too deep into it to go back. However, if you don't agree with the way I did it, let's discuss and in any case I can add it back the way it was.

I'm also thinking about how to allow the user to select which session the command runs in. One way would be to add a shortcut under the `.terminal` scope for selecting the currently active terminal tab as a target for commands. Another would be to open a new terminal tab on the first command and keep using that for subsequent commands.

As I said, this is a first shot. I would love to get some input, thoughts for improvements, etc. I will add specs for the new features later.