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


当前回答

这很简单。点击编辑=>Line=>Reindent

其他回答

选择所有你想要缩进的代码,然后在Sublime text中按Ctrl +]进行缩进。

对于macOS用户,使用command +]缩进,使用command +[取消缩进。

为了防止像我这样的人停止工作,在OS X中,命令键被标识为super,所以它应该能够做这样的事情:

[
    {
    "keys": ["super+i"], 
    "command": "reindent", 
    "args": {
        "single_line": 
        false}
    } 
]

在这种情况下,使用command+i将缩进你的整个代码(像eclipse一样:))

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

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

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

对于那些喜欢IntelJ IDEA的默认键绑定的人,选择Preferences > Settings -用户:

并粘贴下面的命令,有命令+ shift + l快捷方式自动缩进:

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

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