The default sublime text 2 does not have the SFTP/FTP function. If the editor comes with FTP, it will inevitably improve the development efficiency. Although sublime text 2 does not have the FTP function by default, it is easy to install the SFTP plug-in. The following are my installation steps, hoping to help those who like sublime text 2.
1. Install the package control plug-in (skip this step if you have installed the package control plug-in) through the sublime text 2 console. Click Ctrl +. Once opened, paste the following command to the console.
Import urllib2, OS; pF = 'package control. sublime-package '; IPP = sublime. installed_packages_path (); OS. makedirs (IPP) if not OS. path. exists (IPP) else none; urllib2.install _ opener (urllib2.build _ opener (urllib2.proxyhandler ()));
Open (OS. path. join (iPP, PF), 'wb '). write (urllib2.urlopen ('HTTP: // sublime.wbond.net/'{pf.replace ('', '% 20 ')). read (); print ('Please restart sublime text to finish installation ')
For example:
Then press Enter. If package control is successfully installed, close the editor.
2. If you press Ctrl + Shift + P on Windows and Linux platforms, and OS X press cmd + Shift + P, enter install to bring up the install package:
Press enter and wait for a few seconds to see:
Type SFTP, for example, and press Enter.
The installation is successful.
In this case, the SFTP/FTP option appears under the File menu. Select the setup server option to modify the following code:
{ // The tab key will cycle through the settings when first created // Visit http://wbond.net/sublime_packages/sftp/settings for help // sftp, ftp or ftps "type": "sftp", "sync_down_on_open": true, "host": "wangshangyou.com", "user": "", "password": "password", //"port": "22", "remote_path": "/", //"file_permissions": "664", //"dir_permissions": "775", //"extra_list_connections": 0, "connect_timeout": 30, //"keepalive": 120, //"ftp_passive_mode": true, //"ssh_key_file": "~/.ssh/id_rsa", //"sftp_flags": ["-F", "/path/to/ssh_config"], //"preserve_modification_times": false, //"remote_time_offset_in_hours": 0, //"remote_encoding": "utf-8", //"remote_locale": "C",}
Save and connect. The following describes how to upload a project:
In the toolbar, click Project-add folder to project... and select the project folder. In this way, the project folder appears on the left side, right-click the project, select ftpsync-setup ftpsync in this folder, and a configuration file sftp-config.json will be generated to modify the configuration file, the Code is as follows:
{ // The tab key will cycle through the settings when first created // Visit http://wbond.net/sublime_packages/sftp/settings for help // sftp, ftp or ftps "type": "ftp", "save_before_upload": true, "upload_on_save": false, "sync_down_on_open": false, "sync_skip_deletes": false, "confirm_downloads": false, "confirm_sync": true, "confirm_overwrite_newer": false, "host": "wangshangyou.com", "user": "", "password": "", //"port": "22", "remote_path": "/", "ignore_regexes": [ "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json", "sftp-settings\\.json", "/venv/", "\\.svn", "\\.hg", "\\.git", "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini" ], //"file_permissions": "664", //"dir_permissions": "775", //"extra_list_connections": 0, "connect_timeout": 30, //"keepalive": 120, //"ftp_passive_mode": true, //"ssh_key_file": "~/.ssh/id_rsa", //"sftp_flags": ["-F", "/path/to/ssh_config"], //"preserve_modification_times": false, //"remote_time_offset_in_hours": 0, //"remote_encoding": "utf-8", //"remote_locale": "C",}
In the project directory structure, right-click the file to upload, or enter a command in the command input box.
This completes.