Sublime Forum

Indentation of code

#1

Is there a way to indent a block of code like in Textmate (Indent Selection: Command + Alt + ) ? What this does it aligns everything nicely.

0 Likes

#2

No built in functionality of making it happen?

0 Likes

#3

What does this combination exactly do? You do not have to select the block and entire block is idented, yes?

Because if you have to select the block you can use just Tab and Shift+Tab, but I guess this wasn’t what you meant.

0 Likes

#4

It appears that this key combo “fixes” indentation; that is, it can convert something like:

int main() { return 0; }
to:

int main() { return 0; }
if you just select all the text and hit that key combo.
This would actually be pretty nice to have in ST2.

0 Likes

#5

That would require a built-in parser for every language to know where the indents should be.

You could write your own in Python though.

I’ve started one for PHP :smile:

0 Likes

#6

How does Textmate do this? Does it just indent every block within fold markers?

0 Likes