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

Open​File​Over​SSH

by AncientRoman ST4

A Sublime Plugin that allows a File to be Opened on a Remote Machine over ssh and seamlessly edited and Saved back to the remote machine

Details

Installs

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

Readme

Source
raw.​githubusercontent.​com

SublimeOpenFileOverSSH v1.4.0

A Sublime Text 4 plugin that allows a file to be opened on a remote machine over ssh and seamlessly edited and saved back to the remote machine

Installation

This plugin should work on MacOS, Linux, and Windows.

Package Control

Sublime's Package Control is the best and easiest way to install this plugin.

  1. Run the Package Control: Install Package command from the command pallet
  2. Search for and select OpenFileOverSSH
  3. Package Control will automatically install and keep this package up to date

Manual

Clone or download this repo (or a versioned release) into the Sublime Packages folder.

Usage

Trigger the remote file selection using one of these options.

  • Use the File > Open via SSH menu item
  • Run the Open File Over SSH command from the command palette
  • Press cmd-shift-o or wndws-shift-o (you must set this up, see Key Bindings)

Once triggered, input the server path and browse/open remote files as follows.

  1. Type in the scp-like path to your server (user@server.ext:), and press enter
  2. Once the server is validated and connected, a list input will appear which allows you to choose a folder or file
  3. Continue browsing the file system on your server until you find the file you want to open
  4. Enjoy finally being able to edit a remote file in sublime (2505 students amirite)

The list input also contains various actions related to opening files.

  • Select the star (*) option to enter a pattern like *.c *.h
  • Select the New option to create new folders and open new files

Important

You will need to setup ssh public/private key login to your remote machine so this plugin can connect to your server in the background without needing a password.

How it Works

When a remote file is opened, the contents of the file is copied into the buffer.
When the file is saved, the buffer is copied back into the remote file, and sublime is given a temporary file to save to which is later deleted.
The file transferring is done using Popen's stdin and stdout to ssh, not scp.

The file selection is done by opening an ssh connection after the server is input and ls is used to populate the folder/file list on demand.

The only commands used by this plugin are ssh on the local machine and ls, cat, redirection (>), and mkdir (if you use New to create folders) on the remote machine.

Settings

Open the settings file with one of these options.

  • Use the menu item Preferences > Package Settings > Open File Over SSH > Settings
  • Run the command pallet command Preferences: Open File Over SSH Settings
  • Open the file Packages > User > SublimeOpenFileOverSSH.sublime-settings

Multiplexing

Ssh's multiplexing feature is used to speed up connection and authentication when browsing and saving files in short succession.
The default connection keep alive time is 5 minutes and you can change this with the multiplexing setting.
The multiplexing key accepts keep alive (ControlPersist) times in the 120s or 5m formats.
If your system doesn't support multiplexing or you'd like to disable it for security reasons, set multiplexing to false.

Timeout

Use the timeout setting to control ssh's connection timeout in seconds.
The default is 7 seconds.
You can set timeout to null to use ssh's default timeout which is the system's tcp timeout.

Host Key Checking

Host key checking can be controlled with the hostKeyChecking key.
This settings accepts yes, no, accept-new, or null most of which correspond to ssh's StrictHostKeyChecking setting.
null is the default and uses ssh's BatchMode default which is yes.
yes throws an error if a key does not exist or match.
no does not check or save keys.
accept-new saves new keys and only errors if a previously saved key has changed.

Key Bindings

Key Bindings are disabled by default per Package Control requirements.
Enable the Open via SSH key binding by opening the key binding file in a similar manner as the settings file and copying over the disabled binding.

What's New?

v1.4: Added multiplexing, menu items, error checking, new file/folder creation, ui updates, settings, and Package Control installation
v1.3: Support for Sublime Text 4
v1.2.2: Fixed files in subfolders being opened when a glob was used
v1.2.1: Fixed crashing sublime when a remote file was opened that did not have a new line at the end
v1.2: The wildcard (*) option opens a text input that accepts one or more glob patterns such as *.c h* and opening multiple files is wayyyy faster
v1.1: Added a file browser like interface to the Open File File Over SSH command in the command pallet
v1.0: First version with Windows support

Contributing

You can submit a PR if you'd like, but if you find a bug or would like a new feature feel free to open an Issue.
I'll respond to either as soon as I can.