在Visual Studio中,我可以按Ctrl+K+D来缩进所有内容,因此代码结构很好,易于阅读。在Sublime 2中有捷径可以做到这一点吗?


当前回答

使用Visual Studio Ctrl+K+D等相同的键缩进(我是Visual Studio用户,所以我习惯了这种组合),我建议:

[
{ "keys": ["ctrl+k", "ctrl+d"], "command": "reindent", "args": {"single_line": false} }
]

写在首选项>键绑定-用户

其他回答

选择所有东西,或者任何你想要重新缩进的东西,按Alt+ E+L+R。 这是非常快速和无痛的。

{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false} } 

您可以通过使用上面的代码获得reindent选项

reindent命令只对当前选中的行起作用,除非"single_line"参数设置为false。

{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false} }

现在,按f12将重新缩进整个文档。

似乎没有人喜欢mac重缩进,所以我是这样做的:

[
   { "keys": ["command+shift+i"], "command": "reindent"}
]

在Preferences中> Key Binding -用户

还有一个额外的建议: 添加

{ "keys": ["command+0"], "command": "focus_side_bar" }

要有侧边栏文件树视图导航使用键盘。

注意: 如果您有多个{}对象集,则在每个{}的末尾添加

你可以通过菜单Preferences→Keybindings→User添加快捷方式,然后添加:

{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false} }