This doesn’t come with it’s own keyboard shortcut, but this helpful feature is available in Sublime Text and you can create your own key binding for it. Here’s how you do it.
Automatically Reindent Code
You can find the reindent menu item in
Edit > Line > Reindent. Select the text that you would like to reindent before using the menu item.
Create a Sublime Text Keybinding for Reindent
For Mac OSX, Linux, and Windows users, the keybindings settings file can be found in the menus
Preferences > Keybindings - User. If you haven’t set new keybindings previously the default keymap file JSON looks like this:
1 2 3
Add a JSON object that includes your key(s) and the Sublime Text command. The available key names are listed in the Sublime Text documentation (see the Key Names section).
The general pattern for your settings object looks like this:
1 2 3
For the reindent command, you could set it to the F10 key like so:
1 2 3
Or if you prefer to set a multi keystroke binding, simply add a
+ symbol between the key names with no spaces.
Kudos to eznme who provided an answer to this question on Stack Overflow.