never_had_a_name
never_had_a_name

Reputation: 93216

Open local text application to edit remote text file using ssh?

So i am in a VPS terminal using ssh.

In normal case I could just run locally

mate <file>

and it fires up TextMate with that file.

Is it possible to use the same command and somehow open the local TextMate application but editing the remote file?

That would be good if you are working in VPS and don't want to use vim all the time.

Upvotes: 16

Views: 13472

Answers (6)

furtive
furtive

Reputation: 1689

The solution is to mount the remote system using sshfs. On OS X, sshfs can for instance be installed by using Homebrew.

The filesystem is mounted via SSH using your regular SSH credentials or key so it's very easy to do, and then you navigate it as if it's a local directory and enjoy the benefit of having access to all your local tools.

Upvotes: 4

shaneknysh
shaneknysh

Reputation: 185

Another option is to use one of the two available Textmate Sync bundles - both use rsync and ssh to keep the remote and local folders synchronized.

  1. Textmate remote sync bundle
    This is the bundle I use. It looks to have the exact same functionality as the second bundle but I found this one first.

  2. Textmate Sync bundle

The only word of warning I would add is the first sync will clear the remote folder and replace it with the contents from the local folder.

Upvotes: 1

haylem
haylem

Reputation: 22663

You have different options:

  • mounting a remote filesystem using (Mac)Fuse (as recommended by furtive),
  • synchronize your remote directory:
    • with rsync (as recommended by eglasius),
    • with an SCM (like git or hg or others),
  • or, and this would be my preferred way, use Emacs (Aquamacs, I guess, in your case) and use the tramp mode to edit remote files.

I used to do this in a few years back for some projects, and it worked perfectly, both for LANs and WANs.

If you want to stick to TextMate, then furtive's solution is ideal.

Upvotes: 4

eglasius
eglasius

Reputation: 36037

Alternatively you could sync the folder with rsync over ssh.

That way you work locally, and let rsync sync it to the server for you. That could either be explicitly initiated by you or be run in a daemon.

Upvotes: 2

Raghuram
Raghuram

Reputation: 3967

If you do ssh to another box then you can open the file using cat and pipe it to a local file. I dont think so that you can stream it to an editor in the local box.

Upvotes: 1

Related Questions