16

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.

never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
  • bcvi does exactly that, but for vim. It relies on vim's built-in support for scp:// though, which could make a Textmate port difficult. – Michael Kropat Oct 04 '10 at 18:47

6 Answers6

4

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.

fabian789
  • 8,348
  • 4
  • 45
  • 91
furtive
  • 1,669
  • 2
  • 13
  • 15
  • SSHFS is fun until the connection to the server drops. Then you have to SIGKILL everything in sight. IDK maybe I'm just using an old version. – Michael Kropat Oct 04 '10 at 18:48
  • 1
    I can't vouch for SSHFS specifically but using MacFUSE if I lose my connection the drives unmount cleanly, and I've had sites mounted for days at a time. YMMV. – furtive Oct 04 '10 at 21:59
  • 1
    Have had the same problems Michael describes, not even a reconnect setting helped. For all the uses sshfs has, the moments I could employ it usually ended up with either cron- or manual rsyncs over ssh. – Wrikken Oct 05 '10 at 22:21
  • 1
    SSHFS works but (for me) it's unbelievably slow and beachballing even on a server in the same building. Why not simply launch vim on the remote server or use Git/Mercurial and work locally? – romainl Mar 28 '11 at 11:45
  • I've used SSHFS before, with a good success rate. I have found that setting the SSH config option :ServerAliveInterval 60 is a help. It helps reduce the number connection dropouts. – Ian Lewis Apr 15 '13 at 13:01
4

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.

Community
  • 1
  • 1
haylem
  • 22,460
  • 3
  • 67
  • 96
2

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.

eglasius
  • 35,831
  • 5
  • 65
  • 110
1

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.

Raghuram
  • 3,937
  • 2
  • 19
  • 25
1

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.

eyelidlessness
  • 62,413
  • 11
  • 90
  • 94
shaneknysh
  • 175
  • 8
0

http://kennethreitz.com/remote-textmate-development-via-ssh-and-rsync.html

j0k
  • 22,600
  • 28
  • 79
  • 90
kagali-san
  • 2,964
  • 7
  • 48
  • 87