插件下载地址:https://gist.github.com/2863474
插件,可以将CSS格式化成一行,也可以将一行格式化成多行。
下载解压缩之后,将compact_expand_css_command.py放到
*Sublime Text 2PackagesUser [windows下一般在安装盘/用户:例:C:UsersxwAppDataRoamingSublime Text 2PackagesUser]
然后,重启一下st2,选择Preferences>Key Bindings - User
加入以下代码:
{ "keys": ["ctrl+shift+]"], "command": "compact_expand_css", "args": { "action": "expand" } },
{ "keys": ["ctrl+shift+["], "command": "compact_expand_css", "args": { "action": "compact" } }
保存,现在再试一下就OK啦!
个人常用对Key的习惯性配制
[
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ // Emmet: Zencoding
"keys": [
"ctrl+enter"
],
"command": "expand_as_you_type",
"context": [
{
"operand": false,
"operator": "equal",
"match_all": true,
"key": "setting.is_widget"
},
{
"match_all": true,
"key": "emmet_action_enabled.expand_as_you_type"
}
]
},
{ "keys": ["ctrl+alt+o"], "command": "alignment" },
{ "keys": ["ctrl+shift+]"], "command": "compact_expand_css", "args": { "action": "expand" } },
{ "keys": ["ctrl+shift+["], "command": "compact_expand_css", "args": { "action": "compact" } }
]