Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy and paste code without rich text formatting? [closed]

I used to often find myself coping a piece of code from a website/Word document etc only to discover that when doing Paste I would end up with the desired code plus some extra HTML tags/text, basically extra formatting information.

To get rid of that extra ballast I would paste the text to the Notepad and then copy it again and then paste to the desired destination.

Pretty recently I discovered a simple and free tool for Windows called PureText that allows me to cut the Notepad step. It basically adds an extra keyboard shortcut e.g WinKey + V that will do the Paste action without formatting; just pure text. I find it very handy.

I was wondering what approach would you use yourselves? Are they any better/easier to use tools around?

like image 957
kristof Avatar asked Sep 23 '08 17:09

kristof


People also ask

How do I copy and paste without messing up formatting?

You'll get just the text you copied as if you had typed it directly into the application you're pasting it in. To paste without formatting, press Ctrl+Shift+V instead of Ctrl+V. This works in a wide variety of applications, including web browsers like Google Chrome. It should work on Windows, Chrome OS, and Linux.

How do I copy and paste code with formatting?

Select the portion of code you'd like to copy, then go the Edit menu and select Copy Special -> Copy as RTF. Your code, complete with syntax highlighting colors, is now stored on the clipboard. Simply press Ctrl + V in your other application to paste the code with syntax highlighting. It's that simple!


1 Answers

Just to summarize the available options:

Tools

  • PureText - free tool for Windows
  • Use AutoHotkey and write your own macro as suggested by Dean

Browsers

  • To copy plain text from a browser: Copy As Plain Text or CopyPlainText (suggested by cori) - Firefox extensions
  • To paste without formatting to a browser (Firefox/Chrome at least): CTRL+⇧ Shift+V on Windows/Linux, see below for Mac OS X.

Other

  • Under Mac OS X, you can ⇧ Shift+⌥ Alt+⌘ Command+V to paste with the "current" format (Edit -> Paste and Match Style); or ⌘ Command+⇧ Shift+V to paste without formatting (by Kamafeather)
  • Paste to Notepad (or other text editor), and then copy from Notepad and paste again
  • For single-line text: paste to any non-rich text field (browser URL, textarea, search/find inputs, etc.)

Please feel free to edit/add new items

like image 152
6 revs, 5 users 71% Avatar answered Sep 18 '22 13:09

6 revs, 5 users 71%