ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Remote​Subl

by randy3k ST3

Use rmate with Sublime Text, an improved fork of rsub.

Details

Installs

  • Total 23K
  • Win 8K
  • Mac 10K
  • Linux 5K
Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4
Windows 0 2 1 2 1 1 1 1 1 2 4 4 3 0 7 0 1 1 1 0 2 6 2 5 3 0 1 3 2 3 2 3 4 3 3 2 5 2 1 3 3 5 1 5 6 1
Mac 0 4 0 2 0 3 2 3 1 2 3 2 1 4 1 4 4 1 0 0 3 3 2 2 2 1 2 2 4 3 3 5 0 1 4 4 4 3 2 2 1 4 4 7 1 4
Linux 0 1 1 1 0 2 1 1 2 2 1 0 0 4 0 2 3 0 0 1 2 1 1 0 0 0 0 1 1 1 0 2 0 1 0 1 1 1 1 0 0 0 1 2 2 1

Readme

Source
raw.​githubusercontent.​com

RemoteSubl

RemoteSubl starts as a fork of rsub to bring rmate feature of TextMate to Sublime Text. It transfers files to be edited from remote server using SSH port forward and transfers the files back when they are saved.

Comparing to rsub, the followings are enhanced:

  • support multiple files via rmate foo bar.
  • use the same view when opening the same file twice.
  • notify when connection lost.
  • resume previous connection when it was lost.
  • better status bar messages when saving file and when encountering errors.
  • bring up Sublime Text on different platforms.
  • ability to set a custom color scheme.

Why a new fork? It seems that the author of rsub is not actively maintaining that package.

Installation

Before installing on your remote server, RemoteSubl can easily be installed using Package Control.

Once you have that completed, open up Sublime Text (the rest won't work unless you do).

On the remote server, we need to install rmate (this one is the bash version). You don't have to install it if you have been using rmate with TextMate or other editors. It is just the same executable. If not, it (the bash version) can be installed by running this script (assuming you have the right permission),

curl -o /usr/local/bin/rmate https://raw.githubusercontent.com/aurora/rmate/master/rmate
sudo chmod +x /usr/local/bin/rmate

You can also rename the command to rsubl

mv /usr/local/bin/rmate /usr/local/bin/rsubl

If your remote system does not have bash (so what else does it have?), there are different versions of rmate to choose from:

Usage

Open an ssh connection to the remote server with remote port forwarded. It can be done by executing the following command on your local machine:

ssh -R 52698:localhost:52698 user@example.com

After running the server, you can just open the file by typing the following command in your remote system's terminal:

rmate test.txt

(NOTE: you need to have opened Sublime Text on your local machine. If not you get this error: connect_to localhost port 52698: failed. on your server)

… or if you renamed it to rsubl then …

rsubl test.txt

If everything has been setup correctly, you should be able to see the opening file in Sublime Text.

SSH config

It could be tedious to type -R 52698:localhost:52698 everytime you ssh. To make your life easier, add the following to ~/.ssh/config,

Host example.com
    RemoteForward 52698 localhost:52698
    User user

From now on, you only have to do ssh example.com.

PuTTY config

Alternatively, if you're using PuTTY as your SSH client, before you connect to your host:

  1. Navigate to Connection > SSH > Tunnels in the left-hand navigation pane
  2. In the Add new forwarded port: section, add 52698 to Source port text field
  3. Then add localhost:52698 in the Destination text field
  4. Select Remote checkbox instead of Local
  5. Click Add to add your forwarding information to the Forwarded ports: list
  6. Save your settings if you'd like, and then connect to your remote host