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

本文翻译自:How can I toggle word wrap in Visual Studio?

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://ahtik.com/blog/2006/06/18/first-alpha-of-eclipse-word-wrap-released/ 我习惯于在Eclipse中使用这个功能,它允许你右键单击并切换自动换行,这样当你有一条向右延伸的长行时,你不必将左下滚动条左右移动到阅读您的代码/ html: http//ahtik.com/blog/2006/06/18/first-alpha-of-eclipse-word-wrap-released/


#1楼

参考:https://stackoom.com/question/1K4T/如何在Visual-Studio中切换自动换行


#2楼

  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. 当您将鼠标悬停在它上面时,Visual Studio应在鼠标指针附近显示“Toggle Word Wrap”。

  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. 我有一个小型的Lilliput USB显示器,适用于小工具窗口,Skype IM等。它非常适合放置输出窗口,除了它总是侧向滚动。 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. 答案很简单,但节省的时间/精力是巨大的。


#3楼

As of Visual Studio 2013, the word wrap feature is finally usable—it respects indentation. 从Visual Studio 2013开始,自动换行功能最终可用 - 它支持缩进。 There's still a couple of issues (line highlighting, selection), but it's worth using. 还有一些问题(线条突出显示,选择),但它值得使用。 Here's how 这是如何做

在此输入图像描述


#4楼

使用菜单编辑高级 →Visual Studio 2003中的Word Wrap


#5楼

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

  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 按End键两次不会将光标移动到行尾

If you'd like these fixed, please vote on UserVoice. 如果你想修复这些, 在UserVoice上投票


#6楼

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值