Sublimetext installs packagecontrol and HTTP proxy configuration

Time:2020-2-13

PressCtrl+\`Call up the sublime command line and enter the command:

Sublime Text 3

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Sublime Text 2

import urllib2,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

Manual installation

You may not be able to install with code due to various reasons. You can install package control manually through the following steps:

1. ClickPreferences > Browse Packagesmenu
2. Enter the upper directory of the opened directory, and then enterInstalled Packages/Catalog
3. Download package control.sublime-package and copy it toInstalled Packages/Catalog
4. restartSublime Text

Configuration agent

Due to the back wall of the website, the plug-in cannot be installed. You need to configure HTTP proxy at this time.

  1. openPreferences > Package Settings > Package Control > Settings - Usermenu

  2. editPackage Control.sublime-settings, add two lines:

"http_proxy": "http://127.0.0.1:8123",
"https_proxy": "http://127.0.0.1:8123"

It must be noted that the configuration file should not be mistaken. The owner of the building has stepped on the pit….
Sublimetext installs packagecontrol and HTTP proxy configuration

For students using shadowsocks, since SS is a Socks5 proxy, you need to convert it into an HTTP proxy. You can use a polipo on SS to implement it.

polipo socksParentProxy=localhost:1080

#Recommended to run in the background
nohup polipo socksParentProxy=localhost:1080 > /tmp/polipo.log &

Reference resources

  • Package Control INSTALLATION

  • Turning shadow locks into HTTP proxy with polipo

Recommended Today

[quick reference table] phpstorm shortcut key

Common shortcut keys (in case of keymaps: default) Query shortcut function CTRL+N  Lookup class CTRL+SHIFT+N   Find the file and open the file in the project (similar to Ctrl + Shift + R in eclipse), so as to open the file in any directory under the current project CTRL+SHIFT+ALT+N  Find a method or variable in a […]