Intellij IDEA设置代码宽度
IDEA中设置代码宽度有两种方式:写代码时按照宽度自动换行和格式化时按照宽度换行。
写代码时自动换行配置方法:打开Preferences配置,依次选择Editor,General,然后勾选“Use soft wraps in editor”。

保存,此时代码便随着屏幕的大小自动换行。但打开所有的文件将都会自动换行。这可能不是所需要的,可通过设置快捷键,只对需要进行自动换行查看的文件进行换行。

格式化时按照宽度换行,设置方式:依次选择Editor,Code Style,Java,Wrapping and Braces,勾选Ensure right margin is not exceeded。

勾选该选项之后,当进行格式时,便按照设定的宽度界限来进行操作。
关注公众号:程序新视界,一个让你软实力、硬技术同步提升的平台
除非注明,否则均为程序新视界原创文章,转载必须以链接形式标明本文链接
本文链接:http://folen.top/2019/09/01/intellij-idea%e8%ae%be%e7%bd%ae%e4%bb%a3%e7%a0%81%e5%ae%bd%e5%ba%a6/