Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply "wrap when typing reaches right margin" in Intellij IDEA?

If I set "wrap when typing reaches right margin" in Cody Style -> General preferences and defined a new margin, how to apply this new settings to files so they were reformatted?

like image 456
Eugene Avatar asked Feb 16 '13 07:02

Eugene


People also ask

How to wrap text in IntelliJ IDEA code editor?

In order to wrap text in the code editor in IntelliJ IDEA 2020.1 community follow these steps: Ctrl + Shift + "A" OR Help -> Find Action Enter: "wrap" into the text box Toggle: View | Active Editor Soft-Wrap "ON" In the latest IntelliJ, version 2020, we have an option called soft-wrap these files:

How do I rearrange code in IntelliJ IDEA?

Use Find Action ( ⇧⌘A or Shift+Ctrl+A ), and start typing “rearrange” to find the rearrange code action. Select this and IntelliJ IDEA will reorder the code of this class according to the settings for the project. We can see all the fields are placed at the top of the file and the getters and setters for a field are placed next to each other.

How to soft-wrap macros in IntelliJ?

In the latest IntelliJ, version 2020, we have an option called soft-wrap these files: Settings > Editor > General > soft-wrap these files. Check this option and add the type of files you would like to apply the wrapping to. Edit > Macros > Start Macro Recording (the recording will start). Click where you need.

Where are IntelliJ code formatting settings stored?

These formatting settings are stored in a settings file in the project’s .idea folder. IntelliJ IDEA also supports using an EditorConfig file to define the code style. Create a new EditorConfig file in a package or directory. This will be our root, add the standard EditorConfig properties and IntelliJ IDEA-specific settings for Java code.


1 Answers

Very easy:

  • select the root of your module in project view
  • in the code menu select "Reformat..."

EDIT

Forgot to mention this important detail:

IDE Settings > Code Style > Java > Wrapping and braces > Ensure right margin is not exceeded

must be checked. (at least to reformat java files, same checkbox for other files exists)

like image 193
ben75 Avatar answered Sep 28 '22 04:09

ben75