[TxMt] Contributing new ruby textmate command -- evaluate selected text/line in running irb session

Jan Sabbe from-textmate-ml at atrenko.com
Fri Oct 3 14:52:21 UTC 2008


Hi,

I made a command for the ruby texmate bundle that might be interesting.

What it does (on command-option-R):
- It takes the selected text or the current line (= STDIN)
- It finds a running IRB session in the Terminal.app. If you don't have one,
it starts a new one.
- It pastes your code in IRB and switches to the terminal.app.

It saves you from manually selecting, copying, switching and pasting to try
out some code in irb. A poor man's SLIME if you will.

The command is a basic ruby script that uses the scripting bridge to drive
Terminal.app. It can also be adopted to use other interactive consoles
(python, clojure, ..) by changing the REPL_ constants at the top of the
script.
- REPL_CMD is the command to start the interactive console
- REPL_PROCESS is the active process that ends up running in the terminal.
- REPL_PROMPT is the prompt you get when you start the interactive console

See attachment for the command.

Greetings,

Jan Sabbe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20081003/34a6d0c8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run_in_irb.patch.zip
Type: application/zip
Size: 944 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20081003/34a6d0c8/attachment.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Run in IRB.tmCommand.zip
Type: application/zip
Size: 1293 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20081003/34a6d0c8/attachment-0001.zip>


More information about the textmate mailing list