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)
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.
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.
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 ).
In Preferences > Editor > Code style > [language] uncheck reformat on file save .
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.
Set Settings
(Preferences
on Mac) | Editor
| Smart Keys
| Reformat on Paste
to None:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With