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 7K
  • Win 2K
  • OS X 3K
  • Linux 1K
Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8
Windows 4 1 3 7 5 1 3 5 4 9 5 1 2 8 2 4 2 2 4 2 2 6 9 7 7 3 2 8 7 0 4 8 2 7 10 7 5 8 3 2 0 6 7 5 5 11
OS X 0 5 6 4 3 1 5 4 3 4 4 0 3 7 3 7 8 7 4 2 3 3 10 5 7 1 0 12 5 10 11 8 3 7 5 9 6 9 7 3 2 6 1 8 6 5
Linux 2 3 5 3 1 2 5 1 2 3 3 0 1 1 4 3 1 2 1 1 3 4 4 8 1 2 0 4 1 7 3 8 2 1 3 3 3 5 4 1 3 7 0 7 7 5

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.

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.