Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change line width in IntelliJ (from 120 character)

People also ask

How to change line length IntelliJ?

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.

How do you wrap lines in IntelliJ?

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.

How do you change the vertical line in IntelliJ?

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).

What is the line in IntelliJ for?

Basically, it's the guide line showing where the wrapping will occur (if enabled for certain code constructions). Show activity on this post.


IntelliJ IDEA 2018

File > Settings... > Editor > Code Style > Hard wrap at

Code Style > Hard wrap at

IntelliJ IDEA 2016 & 2017

File > Settings... > Editor > Code Style > Right margin (columns):

File > Settings

Editor > Code Style > Right margin


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:

enter image description here

Also you can change the color or the visual guide by clicking on the Foreground:

enter image description here

Lastly, you can also set the visual guide for all file types (unless specified) here:

enter image description 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:

enter image description 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)'