Code Wrap IntelliJ?

Intellij IdeaCode Formatting

Intellij Idea Problem Overview


How would be possible to assign a shortcut for word wrap like as sublime text do? i.e. if the code line is too long it should be automatically break to the next line. wikipedia.org.org/Word_wrap

This code should be wrapped out

Intellij Idea Solutions


Solution 1 - Intellij Idea

I think "soft wrap" might be what you're after. It's read-only, i.e. does not change the characters in the file, it only wraps what you see on screen.

settings soft wrap Intellij >= 14.1.4: As pointed out by looper in the comments, the options are under File > Settings > Editor > General - under the Virtual Space or Soft Wraps sub-group.

Intellij < 14.1.4: Look under File > Settings > Editor > Virtual Space. It doesn't have a shortcut by default, but you can assign one in the keymap.

AndroidStudio >= 1.4.1: the options are under File > Settings > Editor > General - under the Soft Wraps sub-group.

You can also right click the gutter (the vertical bar where line number is shown) and select "Use Soft wraps" - thanks to Bajal for comment. gutter soft wrap

To assign a shortcut for toggling softwrap: Look under File > Settings > Keymap, search for "softwrap", then assign your preferred shortcut.

Solution 2 - Intellij Idea

[ctrl+alt+s] or File->settings to open settings dialogue.

Search for code style. its under project settings.

In code style, General check

wrap when typing reaches margin

That will give you wrapping of code.

Solution 3 - Intellij Idea

One can also right click the gutter (the vertical bar where line number is shown) and select "Use Soft wraps" - thanks to Bajal for comment.

This is the easiest way, and i found it in comments. I think it should be an answer so everybody can see it easily.

Solution 4 - Intellij Idea

In order to wrap text in the code editor in IntelliJ IDEA 2020 follow these steps:

  1. Crtl + Shift + "A" OR Help -> Find Action
  2. Enter: "wrap" into text box
  3. Toggle: View | Active Editor Soft-Wrap "ON"

Image of Toggle Switch in Menu

Solution 5 - Intellij Idea

In the Community Edition, Do Following:

File >> Settings >> Editor >> Code Style >> Java

Go to Wrapping And Braces Tab.

Set the "Right margin (columns)" option with number of columns you would like as line wrapping point. Set "Wrap on typing" to YES.

Don't forget to apply the changes before you click Ok.

Solution 6 - Intellij Idea

For IntelliJ IDEA Version: 2019.3

  1. Go to File > Settings

  2. A new window will appear

  3. Select Editor > General

Navigate to Soft Wraps section, check the box, and using a semi-colon as the delimeter, * and ? as wildcards, add the desired file-extensions. Select Apply and you are good to go.

Screenshot of Settings window

Solution 7 - Intellij Idea

(In Community Edition 2016+) go : IntelliJ IDEA>Preferences >Editor>General: select options "Use soft wraps in editor" and "Use original line's indent for wrapped parts"

Solution 8 - Intellij Idea

The answer to this question is:

Use the option Ensure right margin is not exceeded - the bottom option in the screenshot:

enter image description here

Solution 9 - Intellij Idea

OS X 10.8 IntelliJ Idea 15.0.5: IntelliJ IDEA Menu/Preferences/Editor/General/Soft Wraps

Solution 10 - Intellij Idea

The gutter's context menu has a soft wrap option. Right-click on the gutter located to the far left of the editor to reveal the menu

enter image description here

Solution 11 - Intellij Idea

It can help. Thats the solution I have found, when I was trying the wrap the codelines, in the code-editor, when I was decreasing/increasing(stretching) the window-code-editor.

enter image description here

Solution 12 - Intellij Idea

It helped me adding " *.java" after " *.adoc;" because in "Settings", then "General" and then " Soft-wrap these files:" I had only " *.md; *.txt; *.rst; *.adoc ". If after that you add "; *.java" your long java code will be wrapped to a new line. Thx for the screens. It helped me a lot.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSayat SatybaldView Question on Stackoverflow
Solution 1 - Intellij IdeaShornView Answer on Stackoverflow
Solution 2 - Intellij IdeaDineshkumarView Answer on Stackoverflow
Solution 3 - Intellij IdeaacpumaView Answer on Stackoverflow
Solution 4 - Intellij IdeaNoah PGView Answer on Stackoverflow
Solution 5 - Intellij IdeaVishalView Answer on Stackoverflow
Solution 6 - Intellij Ideauser8758751View Answer on Stackoverflow
Solution 7 - Intellij IdeaAlferd NobelView Answer on Stackoverflow
Solution 8 - Intellij IdeaACVView Answer on Stackoverflow
Solution 9 - Intellij IdeaGyuriView Answer on Stackoverflow
Solution 10 - Intellij IdeaTestillaView Answer on Stackoverflow
Solution 11 - Intellij IdeaGtdDevView Answer on Stackoverflow
Solution 12 - Intellij IdeaMonaRadView Answer on Stackoverflow