且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Sublime text 2 中缩进代码?

更新时间:2022-12-27 16:39:51

你可以在EditLineReindent中找到,但是默认情况下它没有快捷方式.您可以通过转到菜单PreferencesKeybindingsUser 添加快捷方式,然后在那里添加:

You can find it in EditLineReindent, but it does not have a shortcut by default. You can add a shortcut by going to the menu PreferencesKeybindingsUser, then add there:

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

(使用 F12 键实现该功能的示例)

(example of using the F12 key for that functionality)

配置文件使用 JSON 语法,因此这些大括号必须以逗号分隔放置在默认情况下的方括号中.如果您还没有任何其他键绑定,那么您的整个 KeybindingsUser 文件当然看起来像这样:

The config files use JSON-syntax, so these curly braces have to be placed comma-separated in the square-brackets that are there by default. If you don't have any other key-bindings already, then your whole KeybindingsUser file would look like this, of course:

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