Auto-indent in Sublime Text 3

Post date: Nov 30, 2014 7:37:40 PM

Here is the great resource that works for me:

http://stackoverflow.com/questions/9495007/indenting-code-in-sublime-text-2

You can manually do so 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. In this case I want "ctrl+shift+f" to be my shortcut:

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

In the file you might see the square bracket, add your shortcut script there and save it. If it's your first time adding any shortcut it should look like this.

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

Now you can use it by pressing "ctrl+shift+f" to auto-indent the highlighted part. Without highlights the entire document will be auto-indented.