In Visual Studio I can press Ctrl+K+D to indent everything so the code is structured nicely and readable. Is there a shortcut in Sublime 2 t
Go to Preferences
> Key Bindings
> User
and add the code below:
[
{ "keys": ["ctrl+shift+f"], "command": "reindent", "args": {"single_line": false} }
]
Usage
Ctrl + Shift + F
I used to use Alt + Shift + F in NetBeans, I checked and there isn't any collision in the default keymap array of sublime, so I added it to my sublime and I'm using it without any problem.
Select everything, or whatever you want to re-indent and do Alt+ E+L+R. This is really quick and painless.
It is very simple. Just go to Edit=>Line=>Reindent
Select all code that you intend to indent, then hit Ctrl + ] in Sublime text to indent.
For macOS users, use command + ] to indent, and command + [ to un-indent.
This is my configuration for sublime-keymap:
[
{
"keys": [",+=+="],
"command": "reindent",
"args": {
"single_line": false
}
}
]
For vim people, just use ,==
to reindent the whole file.