Indenting code in Sublime text 2?

后端 未结 20 2256
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 17:19

In Visual Studio I can press Ctrl+K+D to indent everything so the code is structured nicely and readable. Is there a shortcut in Sublime 2 t

20条回答
  •  有刺的猬
    2020-11-28 17:49

    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} }  
    

    (example of using the F12 key for that functionality)

    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}}
    ]
    

提交回复
热议问题