While this post was inspired by my move to a static blog system, I regularly need to interact with text files on remote servers over FTP.1 I have used Notepad++ on Windows for years and I’ve never been thrilled with the FTP plugin.
Dropbox is an amazing technology, but an FTP client is still a critical tool that I suspect will be needed for many more decades. A good FTP based text editor is essential.
I use the commercial Sublime Text plugin Sublime SFTP every day. I use it for work and for making quick corrections on Macdrifter. The SFTP plugin is an additional $16 from the same guy, Will Bond, that makes the indispensable Package Control plugin and service.
It may sound exorbitant to pay an extra $16 for an FTP plugin for Sublime Text. But the plugin is fully realized and comes with great support. I reported a bug on Windows and received a personal email to help figure out what the problem was. The very next update fixed the bug.
Sublime Text is pretty cheap. An extra $16 is not going to break the bank. It’s also a good way to support Will and say thanks for making the Package Control system.
The SFTP plugin must be configured for each server. Similar to other Sublime Text settings, it involves editing a json text file. The plugin will automatically create the settings template for you and then you just need to add your own server connection settings.
There are good instructions available from the developer.
I configure separate connections for each location I want to quickly open in ST2. The plugin allows for navigation but I find it is quicker to have separate settings, one for CSS editing, one for post editing and one for template editing.
Once configured, accessing a the new server is done through the ST2 quick panel, ⌘+Shift+P. To browse the new server, start typing “Browse”.2, then start typing the name of the host to narrow the list (this assumes more than one host in the list).
Once in the list, typing any characters in a file name instantly narrows the list. Selecting and hitting return opens the file for editing. Saving the file automatically uploads the new version to the host.
While in the quick panel browser, there are also several other actions available for directories and files. All of the FTP options I normally need are right there. I can create new files and folders and chmod as well.
There’s an alternative to working from the quick panel. The sidebar can be configured to work with a directory on the FTP host by setting up a local copy through Sublime Text. Will Bond provides detailed instructions.
Briefly, this method involves creating a new local folder to hold the files from the FTP host and creating a new Sublime Text project with the folder. The SFTP plugin provides an option to configure a mapping for a remote host. The json configuration is very similar to the settings needed to create a direct FTP connection.
Once configured, I right clicked on the local folder and chose “SFTP > Sync Remote -> Locale”. ST2 quickly scans the remote directory and lists all of the files that will be downloaded. A confirmation dialog is presented in the quick panel and then every file is downloaded. It takes about 4 minutes to download my ~2000 MD files, but this only needs to happen the first time. Subsequent downloads will only fetch newer files.
I can now browse and preview files. After opening for editing I can hit save as I normally would and changes are pushed back to the FTP server.
Since the sidebar is saved as a project, I can quickly access all of my files from the Sublime Text project menu. There’s no need to issue a new FTP connection since the project consists of a mapped folder.
A significant advantage of working in this mode is access to “Find in Files” (⌘+Shift+F).
The search is nearly instantaneous and I can open any hits directly from the result panel.
BBEdit is a superb text editor. In some ways it is better than Sublime Text. FTP is one of those ways.
For a one time connection select the “Open From FTP/SFTP Server…” item under the file menu. Alternatively, create a new host bookmark through the BBEdit settings panel. Under the “BBEdit” menu, choose “Setup”.
Now add a bookmark for the host. I create a separate bookmark for each location on the host.
The bookmark makes it very easy to quickly connect BBEdit to the host. Choose “Open From FTP/SFTP Server…” and then choose the bookmark. BBEdit displays a file browser with the filename, modification date and file type. There are also shortcuts to help navigate up directories and create new files.
The big advantage of BBEdit for me is that I can list files by modification date. That lets me see my most recent posts first, which are usually the files I want to edit.
Similar to Sublime Text, BBEdit also provides an option to set permissions on any specific file or directory through the “Info” button in the file browser.
Opening a file (or files) to edit allows me to work as I normally would. Hitting Save automatically uploads the new version to the server. BBEdit even does a better job with automatically adjusting the server time stamp display for files. Time stamps are displayed relative to the time on my Mac, not the time the time stamp at the host. It’s also very easy to see when I am working on a remote file. BBEdit shows the path to the file and includes the FTP host.
BBEdit also provides a nice option for quickly jumping to another directory on the host. The “Go to…” menu is available in the FTP Browser and can be used to view any valid path on the host.
When I’m on my Mac I prefer the BBEdit method of FTP access because I can sort by modification date.3 When I’m on Windows, there is no competition, Sublime Text is the only way to go.
I prefer both methods of editing posts on Pelican to working in the WordPress web app. There are other options available to work directly in Dropbox, but I don’t have those options all the time. Even if I did, I would probably still use FTP frequently and BBEdit + Sublime Text are a great way to go.
I will use FTP and SFTP synonymously in this post. It’s just a configuration difference for the purpose of this discussion. ↩︎
There are also shortcuts for the same: ⌘+ctrl+R, ⌘+ctrl+B. ↩︎
Yes, I realize I can just browse to the folder on the OS and sort by date. The whole point of FTP access in the editor is avoiding having to leave the editor. ↩︎