What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

I know that if I press ctrl + k I automatically can add 4 spaces, but what if the code has already 4 spaces and I need to add 4 spaces more to it?

If I press tab in the SO editor it just gets me down in the page. It often happens that I have to edit a question that has bad indentation, like this code snippet example (casual, purely invented):

void foo()
printf("I haven't understood how to indent well");

So in this case how do I add 4 spaces to the printf line?

Do I have to cut-paste it to an editor or I can do it on the SO editor?

share|improve this question
I delete one character at the beginning of the block, select it, press ctrl-k and then re-add the missing space to the first line as a "minimal key press" strategy. – Flexo Jan 5 '13 at 23:56
But if I have a block of code of 30 lines I have to do it 30 times, and I'm lazy :) – Ramy Al Zuhouri Jan 6 '13 at 0:00
I do pull the code into an editor, but the SO editor knowing how to fix indentation would be pretty cool – Michael Mrozek Jan 6 '13 at 0:05
Do it beforehand in a code editor. – BalusC Jan 6 '13 at 0:09
@Chichiray "it often happens that I have to edit a question that has bad indentation" – Michael Mrozek Jan 6 '13 at 0:16
@Michael: oh right. In extreme cases (more than, say, 10 lines) I just copypaste to Eclipse, Ctrl+Shift+F and copypaste back. – BalusC Jan 6 '13 at 0:21

2 Answers 2

up vote 5 down vote accepted

Say you have indented code


(just much longer) and you want to indent a bunch of consecutive lines.

Place a random letter at the start of the first line you want to indent further,

a    rem

select the lines you want to indent, ctrl+K, and delete the random letter.

share|improve this answer

There is some browser script, which is described thus:

This user script changes the behavior of a few keys (most notably the Tab key) within the post editor to behave more like it does in IDEs or text editors.

Me loves it.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .