Skip to content

Instantly share code, notes, and snippets.

@jiamaozheng
Created April 16, 2018 03:52
Show Gist options
  • Save jiamaozheng/5c0ca9caaba2a3fc69662aecfe484d73 to your computer and use it in GitHub Desktop.
Save jiamaozheng/5c0ca9caaba2a3fc69662aecfe484d73 to your computer and use it in GitHub Desktop.
Editing files from a remote ssh session with sublime via the use of rmate
1. Install rmate in your remote server (https://github.com/aurora/rmate)
sudo wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate
sudo chmod a+x /usr/local/bin/rmate
2. Run "rmate <filename_to_edit>" command in your remote terminal,
and it will open the file locally in Sublime (make sure Sublime is already open on
your laptop before issuing the above command).
3. In order for this to work you must first do the following on your laptop:
a). Install the rsub plugin for Sublime Text, which is available through Package Control tool:
go to Tools —> Command Palette —> Package Control: Install Package; then type ‘rsub’ and install.
b). Add a remote forwarding line under the right host in your ~/.ssh/config file to enable connection.
The easiest is to forward the port for all hosts (so that you don't need to update it as your instance DNS name changes):
Host *
Hostname %h
RemoteForward 52698 127.0.0.1:52698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment