Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to copy code from the Eclipse IDE without the rich-text formatting?

Recently every time I copy a block of code from Eclipse and paste the code into TextEdit or a online forum using the code tags, I get the code with the rich-text or html formatting, so I have to copy into a text editor remove the formatting copying and pasting again, In the past this was not a problem I used to copy from eclipse and paste the code without any formatting at all just as plain-text, I dont know if I turn on a property or what I did for this to happen, any ideas how to fix this?

like image 809
Ricardo Sanchez Avatar asked Mar 23 '11 10:03

Ricardo Sanchez


2 Answers

There is an Eclipse bug filed for this that can be voted for:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=45969

It has been open for 10 years though!

There are applications out there that think they can handle rich text but can't. So for those it looks like we'll have to carry on with "Copy-Switch to Notepad-Paste-Select All-Copy-Switch to final app-Paste" for some time yet.

like image 143
foz Avatar answered Sep 28 '22 07:09

foz


Note: the rich formatting from a SWT editor seems to have always been available (bug 64498).

You could use "Edit, Paste and Match Style" in TextEdit.

From the Edit menu, choose Paste and Match Style,
or use the keyboard shortcut, Shift Option Command V.

The pasted text will pick up all the formatting from the character to the left of the flashing insertion point. This technique works in Mail as well.

like image 45
VonC Avatar answered Sep 28 '22 07:09

VonC