Is there an auto indentation option in Sublime 2?
In Visual Studio I can press Ctrl+K+D to indent everything so the code is structured nicely. Is there a shortcut in Sublime 2 to do the same?
For the built in solution I like to add the option
But this does not add new lines, as you should expect on some XML and HTML code editing.
For those you should follow Tom's answer and install the Tag plugin, or use the Indent XML plugin, available also via package control but works only on XML files.
If you choose the Tag plugin, the easiest way to use it is highlight the text to indent and then press the shortcut Ctrl+Shift+F.
If you choose the Indent XML plugin press Ctrl or Super+Shift+P and then I and the
Press Ctrl+Shift+P, then I, and the option "Indentation : Reindent Lines" should come first.
Press Enter and it's done.
You can use the Edit / Line / Reindent from the edit menu. Or you could try adding this to your keybindings - Default file from preferences.
Add a comma at the end of the code if you use the Default file instead of the users. Don't forget to select what you want indented.
You could potentially just use Visual Studio to auto-indent more obscure data that SubT can't or doesn't do well.
Good luck && select the text you want to reindent.