This shell script needs to be installed on a remote machine to allow editing files using TextMate 2 (TM2). TM2 needs to be configured accordingly to accept either local or remote clients.
It’s a good idea to allow access to TM2 only for local clients. In this case it’s required to open a SSH connection to the remote system and specify a remote tunnel in addition:
ssh -R 52698:localhost:52698 firstname.lastname@example.org
After log-in on the remote system a file can be edited by just executing
On some machines, where port forwarding is not possible, for example due to a missing ssh daemon, it’s required to set TM2 to allow access for “remote clients”. After log-in on the remote machine a file can be edited by executing
rmate -H textmate-host test.txt
A bash with compiled support for “/dev/tcp” is required.
Edit specified file
$ ./rmate [arguments] [--] file-path
Read text from stdin
$ echo "hello TextMate" | ./rmate [arguments] -
-H, --host HOST Connect to HOST. Use 'auto' to detect the host from SSH. -p, --port PORT Port number to use for connection. -w, --[no-]wait Wait for file to be closed by TextMate. -l, --line LINE Place caret on line number after loading file. +N Alias for --line, if N is a number (eg.: +5). -m, --name NAME The display name shown in TextMate. -t, --type TYPE Treat file as having specified type. -n, --new Open in a new window (Sublime Text). -f, --force Open even if file is not writable. -v, --verbose Verbose logging messages. -h, --help Display this usage information. --version Show version and exit.
Default parameter configuration
Some default parameters (host and port) can be configured by defining them
as the environment variables
RMATE_PORT or by putting them
in a configuration file. The configuration files loaded are
host: auto # prefer host from SSH_CONNECTION over localhost port: 52698
Alternative notation for configuration file is:
The precedence for setting the configuration is (higher precedence counts):
- default (localhost, 52698)
- environment variables (RMATE_HOST, RMATE_PORT)
- [Source Code (GitHub)][https://github.com/aurora/rmate]
- Author: Harald Lapp