To configure the line length, open settings Ctrl+Alt+S , navigate to Editor | Code Style, and type the necessary length in the Hard wrap at N columns field.
You can enable soft wrap for the editor with ⇧⇧ (macOS), or *Shift+Shift (Windows/Linux), for the Search Everywhere dialogue, and then typing in soft wrap. You can also go to Preferences/Settings > Editor > General to enable Soft Wraps for more file types by default.
In IntelliJ 2019 and 2020, go to Settings > Editor > Code Style. Under the tab General, there are 2 useful settings regarding end-of-line: Hard wrap at, where you can define the text line maximum length. Visual guide, where you can add additional guides (add one or more grey vertical line).
Basically, it's the guide line showing where the wrapping will occur (if enabled for certain code constructions). Show activity on this post.
File > Settings... > Editor > Code Style > Hard wrap at
File > Settings... > Editor > Code Style > Right margin (columns):
You can alter the "Right margin" attribute in the preferences, which can be found via
File | Settings | Project Settings | Code Style - General
Right Margin (columns) In this text box, specify the number of columns to be used to display pages in the editor.
Source: Jetbrains
It seems like Jetbrains made some renaming and moved settings around so the accepted answer is no longer 100% valid anymore.
Intellij 2018.3:
hard wrap
- idea will automatically wrap the line as you type, this is not what the OP was asking for
visual guide
- just a vertical line indicating a characters limit, default is 120
If you just want to change the visual guide
from the default 120
to lets say 80
in my example:
Also you can change the color or the visual guide
by clicking on the Foreground
:
Lastly, you can also set the visual guide
for all file types (unless specified) here:
Be aware that need to change both location:
File > Settings... > Editor > Code Style > "Hard Wrap at"
and
File > Settings... > Editor > Code Style > (your language) > Wrapping and Braces > Hard wrap at
It may be useful to notice that very good answers given above may not be enough. It is because of one more tick is required here:
I didn't understand why my this didn't work but I found out that this setting is now also under the programming language itself at:
'Editor' | 'Code Style' | < your language > | 'Wrapping and Braces' | 'Right margin (columns)'
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