How To Auto-indent Code In Sublime Text 3?

Daily post #12 – Today’s post is a simple one but again it’s something which will save you plenty of time. How do you auto-indent code in Sublime Text 3?

Method #1 – You just press command+shift+p and type in reindent. This will give a list of results. Just hit enter as you want to select the first option in there. And that’ll add the correct indentation to your code.

Method #2 – You assign a shortcut to method #1 to cut down the whole process to a single step. For this, you’ll need to add the following code to your key binding in Sublime:

{"keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false}}

I use command instead of alt, but it’s totally up to you! I learned these two tips from this StackOverflow page.

That’s all for this post, I hope you find this useful 🙂