Though remote development is not available out of the box for Sublime Text, we can enable a form of it with the sublime-rsync-ssh package. This versatile plugin has many features and options, but this post will focus solely on syncing a single local folder to a remote folder. I recommend you peruse the README for more information.

Prerequisites

Sublime Text with macOS is used in the examples, but it’s still applicable for Windows and Linux. Cygwin is required for Windows.

a. SSH Public Key Authentication is configured with the remote host.

grep -A 4 'arch' ~/.ssh/config

My remote host is named arch with the following attributes for the connection:

Host arch
    Hostname 192.168.137.52
    AddressFamily inet
    User marc
    PasswordAuthentication no

b. The git tool is installed on the local host.

type -p git

c. The rsync tool is installed on both the local and remote host.

type -p rsync && ssh arch 'type -p rsync'

Steps

  1. Create the project folder to be synced on both the local and remote host.
mkdir -p ~/Dev/foo && ssh arch 'mkdir -p ~/Dev/foo'
  1. Create the hello.py file in the local project folder.
printf 'print("Hello, World!")\n' > ~/Dev/foo/hello.py
  1. Open the project folder in Sublime Text.
subl ~/Dev/foo
  1. Add the GitHub repository to Package Control.

    1. Open the Command Palette
    2. Enter Package Control: Add Repository
    3. Enter https://github.com/davidolrik/sublime-rsync-ssh
  2. Install the package.

    1. Open the Command Palette
    2. Enter Package Control: Install Package
    3. Enter sublime-rsync-ssh
  3. Append the rsync_ssh template configuration to the settings section of the project file.

    1. Open the Command Palette
    2. Enter rsync ssh: Initialize settings
  4. Save the project file in the project folder.

    1. Open the Command Palette
    2. Enter Project: Save As
    3. Enter foo.sublime-project
  5. Edit the project file.

    • Menu: ProjectEdit Project

For my example Python project:

  • Exclude folders and files to be synced at the global level
  • Define the foo remote (destination)
  • Sync the file when saved
{
	"folders":
	[
		{
			"path": "."
		}
	],
	"settings":
	{
		"rsync_ssh":
		{
			"excludes":
			[
				".git*",
				"*.sublime-*",
				".venv"
			],
			"remotes":
			{
				"foo":
				[
					{
						"command": "rsync",
						"enabled": 1,
						"remote_host": "arch",
						"remote_path": "/home/marc/Dev/foo"
					}
				]
			},
			"sync_all_on_save": false,
			"sync_on_save": true
		}
	}
}
  1. Reopen the project for the new configuration to take effect.

    1. Menu: ProjectClose Project
    2. Menu: ProjectOpen Project
    3. Select the foo.sublime-project file
    4. Click the Open button
  2. Perform a manual sync.

    • Keyboard: ⇧ + ⌘ + F12
    • Menu: ProjectRsync SSHSync Project to remotes
Project menu
  1. Verify the hello.py file has been synced to the remote project folder.
ssh arch 'cat ~/Dev/foo/hello.py'
  1. Optionally, check the Console output for verification and troubleshooting.
    • Keyboard: ⌃ + `