-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
61 lines (36 loc) · 2.06 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
textmate_remote provides a "mate" command that lets you, from a remote ssh session, open a file locally in
TextMate.
PREREQUISITE
You must have the remote drive mounted locally somehow. The easiest way to do this is to download
MacFusion:
http://www.macfusionapp.org
MacFusion lets you mount any ssh-reachable machine as a filesystem. You'll want to mount the root of the
remote filesystem (that is, in MacFusion, set "Path" to "/".) Let's say you have mounted my-server.example.com as /Volumes/my-server.
INSTALLATION: ON YOUR MAC
In your ~/.ssh/config file (which you might need to create), add an entry:
Host my-server.example.com
RemoteForward 10022 localhost:22
You'll need to specify the "my-server.example.com" name *exactly* as you normally supply it to ssh; if you usually just ssh to "my-server" (letting your domain name be appended by default), the Host entry must also read "my-server". You can specify multiple names in the Host entry, e.g.:
Host my-server.eastcoast.example.com my-server my-server.eastcoast
RemoteForward 10022 localhost:22
(Alternatively, you can just add "-R 10022:localhost:22" when you ssh to your server.)
INSTALLATION: ON YOUR SERVER
Edit the defaults in the "mate" script:
$mac_mount: The full path, on your Mac, of the remote-mounted filesystem
$mac_app: The full path, on your Mac, to TextMate
$mac_user: Your Mac username
Then:
sudo cp mate /usr/local/bin
sudo chmod a+x /usr/local/bin/mate
sudo ln -s /usr/local/bin/mate /usr/local/bin/mate_wait
USAGE
From your ssh session, just type "mate path/to/file" as you normally would on your Mac. Magic!
If you want to use TextMate as your default editor, you'll probably want to use the "mate_wait" version, e.g.:
## ~/.bashrc
export EDITOR=mate_wait
This script has no way of knowing when you've closed the TextMate window, so you have to press ENTER (in the Terminal) when you're done editing. It's on the honor system.
TODO
- Move mac-* variables into config file
- Make port number work automagically w/multiple machines
LICENSE
Get it, use it, share it, improve it, but don't blame me.