Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy syntax-coloured code block as rtf in intelliji IDEA?

Is there a simple way to copy syntax-coloured code block as rtf in intellij IDEA?

like image 358
qwazer Avatar asked Feb 03 '11 07:02

qwazer


People also ask

How do I copy code with syntax highlighting?

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!

How do you copy and paste in code block?

Copy the text that you want to paste. When C::B console runs, right-click on its top window border (where the name of the executable appears). This will produce a menu. Select Edit -> Paste, and the copied text will be pasted at the cursor in the console.

How do I copy and paste in IntelliJ?

Copy pathsPress Ctrl+Shift+C to copy the absolute path to the current file. Choose Edit | Copy Path/Reference from the main menu. In the popup that opens, choose what part of the path you want to copy — filename, absolute, or relative path.

How do I copy lines in IntelliJ?

Duplicate the current line or selectionPress Ctrl+D or choose Edit | Duplicate Line or Selection from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.


1 Answers

UPDATE: there is now a new plug-in for this: 'Copy' on steroids that is maintained by JetBrains.


There is no way to copy colored code block from IDEA directly.

A workaround is to use File | Export to HTML, then open HTML in a browser, then copy from the browser window and paste into Wordpad or MS Word.

Another and more faster way is to install the Copy as HTML plug-in in Settings | Plugins:

Copies a snippet of code as html

  • Adds menu items "Copy as HTML" to main menu and editor popup. Will copy the current selection or the complete editor buffer. Currently only works if focus is in editor (for example won't work in project tree).
  • Preserves more formatting than the built-in HTML export.
  • HTML is only a snippet (without html and body tags) meant to be inserted into a complete HTML document.
  • Currently HTML format is fixed and uses CSS a lot.
  • Options: unindent, add border, padding, line numbers, tabs to spaces conversion, include editor's warning and error highlighting (see IDE Settings -> Copy as HTML).
  • Reuses the editor "Show Line Numbers" setting (see Idea's "View" menu).
like image 112
CrazyCoder Avatar answered Sep 27 '22 02:09

CrazyCoder