如何在 Visual Studio 中切换自动换行?

发布于 2024-07-10 00:13:22 字数 136 浏览 7 评论 0原文

Visual Studio .NET 是否有办法打开和关闭自动换行?

我习惯了 Eclipse 中的这个功能,它允许您右键单击并打开和关闭自动换行,这样当您有向右延伸的长行时,您不必向右和向左移动底部滚动条阅读你的代码/html:

Does Visual Studio .NET have a way to toggle word-wrap on and off?

I am used to this feature in Eclipse which allows you to right click and toggle word wrap on and off so that when you have long lines that extend out to the right, you don't have to move the bottom scroll bar right and left to read your code/html:
http://web.archive.org/web/20131027224437/http://ahtik.com:80/blog/2006/06/18/first-alpha-of-eclipse-word-wrap-released/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

风吹过旳痕迹 2024-07-17 00:13:22

遵循在编辑器中管理自动换行

  • 查看文档时:编辑/高级/自动换行 (Ctrl+E< /kbd>+W)
  • 常规设置:工具/选项/文本编辑器/所有语言/自动换行
  • 或在快速启动框中搜索“自动换行”。

已知问题

遗憾的是,Visual Studio 中的自动换行看起来比其他编辑器(例如 Visual Studio Code)差很多 - 页边距不一致。 这是错误 https://developercommunity.visualstudio.com /t/Unexpected-and-sporadic-indents-when-usi/10635809

Visual Studio 2022 中的自动换行:

Visual Studio 中的自动换行

Visual Studio 代码中的自动换行:

在此处输入图像描述

Following Manage word wrap in the editor:

  • When viewing a document: Edit / Advanced / Word Wrap (Ctrl+E+W)
  • General settings: Tools / Options / Text Editor / All Languages / Word wrap
  • Or search for 'word wrap' in the Quick Launch box.

Known issues

Unfortunately word wrap in Visual Studio looks much worse than other editors such as Visual Studio Code -- the margins are inconsistent. This is bug https://developercommunity.visualstudio.com/t/Unexpected-and-sporadic-indents-when-usi/10635809

Word wrap in Visual Studio 2022:

word wrap in Visual Studio

Word wrap in Visual Studio Code:

enter image description here

御守 2024-07-17 00:13:22

我经常使用此功能,因此我在命令栏中添加了一个自定义按钮。

  1. 单击添加或删除按钮 -> 自定义
  2. 单击命令选项卡
  3. 单击添加命令...
  4. 选择编辑(对于较新的 VS,选择编辑|高级版本)从列表中
  5. 找到切换自动换行并将其拖到栏上

I use this feature often enough that I add a custom button to the command bar.

  1. Click on the Add or Remove Buttons -> Customize
  2. Click on the Commands tab
  3. Click Add Command...
  4. Select Edit (or Edit|Advanced for newer VS versions) from the list
  5. Find Toggle Word Wrap and drag it onto your bar
苏辞 2024-07-17 00:13:22

从 Visual Studio 2013 开始,自动换行功能终于可用了——它尊重缩进。 仍然存在一些问题(行突出显示、选择),但它值得使用。 以下是

在此处输入图像描述

As of Visual Studio 2013, the word wrap feature is finally usable—it respects indentation. There's still a couple of issues (line highlighting, selection), but it's worth using. Here's how

enter image description here

人疚 2024-07-17 00:13:22

在 Visual Studio 2005 Pro 中:

Ctrl + ECtrl + W

或菜单编辑< /em> → 高级自动换行

In Visual Studio 2005 Pro:

Ctrl + E, Ctrl + W

Or menu EditAdvancedWord Wrap.

╰◇生如夏花灿烂 2024-07-17 00:13:22
  1. 打开输出窗口。

  2. 查找工具栏右侧的小图标,该图标以文本“显示输出:”开头。 它看起来像一个带有回车图标的小窗口。 当您将鼠标悬停在其上方时,Visual Studio 应在鼠标指针附近显示“切换自动换行”。

  3. 单击该图标。

你现在已经学到了一些如此明显的痛苦,我因为很久以前不知道这一点而感到尴尬,因此选择支付我的会费并与其他人分享我的答案,这样他们就不会遭受与我相同的痛苦。

说实话,这对于屏幕较小的人来说确实很有用。 我有一个小型 Lilliput USB 显示器,非常适合小型工具窗口、Skype IM 等。它非常适合放置输出窗口,只是它总是需要横向滚动,这很糟糕。 在忍受了几个月的横向滚动之后,我终于决定看看是否可以使其自动换行。 答案很简单,但它节省的时间/精力是巨大的。

  1. Open the output window.

  2. Look for the little icon on the very right-hand side of the toolbar that starts with the text "Show output from:" in it. It looks like a small window with a carriage return icon. When you hover over it Visual Studio should display "Toggle Word Wrap" near your mouse pointer.

  3. Click that icon.

You now have learned something that was so painfully obvious I feel embarrassed for not knowing this long ago and thus have chosen to pay my dues and share my answer with others so they don't suffer the same agony I have.

Seriously, this is really useful for those with small screens. I have a small Lilliput USB monitor that is good for small tool windows, Skype IM, etc. It works great for putting the output window on, except that it sucks having to always sideways scroll. After just putting up with sideways scroll for months I finally decided to see if I could make it word wrap. The answer was so easy but the amount of time/effort it saves is tremendous.

§对你不离不弃 2024-07-17 00:13:22

在 Visual Studio 2008 中,CTRL+E+W

In Visual Studio 2008, CTRL+E+W.

[浮城] 2024-07-17 00:13:22

Visual Studio 中的键盘快捷键

(alt + z) =>; 切换自动换行

keyboard shortcuts in visual studio

(alt + z) => toggle word wrap

迷爱 2024-07-17 00:13:22

在 Visual Studio 2008 中,它是 Ctrl + E + W

In Visual Studio 2008 it is Ctrl + E + W.

梦里人 2024-07-17 00:13:22

使用 Visual Studio 2003 中的菜单编辑高级自动换行

Use menu EditAdvancedWord Wrap in Visual Studio 2003.

万劫不复 2024-07-17 00:13:22

对于 Visual Studio 2017 执行以下操作:

工具 > 选项> 所有语言,然后根据您的偏好选中或取消选中该复选框。 如下图所示:

For Visual Studio 2017 do the following:

Tools > Options > All Languages, then check or uncheck the checkbox based on your preference. As you can see in below image :

萌无敌 2024-07-17 00:13:22

在最新版本中。

1.点击左下角图标设置

2.选择设置设置

3.选择“文本编辑器”> 自动换行

In latest version.

1.click the left bottom of the icon setting

2.select setting setting

3.select "text editor"> "word wrap" on word wrap

静若繁花 2024-07-17 00:13:22

在 VS Code 中 === 版本:1.52.1

  1. 打开 VS Code 设置

  2. 从设置中找到 settings.json 文件并打开它

  3. 添加此代码 - "editor.accessibilitySupport": "off"

如果您之前已添加值为 "on""editor.accessibilitySupport"然后只需将其设置为“关闭”即可。 当我在使用我的 JS 项目之一时遇到同样的问题时,这是对我有用的代码。

In VS Code === Version: 1.52.1

  1. Open VS Code settings

  2. From the settings find the settings.json file and open it

  3. add this code - "editor.accessibilitySupport": "off"

If you already added "editor.accessibilitySupport" with the value "on" before then simply turn it to "off". This is the code worked for me when I faced the same problem while working with one of my JS Project.????

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文