1.安装Package Control
①使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码
</pre>Sublimte 3<pre name="code" class="plain">import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
Sublimte 2
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')
2、手动安装Package Control
可能由于各种原因,无法使用代码安装,那可以通过以下步骤手动安装Package Control:
①.点击Preferences > Browse Packages菜单
②.进入打开的目录的上层目录,然后再进入Installed Packages/目录
③.下载Package Control.sublime-package并复制到Installed Packages/目录
④.重启Sublime Text
3.sublime启用格式化快捷键
Edit -> Line -> Reindent
其实在sublime中已经自建了格式化按钮只是sublime并没有给他赋予快捷键,所以只需加上快捷键即可
Preference -> Key Bindings -user
括号内添加
{ "keys": ["ctrl+shift+l"], "command": "reindent" }