How to enable auto-align in Sublime Text 3?

Utkarsh Gupta picture Utkarsh Gupta · May 25, 2017 · Viewed 17.6k times · Source

I want to auto-align my code to make it easier to read, in a click. I'm working on Sublime Text 3 and want to know about a method through which I can enable suto-indent of the code in just a click.

Answer

Utkarsh Gupta picture Utkarsh Gupta · May 25, 2017

In the title bar, go to Preferences > Key Bindings, then add this binding to "Key Bindings - User" file.

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

Now whenever you want to auto-align your code, just highlight the desired code and press alt+shift+f

Source: https://coderwall.com/p/7yxpdw/auto-indenting-on-sublime-text-3