Reindenting Code in Sublime Text

Surprisingly Sublime Text (2 & 3 at least) don’t have a default keyboard shortcut for re-indenting code. I like the shortcut ⌘ ⇧ r (command + shift + r), because it’s fairly easy to remember.

You can add this mapping by going to Sublime Text > Preference > Keybindings - User and adding the following:

[
  {"keys": ["super+shift+r"], "command": "reindent" }
]

You’ll need to restart Sublime Text. Now you can easily re-indent an entire file by hitting ⌘ a (to select all) and then ⌘ ⇧ r

comments powered by Disqus