1、离线安装controll package
2、离线安装pretty json
cd
(for example on Mac it is ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
or ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
)git clone https://github.com/dzhibas/SublimePrettyJson.git
3、更改pretty json快捷键
因为pretty json快捷键用着不爽,
在preferences里面,key binds更改
{ "keys": ["ctrl+alt+j"], "command": "join_lines" },//这个是原生的ctrl+j, 是把非一行的变成一行。感觉和pretty json是反着来的,也可以是任何非json的,比pretty自带的快捷键好用。
{ "keys": ["ctrl+j"], "command": "pretty_json" },//这个就是改进后的新快捷键
我的快捷键:
[
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} },
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+shift+f"], "command": "reindent" , "args": {"single_line": false}},
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
{ "keys": ["shift+ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+shift+s"], "command": "save_all" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["shift+ctrl+f4"], "command": "close_all" },
{ "keys": ["shift+ctrl+y"], "command": "lower_case" },
{ "keys": ["shift+ctrl+x"], "command": "upper_case" },
{ "keys": ["ctrl+alt+j"], "command": "join_lines" },
{ "keys": ["ctrl+j"], "command": "pretty_json" },
]