Tue Mar 22 2016

For the past year and a half, I've been editing files on remote EC2 instances using SSHFS to mount the remote and open it in Sublime Text. It's worked impressively well, especially with the reconnect option enabled, which persists my connection even after my laptop has gone to sleep.

Recently, however, my company has started integrating our software into our parent company's tech stack, which has lots of massive directories. Massive enough that the SSHFS lag is a deal breaker, so I've been looking at alternatives.

What I love about SSHFS is that it's a seamless two-way sync that requires no manual steps to sync your changes to the server or to pull changes from the server to your mounted drive. None of the other popular solutions seem to meet this criteria. Because I'm looking to implement a workflow for a team that includes designers who would prefer to avoid using the command line or git simply to see their edits during development, I don't want to sacrifice on this requirement.

Today I started playing with rsub, which allows you to edit a single file on the remote server using Sublime Text. This is a promising direction for my team because anything based on mounted drives is going to choke on the enormous repository we're being asked to work with. The one huge downside is that you can't open a directory in Sublime using rsub, which means you lose all the goodness of cmd+p, search all, go to definition, and of course the sidebar file browser.

To mitigate this, I'm working on a bash script to shim some of this functionality on the remote server. I call it SubEdit. It opens a menu that lists your files and folders, and allows you to drill down on them with some support for mouse interaction. When you select a file, it opens it in Sublime using rsub. It also supports searching and creating a new file in Sublime.

The end goal is that you'll be able to ssh into the remote, run subedit, and essentially leave that command prompt open and use it as if it were your sidebar in Sublime. I'll update this post if it works out.

Update: Subedit was fun, but I'm now working on a much more full-featured, robust, and user-friendly solution. Basically it allows you to open a tab in your browser and edit files directly on a remote machine over SSH, using a Sublime-like interface: https://github.com/mgrahamjo/cyanide.