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
Just in case this stop working for anyone like me, in OS X, the command key is identified as super
so it should be able to do something like this:
[
{
"keys": ["super+i"],
"command": "reindent",
"args": {
"single_line":
false}
}
]
in this case using command+i is going to indent your whole code (eclipse like :) )
For those who like the default key binding for IntelJ IDEA, select Preferences > Settings - User:
And paste in the following to have the command + shift + l shortcut for auto indent:
[
{ "keys": ["command+shift+l"], "command": "reindent"}
]
No one seems to love mac re-indentation, So here How I do it:
[
{ "keys": ["command+shift+i"], "command": "reindent"}
]
In Preferences > Key Binding - User
One more extra tip: add
{ "keys": ["command+0"], "command": "focus_side_bar" }
to have sidebar file tree view navigation using keyboard.
Note: Add , at the end of each {}, if you have more than one {} set of objects
For Auto-Formatting in Sublime Text 2: Install Package: Tag from Command Palette, then go to Edit -> Tag -> Auto-Format Tags on Document
To indent with the same keys like Visual Studio Ctrl+K+D (I am a Visual Studio user so I am used to this combination) I suggest:
[
{ "keys": ["ctrl+k", "ctrl+d"], "command": "reindent", "args": {"single_line": false} }
]
Write this on Preferences>Key Bindings - User
Beside of the inbuilt 'reindent' function, you can also install other plugins, such as SublimeAStyleFormatter and CodeFormatter. These plugins are better for their specify language.