如何在 VS Code 中默认打开文本换行

How do I turn on text wrapping by default in VS Code

通常当我使用 VS Code 时,我在新文档上做的第一件事就是命令:"Toggle Word Wrap" 或 Alt+Z.我尝试查看用户设置,但没有找到任何相关条目。有没有什么方法可以让每个文档默认换行 'on'?

查看设置 editor.wrappingColumn(有关详细信息,请参阅 docs

2017-04-06 更新:

最近设置更改(参见 here)为 editor.wordWrap,有几个选项:

We therefore decided to deprecate editor.wrappingColumn (with its -1, 0, >0 cases) in favor of editor.wordWrap.

Here are the new word wrap options:

editor.wordWrap: "off" - Lines will never wrap.
editor.wordWrap: "on" - Lines will wrap at viewport width.
editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn.
editor.wordWrap: "bounded" - Lines will wrap at the minimum of viewport width and the value of editor.wordWrapColumn.

现在设置为"editor.wordWrap": "on",应该设置为"on"(默认值为"off")。

切换到 "on" 会激活 Visual Studio 代码中所有文档的自动换行。

有关详细信息,请参阅 release notes about Word Wrap changes

版本 1.32.3

如果您不想编辑任何文件,您可以在用户设置下将其打开:

代码 > 首选项 > 设置 > 文本编辑器

在搜索中键入 "wordwrap" 或滚动到列表底部光标部分之前。您会看到 "Word Wrap / Controls how lines should wrap."

2020 年,这里有一些简单的步骤。

  • 点击顶部菜单上的 'File'。
  • 单击 'Preferences' --> 'Settings'。
  • 稍微滚动一下,直到找到 'Editor: Word Wrap'。
  • 单击下拉菜单并选择 'on'。
  • 完成。默认保存设置。

希望对您有所帮助。

打开用户设置Json并添加(如下图所示)

"editor.wordWrap": "on",

首先进入设置->在搜索框上搜索自动换行->然后 自动换行选项。

太简单了。这个解决方案对我有用。

点击顶部菜单上的 'File'。 单击 'Preferences' --> 'Settings'。 在搜索框中搜索 Word Wrap,然后您将看到 Editor: Word Wrap。 单击下拉菜单并选择 'on'。 它肯定会起作用。 谢谢。

  • 按键盘上的 ctrl + ,

这会将您带到设置选项卡。

  • 在搜索选项卡中输入自动换行
  • 单击 编辑器:Word Wrap 下拉菜单。
  • Select .

大功告成。 See the image and follow the red boxes.