Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to paste code without reformating in IDEA

I want to prevent Intellij IDEA from reformating my code when I paste it.
How can I do this?

P.S. It is needed because I can't customize code formatting for Erlang (ErlGray plugin)

like image 919
tsds Avatar asked Jul 06 '12 10:07

tsds


People also ask

How do I paste special without formatting?

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. On a Mac, press Command+Option+Shift+V to “paste and match formatting” instead.

How do I paste code into plain text?

Use Ctrl + Alt + V (or Cmd + Alt + V on a Mac) to open the Paste Special window. Here, select Unformatted Text to paste in plain text. Finally, if you'd like, you can set the default paste option in Word to always paste in plain text.

How can I get beautify code of idea?

Keep existing formattingGo to Settings/Preferences | Editor | Code Style, select your programming language, and open the Wrapping and Braces tab. In the Keep when reformatting section, select the formatting rules which you want to ignore and deselect those which should be applied. Reformat your code ( Ctrl+Alt+L ).

How do I turn off auto format in Intellij?

In Preferences > Editor > Code style > [language] uncheck reformat on file save .


2 Answers

In the case anyone else comes across this and doesn't want to change their project-wide settings, I just recently found a "Paste Simple" command (Ctrl+Alt+Shift+V). I'm not sure what version it was added, but it's there as of IntelliJ 13.

like image 195
Jon Peterson Avatar answered Sep 30 '22 14:09

Jon Peterson


Set Settings (Preferences on Mac) | Editor | Smart Keys | Reformat on Paste to None:

reformat on paste

like image 29
CrazyCoder Avatar answered Sep 30 '22 12:09

CrazyCoder