[TxMt] Editing remote files, was:great .bash_profile tip and question
Ralph Pöllath
lists at poellath.org
Tue Nov 30 11:20:26 UTC 2004
On 30.11.2004, at 09:48, Paul Nordstrom August wrote:
> Hmmm... I ssh into a remote server frequently; if I add the "tm ()..."
> command to my .bash_profile remotely will TM open it during the ssh
> session? That would really save time... I'll try.
Don't bother, that won't work unfortunately. I'm in the same situation:
I work on remote servers via ssh frequently, and would like to use TM
as my editor. I came up with the idea for a possible solution (I
implemented about 90% of the functionality, but currently have no time
to work on it) that would look like this:
A command line wrapper around /usr/bin/ssh that looks for special
strings (like odb://me@linux.com:/etc/httpd.conf) in ssh's output and
notifies a faceless background app on your mac when it finds one. The
app will then download the remote file to a temporary directory using
/usr/bin/scp and act as an ODB Editor, which means it will tell your
favorite ODB-compliant editor (TM, SEE, BBEdit, ...) to open the
downloaded file, and when the file has been modified or closed, it will
re-upload the file to the server.
The faceless background application could actually be replaced by TM's
SFTP support, once that's available (but would not work with editors
that support ODB, but not SFTP or SCP). The wrapper around ssh is just
for convenience: It would allow me to issue a command like
me at linux /etc $ tm httpd.conf
on the remote server (where tm is a function or alias that expands
"httpd.conf" to "odb://me@linux.com:/etc/httpd.conf"), instead of
switching to another terminal window and telling TM to open the remote
file, like in
me at mac ~ $ tm -sftp me at linux.com:/etc/httpd.conf
or whatever the syntax for TM's SFTP support will be.
I'm not sure wether I'll finish implementing the general solution using
the faceless background app or just wait for TM to support SFTP. One of
the problems I'm having is that I can't come up with a decent name for
the whole thing, and of course this will always be a hack by it's very
nature and never be an elegant solution :-(
Cheers,
-Ralph.
PS: Which editors currently do support opening remote files via
SCP/SFTP from the command line? Anyone?
> On 30 Nov 2004, at 00:39, Allan Odgaard wrote:
>> I just have this in my .bash_profile:
>> tm () { open -a TextMate.app "$*"; }
>>
>> It allows me to type »tm some_file« to edit that file. There was a
>> script which also allowed to edit stdin, it's on the wiki AFAIK.
More information about the textmate
mailing list