Search code examples
editorcopy-paste

How to copy and paste code without rich text formatting?


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?


Solution

  • Just to summarize the available options:

    Tools

    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