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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/315485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 09:57:46  来源:igfitidea点击:

How can I toggle word wrap in Visual Studio?

visual-studioword-wrap

提问by Edward Tanguay

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

Visual Studio .NET 是否可以打开和关闭自动换行?

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/

我已经习惯了 Eclipse 中的这个功能,它允许您右键单击并打开和关闭自动换行,这样当您有向右延伸的长行时,您不必左右移动底部滚动条看了你的代码/ HTML: http://web.archive.org/web/20131027224437/http://ahtik.com:80/blog/2006/06/18/first-alpha-of-eclipse-word-wrap-发布/

回答by Micah

Following https://docs.microsoft.com/en-gb/visualstudio/ide/reference/how-to-manage-word-wrap-in-the-editor

按照https://docs.microsoft.com/en-gb/visualstudio/ide/reference/how-to-manage-word-wrap-in-the-editor

When viewing a document: Edit / Advanced / Word Wrap (Ctrl+E, Ctrl+W)

查看文档时:编辑/高级/自动换行(Ctrl+ ECtrl+ W

General settings: Tools / Options / Text Editor / All Languages / Word wrap

一般设置:工具/选项/文本编辑器/所有语言/自动换行

Or search for 'word wrap' in the Quick Launch box.

或者在快速启动框中搜索“自动换行”。



Known issues:

已知问题

If you're familiar with word wrap in Notepad++, Sublime Text, or Visual Studio Code, be aware of the following issues where Visual Studio behaves differently to other editors:

  1. Triple click doesn't select whole line
  2. Cut command doesn't delete whole line
  3. Pressing End key twice does not move cursor to end of line

如果您熟悉 Notepad++、Sublime Text 或 Visual Studio Code 中的自动换行,请注意以下问题,其中 Visual Studio 的行为与其他编辑器不同:

  1. 三击不选择整行
  2. 剪切命令不会删除整行
  3. 按 End 键两次不会将光标移动到行尾

Unfortunately these bugs have been closed "lower priority". If you'd like these bugs fixed, please vote for the feature request Fix known issues with word wrap.

不幸的是,这些错误已被“低优先级”关闭。如果您希望修复这些错误,请投票支持功能请求Fix known issue with word wrap

回答by Todd Smith

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 Commandstab
  3. Click Add Command...
  4. Select Edit(or Edit|Advanced for newer VS versions) from the list
  5. Find Toggle Word Wrapand drag it onto your bar
  1. 单击添加或删除按钮->自定义
  2. 单击命令选项卡
  3. 单击添加命令...
  4. 从列表中选择编辑(或编辑|高级用于较新的 VS 版本)
  5. 找到Toggle Word Wrap并将其拖到您的栏上

回答by Colonel Panic

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

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

enter image description here

在此处输入图片说明

回答by Alarion

In Visual Studio 2005 Pro:

在 Visual Studio 2005 专业版中:

Ctrl+ E, Ctrl+ W

Ctrl+ E, Ctrl+W

Or menu EditAdvancedWord Wrap.

或菜单EditAdvancedWord Wrap

回答by gonzobrains

  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.

  1. 打开输出窗口。

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

  3. 单击该图标。

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.

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

回答by gonzobrains

In Visual Studio 2008, CTRL+E+W.

在Visual Studio 2008,CTRL+ E+ W

回答by netadictos

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

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

回答by Neeraj Kumar

In Visual Studio 2017 Edit -> Advanced-> Word Wrap OR Ctrl + E + W

在 Visual Studio 2017 中编辑 -> 高级 -> 自动换行或 Ctrl + E + W

回答by Ian Jacobs

Use menu EditAdvancedWord Wrapin Visual Studio 2003.

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

回答by Yvonne.D

In latest version.

在最新版本中。

1.click the left bottom of the icon setting

1.点击左下角的图标设置

2.select setting setting

2.选择设置设置

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

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