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

后端 未结 6 1438
粉色の甜心
粉色の甜心 2021-01-29 20:27

I was wondering how I can change the line length in IntelliJ.

Since I use a pretty high resolution, I get that line that shows 120 characters straight through the middl

相关标签:
6条回答
  • 2021-01-29 20:33

    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

    0 讨论(0)
  • 2021-01-29 20:33

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

    0 讨论(0)
  • 2021-01-29 20:41

    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:

    0 讨论(0)
  • 2021-01-29 20:43

    IntelliJ IDEA 2018

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

    IntelliJ IDEA 2016 & 2017

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

    File > Settings

    Editor > Code Style > Right margin

    0 讨论(0)
  • 2021-01-29 20:46

    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:

    0 讨论(0)
  • 2021-01-29 20:56

    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
    
    0 讨论(0)
提交回复
热议问题