0

What i want?

When i write a code sample in {} <code> segment i want to tab a line with use a specific keyword (like 'TAB').

Standart Code :

for(int i=0;i<10;i++){
sayHello("Hello World");
}

Beauty Code :

for(int i=0;i<10;i++){
    sayHello("Hello World");
}

Problem

When i hit TAB or Shift+TAB stackoverflow change the textarea box in html.

What i am doing?

For tabbing a line in a code segment i am using SPACE four times and it so annoying for me?

How can i solve this problem?

Is there any specific keyword for tab a line in a code segment?

3
  • You solve this problem by typing code in an editor and just pasting it here. Alternatively, copy/paste four spaces, so you have an “indent key combination”.
    – poke
    Nov 17, 2015 at 7:49
  • I think stackoverflow gives us a specific key for this.
    – hurricane
    Nov 17, 2015 at 7:57
  • You can use Ctrl+K, but it will only indent the line if it's not yet indented (less than 3 spaces). If you try to indent it again by Ctrl+K, it will remove the indent instead.
    – Andrew T.
    Nov 17, 2015 at 8:00

1 Answer 1

1

Tab isn't implemented as indentation "key", in the SO editor. You're gonna have to manually add the indentation.
You don't need to press Space 4 times for each tab, though:

  1. Space * 4
  2. Ctrl + C
  3. Ctrl + V
  4. Repeat step 3 where necessary.

Or, if your code isn't indented yet:

  1. Select it
  2. Ctrl + K

This should properly indent your code.

1
  • Ctrl+K is enough but only my code isn't indented.
    – hurricane
    Nov 17, 2015 at 8:27

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