3

I often want to paste code from visual studio and find that I have too much of a left margin

As my question here does

Is there an easy way to correct the left margin to take up less space?

5
  • Not on the SO side AFAIK. I unindent it in the IDE before copying (e.g with Shift + tab) Commented Sep 14, 2014 at 10:52
  • 2
    Ctrl+K in the SO editor will dedent a code block if all of its lines share the same amount of "extra" indentation. Commented Sep 14, 2014 at 10:54
  • Didn't realise that. I've only ever used it for adding indentation to non indented code. Commented Sep 14, 2014 at 10:57
  • I just fixed it with Ctrl+K @FrédéricHamidi please put this as the answer
    – Kirsten
    Commented Sep 14, 2014 at 11:03
  • If you hold the Alt key down when selecting in VS, you get block-select. Commented Sep 14, 2014 at 15:24

1 Answer 1

5

As requested I will expand on my comment.

In the site's editor, selecting a code block then:

  • clicking the "Code Sample" {} button, or

  • hitting Ctrl+K

Will dedent the block by one level if all of its lines share the same amount of "extra" indentation.

You must log in to answer this question.

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