Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Are there any good ways to copy code from Visual Studio that keeps the code neat looking? I have two main concerns that are large enough for me to raise this question:

  1. When copying multiple lines of code from a nested code block, the leading whitespace on every line should be removed. This one is easy to fix manually though, by simply using shift + tab until it aligns as it should. Still something I'd like to avoid though.
  2. More importantly, however, is when copying from code where the setting "replace with tabs" is used, the indetions will be huge when copied to e.g. Notepad, making the code practically unreadable.

I'm hoping for a one-click solution here, be it an Add In or Macro, that does not matter, as long as I can select a block of code, and then copy it with one click, and have it look well when I paste it somewhere else.

share|improve this question
Have you tried pasting the code into something else? For example Notepad++? –  Shiki Jul 2 '12 at 22:35
@Shiki: I thought that was quite clear from my question. :) Yes, and my problem is mainly spacing, which I what I would like to control, or at least have a better default. –  Johny Skovdal Jul 3 '12 at 6:29
Oh. Okay, sorry. Uhm... what about some kind of "Clipboard control"? Like writing a small C# application, that will run in the tray, and use that with a hotkey. So when you copy from VS, you get the format you want. .... hmmm.. maybe it's an overkill, but hey, better than nothing! –  Shiki Jul 3 '12 at 10:54

1 Answer 1

If HTML output is okay, there is an extension called Copy as HTML.


share|improve this answer
For most scenarios that won't work no, but thank you for pointing this one out though, it certainly can come in handy. :) –  Johny Skovdal Jul 3 '12 at 6:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.