[SublimeText] 安装包管理

由于各种访问原因,因此记录一下给自己使用,原文地址如下:

http://www.bonusbits.com/wiki/HowTo:Setup_Package_Control_for_Sublime_Text

 

Method 1 (Sublime Text Script)

This will not work if you are behind a proxy. If you're behind a proxy use Method 2.

  1. Open Sublime console
    CTRL+`
  2. Sublime Text 2
    import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path()os.makedirs(ipp if not os.path.exists(ippelse Noneurllib2.install_openerurllib2.build_openerurllib2.ProxyHandler()))openos.path.join( ipp, pf)'wb' ).writeurllib2.urlopen'http://sublime.wbond.net/' +pf.replace' ','%20' )).read())print'Please restart Sublime Text to finish installation')
  3. Sublime Text 3
    import urllib.request,os,hashlib; h 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d';pf 'Package Control.sublime-package'; ipp = sublime.installed_packages_path()urllib.request.install_opener(urllib.request.build_openerurllib.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 elseopen(os.path.join( ipp, pf)'wb' ).write(by)
  4. Restart Sublime

 

Method 2 (Manually)

If you are behind a proxy use this method. After installing then set your proxy settings

  1. Download plugin file
    http://sublime.wbond.net/Package%20Control.sublime-package
  2. Copy Package Control.sublime-package to the Install Packages folder under Sublime Text install folder.
    1. Windows
      C:\Users\username\AppData\Roaming\Sublime Text 2\Installed Packages
    2. Mac
      sudo cp ~/Downloads/Package\ Control.sublime-package ~/Library/Application\ Support/Sublime\ Text\3/Installed\ Packages/
  3. Restart Sublime

 

相关文章:

http://blog.jobbole.com/82527/

posted @ 2016-01-02 10:29 DavidHHuan 阅读(...) 评论(...) 编辑 收藏