Copy-paste code from Visual Studio, but paste UNFORMATTED code

25,527

Solution 1

Visual Studio does put unformatted text on the clipboard, but it also puts formatted text. (The clipboard supports multiple simultaneous formats, and the OS assumes that they're simply different representations of the same data, although there's no technical enforcement of that point.)

The application you're using to paste then chooses its preferred format. In Word, and maybe Outlook as well, there is a "Paste Special" command that allows you to choose which format you want to use.

Solution 2

My department uses PureText. Sits in the system tray; copy text, click-it - strips all formatting leaving the plain-vanilla text. I'm sure it's much like PlainTextClipboard.

"PureText is basically equivalent to opening Notepad, doing a PASTE, followed by a SELECT-ALL, and then a COPY. The benefit of PureText is performing all these actions with a single Hot-Key and having the result pasted into the current window automatically."

The goad for this was flaky Lotus Notes; likes to crash when pasting HTML-marked-up-text that I innocently copied from a web-page....

Solution 3

If you press CTRL+Z after pasting, it will reverse to the non-formatting one, because the formatting actually counts as one step after the regular paste.

Solution 4

This feature can be turned off by editor.copyWithSyntaxHighlighting.

Solution 5

When I do it choosing the little pop-up menu option attached to the wee clipboard item "Match Destination Formatting" does the trick for me.

Share:
25,527
Richard Ev
Author by

Richard Ev

Creator of things Learner of stuff Helper of others Once fended off an elephant with a laptop * * my laptop, not the elephant's

Updated on July 09, 2022

Comments

  • Richard Ev
    Richard Ev almost 2 years

    Is there any way to force Visual Studio to copy selected code to the clipboard as unformatted text?

    When I am copy-pasting code into Word or more often Outlook I have to do it via Notepad to get rid of the formatting...there has to be an easier way!

    • bohdan_trotsenko
      bohdan_trotsenko over 14 years
      Ah! I always do it via notepad.
    • Brian Zelip
      Brian Zelip over 4 years
      If you came for the VS Code problem of pasting formatted copied text, the solution is to turn off the on-by-default setting "Copy With Syntax Highlighting". Why any text editor would do this by default is extra bizarre!
    • Sergey Kalinichenko
      Sergey Kalinichenko about 3 years
  • vincenth
    vincenth about 15 years
    Paste Special is the way I do it
  • Richard Ev
    Richard Ev about 15 years
    Office 2003 features that option in Word, but not Outlook. (I think that Outlook 2007 has it though...)
  • Richard Ev
    Richard Ev about 15 years
    For some reason "Paste Special" always seems to be disabled in Outlook 2003
  • Richard Ev
    Richard Ev about 15 years
    Fancy signature...oh yes! Our corporate standard signature uses Arial in a specific shade of blue, formatted in an HTML table with our company logo...
  • Rob Kennedy
    Rob Kennedy about 15 years
    It's enabled for me in Outlook 2007, so I don't know what else to say. Good luck.
  • Patrick Szalapski
    Patrick Szalapski over 14 years
    I've seen this called a "clipboard scrubber". A similar program is ClipboardFusion - binaryfortress.com/clipboardfusion . Instead of copy-paste, the operation becomes copy-paste-realize it is ugly-scrub clipboard-paste.
  • Patrick Szalapski
    Patrick Szalapski over 14 years
    Or PureText, as another answer suggested.
  • Rob Kennedy
    Rob Kennedy over 14 years
    Patrick, the applications that don't support "paste special" are also usually the ones that don't support formatted text anyway. They'll always select the unformatted text because that's the only thing they check for and the only thing they support.
  • Patrick Szalapski
    Patrick Szalapski over 14 years
    Unfortunately, that isn't true about Microsoft Office Communicator, which I paste into all the time.
  • harry
    harry almost 14 years
    Beautiful and free! I expected it from your description to be payware and was going to sit up tonight and make a free replacement, yet lo and behold, it's free software! Thanks for sharing: )
  • ColinCren
    ColinCren over 9 years
    I'm with Patrick on this one, office communicator is annoying for that reason, it takes the formatted version but doesn't allow you to use Paste Special...
  • Michael Paulukonis
    Michael Paulukonis over 7 years
    @PaulMolloy - I'm still using it, only I've got it mapped to Windows-V to paste unformatted text. I totally missed using the hotkeys option until recet months. Doh!
  • Slate
    Slate over 5 years
    Though this may be by convention in Microsoft products, this is not the case for other applications.
  • Fopedush
    Fopedush over 2 years
    I suspect you are thinking of Visual Studio Code, which is a completely different piece of software.
  • Hashaam Ahmed
    Hashaam Ahmed about 2 years
    This ans might not be related to the question but I was looking something for vs code and it worked well, thanks!!