[TxMt] Paste over IP: good idea?

Ben Bleything ben at bleything.net
Sat Feb 17 21:26:59 UTC 2007

On Sat, Feb 17, 2007, Andy Herbert wrote:
> I came up with the idea of running a service which would allow people  
> to connect to a server, submit the text and then give them a unique  
> ID. This ID could then be quoted to other users and used to connect  
> to the server remotely, grab the text, and view the paste using a  
> TextMate command. Any changes made to the original could then be  
> saved and re-submitted to the server. The original paster can then  
> query the server at any time to review any changes made to the  
> original along with the names of the users who have made the amendments.

Pastie already does this (as do almost all the other pastie-type
services I've seen).  For pastie, make a paste.  The number in the URL
is your ID.  Then, go to http://pastie.textmate.org/<number>.txt and you
get the plaintext version.

So, say you've got a paste ID 12345.  You can select it in TextMate and
press some key combination which fetches http://pastie.textmate.org/12345.txt
and replaces the selection with it.  Done.

Try sticking this in a command:

curl -s http://pastie.textmate.org/${TM_SELECTED_TEXT}.txt

set Input to "Selected Text or Word", Output to "Replace Selected Text",
and set a key equivalent.

It could be improved for sure... for instance, if you're not on a valid
paste id, you get a huge HTML error message... but it gets the job done.

Hopefully this saves you some time :)


More information about the textmate mailing list