Home Download Buy Blog Forum Support

Indentation of code

Indentation of code

Postby Rafalski on Tue Mar 29, 2011 11:48 pm

Is there a way to indent a block of code like in Textmate (Indent Selection: Command + Alt + [ ) ? What this does it aligns everything nicely.
Rafalski
 
Posts: 2
Joined: Tue Mar 29, 2011 11:40 pm

Re: Indentation of code

Postby Rafalski on Wed Mar 30, 2011 5:09 pm

No built in functionality of making it happen?
Rafalski
 
Posts: 2
Joined: Tue Mar 29, 2011 11:40 pm

Re: Indentation of code

Postby qqq on Wed Mar 30, 2011 6:08 pm

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.
qqq
 
Posts: 57
Joined: Tue Mar 08, 2011 9:49 am

Re: Indentation of code

Postby adzenith on Wed Mar 30, 2011 6:30 pm

It appears that this key combo "fixes" indentation; that is, it can convert something like:
Code: Select all
int main()
{
return 0;
}

to:
Code: Select all
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.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Indentation of code

Postby jbrooksuk on Thu Mar 31, 2011 1:54 pm

adzenith wrote:This would actually be pretty nice to have in ST2.

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 :)
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Indentation of code

Postby adzenith on Thu Mar 31, 2011 4:11 pm

How does Textmate do this? Does it just indent every block within fold markers?
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests