在 PhpStorm 中开启自动换行如下:
- 打开 PhpStorm。
- 在菜单栏中选择 "File" -> "Settings"。
- 在弹出的窗口中选择 "Editor" -> "General" -> "Soft Wraps"。
- 勾选 "Use soft wraps in editor" 选项即可开启自动换行功能。
您还可以设置自动换行的行宽。默认情况下,PhpStorm 的自动换行宽度为 120 个字符,您可以根据需要进行修改。例如,如果您希望将自动换行宽度改为 80 个字符,可以在 "Soft Wraps" 选项卡的 "Right margin (columns)" 字段中输入数字 80。
除了在 "Soft Wraps" 选项卡中进行设置,您也可以在编辑器中通过右键点击空白处,在弹出的上下文菜单中选择 "Soft Wraps" -> "Use Soft Wraps" 开启自动换行功能。同样地,您也可以通过此方法关闭自动换行功能。
问题描述
如何在 PhpStorm 中启用 word 换行?
How can I enable word wrapping in PhpStorm?
我只需要为我的一些文件(扩展名为 .txt)启用它.可能吗?
I need to enable it only for some of my files (with extension .txt). Is it possible?
推荐答案
对于所有文件(打开文件的默认设置):Settings/Preferences → Editor → 常规 → 在编辑器中使用软包装.您现在可以指定默认启用此选项的文件名/扩展名:
For all files (default setting for opened files): Settings/Preferences → Editor → General → Use soft wraps in editor. You can now specify file names/extensions where this option will be enabled by default:
对于编辑器中当前打开的文件: menu → View → Active Editor → Use Soft Wraps_(注意:我已经指定了自定义 Ctrl + Alt + R + 快捷键)_
For the currently opened file in the editor: menu → View → Active Editor → Use Soft Wraps (Note: I've assigned custom Ctrl + Alt + R + shortcut for that)
在很长一段时间内(自 v2016 左右),您还可以通过编辑器装订线区域(编辑器左侧带有行号的区域)的上下文菜单访问此选项:
For quite a while (since v2016 or so) you can also access this option via the context menu for the editor gutter area (the area with line numbers on the left side of the editor):
(注意:我对这个菜单进行了相当多的自定义;默认情况下,这里的项目要少得多)
到处搜索(Shift 2x 次)或菜单_Help_ → Find Action...(Ctrl + Shift + A(在 Windows 上使用默认键盘映射)也可用于快速更改此选项(而不是进入_设置/偏好_).
Search Everywhere (Shift 2x times) or menu Help → Find Action... (Ctrl + Shift + A on Windows using the Default keymap) can also be used to quickly change this option (instead of going into Settings/Preferences).
这篇关于PhpStorm 中的自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,WP2