Knowledge Base

How to publish and edit files with Sublime Text

This article describes how to publish and edit files on an A2 Hosting server using Sublime Text.

Publishing and editing files on an A2 Hosting server

With Sublime Text, you can edit files directly on the server. Additionally, you can create files on your local computer, and then upload them to the server.

Before you can do either of these tasks, however, you must first install the SFTP (Secure File Transfer Protocol) extension for Sublime Text. To do this, follow these steps:

  1. If you have not already installed Package Control for Sublime Text, go to https://packagecontrol.io/installation and follow the instructions.
  2. Restart Sublime Text.
  3. On the Tools menu, click Command Palette.
  4. Scroll down the list, and then click Package Control:Install Package.
  5. Scroll down the list, and then click SFTP. Package Control installs the extension.
Editing files on the server

Sublime Text enables you to edit files directly on a remote server. To do this, follow these steps:

  1. Start Sublime Text.
  2. On the File menu, click SFTP/FTP, and then click Setup Server. Sublime Text opens the configuration file for the connection.
  3. Confirm that the “type” value is “sftp”.
  4. For the “host” value, replace example.com with your own domain name.
  5. For the “user” value, replace username with your A2 Hosting account username.
  6. Delete the two forward slashes (//) that start the “password” line. Replace the second occurrence of password with your own A2 Hosting account password.
  7. Delete the two forward slashes (//) that start the “port” line, and then replace 22 with 7822.
  8. For the “remote_path” value, replace /example/path/ with /home/username, where username represents your A2 Hosting account username.
  9. On the File menu, click Save.
  10. In the File name text box, type a name for the connection, and then click Save. A list of folders on the remote server appears.
    If the folder list does not appear, on the File menu, click Browse Server, and then click the name of the connection you just saved.
  11. Click a folder name to access the folder. When you click a filename, click Edit to edit the file. You can then edit the file directly on the server.
  12. Make any changes to the file that you want, and then on the File menu, click Save.
    Alternatively, you can press Ctrl+S.
  13. Sublime Text saves the changes to the file on the server.
Publishing files to the server

In addition to editing files on the server directly, you can upload files to your account using Sublime Text. To do this, follow these steps:

  1. Start Sublime Text.
  2. On the File menu, click Open Folder.
  3. Select the folder on your local computer where you want to want edit files, and then click OK.
  4. In the sidebar, right-click the name of the folder you selected in step 3, click SFTP/FTP, and then click Map to Remote. Sublime Text opens the configuration file for the connection.
  5. Confirm that the “type” value is “sftp”.
  6. For the “host” value, replace example.com with your own domain name.
  7. For the “user” value, replace username with your A2 Hosting account username.
  8. Delete the two forward slashes (//) that start the “password” line. Replace the second occurrence of password with your own A2 Hosting account password.
  9. Delete the two forward slashes (//) that start the “port” line, and then replace 22 with 7822.
  10. For the “remote_path” value, replace /example/path/ with /home/username, where username represents your A2 Hosting account username.
  11. On the File menu, click Save. All of the files and folders in the specified folder appear in the sidebar, along with many additional options. For example:
    • To upload a file to the server, right-click the file in the sidebar, click SFTP/FTP, and then click Upload File.
    • To download a file from the server, right-click the file in the sidebar, click SFTP/FTP, and then click Download File.
    There are many more options available for remotely mapped files and folders: you can view differences between files, synchronize files and folders, and more. For more information, please visit http://wbond.net/sublime_packages/sftp/usage.

More Information

For more information about Sublime Text, please visit https://www.sublimetext.com.