如何复制和粘贴没有富文本格式的代码?

我过去经常发现自己复制一段来自网站/Word 文档等的代码,结果发现在做粘贴时,我会得到所需的代码,外加一些额外的 HTML 标记/文本,基本上就是额外的格式信息。

为了摆脱额外的压舱物,我会将文本粘贴到记事本,然后再次复制它,然后粘贴到所需的目的地。

最近,我发现了一个简单而免费的 Windows 工具 纯文本,它可以让我删除记事本步骤。它基本上增加了一个额外的快捷键,例如 WinKey + V,它可以在没有格式化的情况下完成粘贴操作,只是纯文本。 我觉得很方便。

我想知道你们自己会使用什么方法? 它们是否更好/更容易使用工具?

130125 次浏览

From websites, using Firefox, I use the CopyPlainText extension.

If you're pasting into Word you can use the Paste Special command.

Look for a little clipboard icon that pops up at the end of the material you pasted. Click on this and choose "keep text only".

I use OpenOffice.org and that offers a paste special option, where you can omit the formatting altogether. If you are not bound to MS Word, it's IMO worth a try and it's free :-)

Nice find with your PureText. I had build, before I change keyboard, a key that was running a macro that was copying-pasting-copying in notepad for this task! I'll give a try to your software since I do not have any macro key now :(

Just for reference, under Mac OS X, you can use ⌘ Command+⇧ Shift+V to paste without formatting or with the "current" format.

Note: in some apps it's ⌘ Command+⇧ Shift+⌥ Alt+V (see "Edit" Menu → "Paste and Match Style")

Whenever these plugins and options aren't available I just use my good ol friend notepad. Paste content into notepad where it won't accept the extra formatting and then copy it right back out. Sort of hacky but oh well. It works!

I usually work with Notepad2, all the text I copy from the web are pasted there and then reused, that allows me to clean it (from format and make modifications).

You can download Notepad2 here

I wrote an unpublished java app to monitor the clipboard, replacing items that offered text along with other richer formats, with items only offering the plain text format.

I have Far.exe as the first item in the start menu.

Richtext in the clipboard ->

ctrl-escape,arrdown,enter,shift-f4,$,enter
shift-insert,ctrl-insert,alt-backspace,
f10,enter

-> plaintext in the clipboard

Pros: no mouse, just blind typing, ends exactly where i was before

Cons: ANSI encoding - international symbols are lost

Luckily, I do not have to do that too often :)

If you are using MS Word then try ALT+E, S, U, Enter (Uses the Paste Special)

I'm a big fan of Autohotkey. I defined a 'paste plain text' macro that works in any application. It runs when I press Ctrl+Shift+V and pastes a plain version of whatever is on the clipboard. The nice thing about Autohotkey: you can code things to work the way you want them to work across all applications.

^+v::
; Convert any copied files, HTML, or other formatted text to plain text
Clipboard = %Clipboard%


; Paste by pressing Ctrl+V
SendInput, ^v
return

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 ⌥ Alt0)
  • 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