-5

Possible Duplicate:
How do I format my code blocks?

I'm looking to ask a few questions, but, unless I want to individually indent 2000 lines of code with 4 spaces each, I'm not going to get to ask the questions.

Surely there is an easier way to do this for non-techies who don't know what "emacs" are or how to use them.

Can anyone point me to a simple solution for this problem?

I'm using Windows Vista Home Premium

4
  • 17
    Nobody is going to sit there and read 2000 lines of code regardless of how you indent it, you need to at least narrow down where you think your problem is and ask a very specific question.
    – user439407
    Commented Aug 24, 2012 at 1:35
  • It would be nice to have a button in the editor that indents the highlighted text by 4 spaces.
    – Ariel
    Commented Aug 24, 2012 at 1:38
  • 5
    @Ariel there is, it looks like this: {}
    – Aaron Bertrand Staff
    Commented Aug 24, 2012 at 1:40
  • @AaronBertrand Thanks! When I tried it, it just added tick marks, but after your comment I experimented more and I see it will indent as well if you highlight entire lines.
    – Ariel
    Commented Aug 24, 2012 at 1:45

3 Answers 3

6

If you select text in the question box and click the "{}" button it will indent it for you.

You should not, however, be pasting in 2000 lines of code. Post a short, self contained correct example.

Also, making jokes about how you don't know what something is that you could Google easily is going to result in people thinking you haven't bothered to research your own question before asking for help first.

4

Questions regarding etiquette on StackOverflow (or other sites, for that matter) are more appropriate for their meta sites (see the link near the top of your screen).

As far as indenting, most reasonably powerful editors nowadays enable you to indent a block of selected code, and they also allow you to set how many spaces a tab is. So it is a matter only of finding a proper editor. Vim, Emacs, Sublime text2, Notepad++, ... although I've not used every single one of them, I'm guessing they all have this feature.

But, if you're asking questions and need to paste 2000 lines of code, your questions are most likely not to get answered. Shorten your code to a minimal working example which still illustrates the problem, and paste that. It shows effort on your part which then in turn motivates others to do some on their part.

3

If you have a large code block, you can highlight it and hit the curly braces button {}. But I agree with the commenter - if you're trying to post 2000 lines of code, and expecting to get free help, good luck...

1
  • 3
    @Robert - Just in case it's not clear, Aaron is being sarcastic when he says "good luck". Posting 2000 lines of code will only contribute to your automated question ban.
    – jmort253
    Commented Aug 24, 2012 at 2:28