Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 298
Richard Ev Avatar asked Feb 05 '09 15:02

Richard Ev


People also ask

How do you paste without formatting in VS code?

Linux/Windows: Ctrl+Shift+C. Mac: Shift+⌘+C.

How do I copy plain text from Visual Studio code?

Keyboard shortcut "Ctrl+Alt+C" which will copy the currently selected text to the clipboard with no formatting.

How do you paste with formatting code in Visual Studio?

Ctrl+V, Edit > Paste, Right Click > Paste. It should all just work!


2 Answers

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.

like image 115
Rob Kennedy Avatar answered Oct 05 '22 00:10

Rob Kennedy


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....

like image 20
Michael Paulukonis Avatar answered Oct 05 '22 00:10

Michael Paulukonis