一,package control
见:https://packagecontrol.io/installation#st3
1,(ctrl+~) [view->show console] - 输入下面代码,重启st
import urllib.request,os,hashlib; h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1'; 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)
2,
Click the Preferences > Browse Packages… menu
Browse up a folder and then into the Installed Packages/ folder
Download Package Control.sublime-package and copy it into theInstalled Packages/ directory
Restart Sublime Text
附st2:
安装Sublime text 2插件很方便手动安装 2 Package Control 的方法:
如果该方法不能正确的安装,也可以通过复制文件的方法直接安装。如果Sublime Text 2被安装在有中文的路径下,或者系统路径的%username%包含中文字符的话,可能需要进行手动安装。
打开Preferences菜单,并选择 Browse Packages…
系统会打开Sublime Text 2的Packages文件夹,回到上一级菜单,然后打开Installed Packages文件夹
下载并将下载的Package Control.sublime-package拷贝到Installed Packages文件夹(注意此处是Installed Packages,不是Packages文件夹)
重启Sublime Text 或
import urllib2,os,hashlib; h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1'; 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')
二,安装插件
perferences>package control,或tools>paltter(ctrl+shift+p)输入 install 选中Install Package并回车,输入或选择你需要的插件回车就安装了(注意左下角的小文字变化,会提示安装成功)
常用:
tag html格式化
emmet html简写
sublimeLinter 代码错误提示
Autoprefixer,CSS3 私有前缀自动补全插件,显然也很有用哇
JsFormat javascript格式化 按 Ctrl+Alt+[ 收缩CSS代码为一行显示,按 Ctrl+Alt+] 展开CSS代码为多行显示
CovertToUTF8 是把其他编码在Sublime Text中转换称UTF8编码,但是在保存的时候还是原来的那个编码。
SideBarEnhancements 侧边栏增强
点击工具栏的preferences > package setting > side bar > Key Building-User,键入以下代码,这里设置按Ctrl+Shift+C复制文件路径,按F1~F5分别在firefox,chrome,IE,safari,opera浏览器预览效果
[
// chrome
{ "keys": ["f2"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
"extensions":".*"
}
},
// firefox
{ "keys": ["f3"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:/Program Files (x86)/Mozilla Firefox/firefox.exe",
"extensions":".*"
}
},
// ie
{ "keys": ["f4"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:/Program Files/Internet Explorer/iexplore.exe",
"extensions":".*"
}
}
]
BracketHighlighter 高亮显示匹配的括号、引号和标签
TrailingSpaces 高亮显示多余的空格和Tab
Colorhightlight css色值呈现对应色
CSScomb CSS属性排序 可以自己自定义CSS属性排序规则,打开插件目录里的CSScomb.sublime-settings文件,更改里面的CSS属性顺序就行了。按C trl +S hift + C,即可对CSS属性重新排序了
配置tab键等于几个空格:preferences-setting user
"tab_size": 4,
- 输入pretty,并在列表中选择HTML-CSS-JS Prettify后回车即可安装
- 举例:
打开一个压缩的jquery.min.js文件,按下Ctrl+Shift+H