visual-studio 如何让 Visual Studio 在 80 个字符处换行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/236517/
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
How can I make Visual Studio wrap lines at 80 characters?
提问by JosephStyons
Is there any way to make Visual Studio word-wrap at 80 characters? I'm using VS2008.
有没有办法让 Visual Studio 自动换行 80 个字符?我正在使用 VS2008。
采纳答案by TGnat
Tools >> Options >> Text Editor >> All Languages >> General >> Select Word Wrap.
工具>>选项>>文本编辑器>>所有语言>>常规>>选择自动换行。
I dont know if you can select a specific number of columns?
不知道您是否可以选择特定数量的列?
回答by Igal Tabachnik
Unless someone can recommend a free tool to do this, you can achieve this with ReSharper:
除非有人可以推荐免费工具来执行此操作,否则您可以使用ReSharper实现此目的:
ReSharper >> Options... >> Languages/C# >> Line Breaks and Wrapping
ReSharper >> 选项... >> 语言/C# >> 换行符和换行
- Check "Wrap long lines"
- Set "Right Margin (columns)" to the required value (default is 120)
- 选中“换行长线”
- 将“右边距(列)”设置为所需值(默认为 120)
Hope that helps.
希望有帮助。
回答by Stewart Johnson
I don't think you can make VS wrap at 80 columns (I'd find that terribly annoying) but you can insert a visual guideline at 80 columns so you know when is a good time to insert a newline.
我不认为你可以让 VS 在 80 列处换行(我觉得这很烦人)但是你可以在 80 列处插入一个视觉指南,这样你就知道什么时候是插入换行符的好时机。
Details on inserting a guideline at 80 characters for 3 different versions of visual studio.
回答by Cory Koch
You can also use
你也可以使用
Ctrl+E, Ctrl+W
Ctrl+E, Ctrl+W
keyboard shortcut to toggle wrap lines on and off.
打开和关闭换行的键盘快捷键。
回答by idbrii
To do this with Visual Assist(another non-free tool):
要使用Visual Assist(另一个非免费工具)执行此操作:
VAssistX >> Visual Assist X Options >> Advanced >> Display
VAssistX >> Visual Assist X 选项 >> 高级 >> 显示
- Check "Display indicator after column" and set the number field to 80.
- 选中“在列后显示指示器”并将数字字段设置为 80。
回答by idbrii
Adds vertical column guides to the Visual Studio text editor. This version is for Visual Studio 2012, Visual Studio 2013 or Visual Studio 2015.
向 Visual Studio 文本编辑器添加垂直列指南。此版本适用于 Visual Studio 2012、Visual Studio 2013 或 Visual Studio 2015。
See the plugin.
查看插件。
回答by Corio
回答by HelloGoodbye
If the problem is simply that you want to know when you pass 80 characters for a single line, which is a common coding guideline limit, you can use a different approach: Editor Guidelines. This will add vertical column guides behind your code.
如果问题只是您想知道何时为单行传递 80 个字符,这是常见的编码指南限制,您可以使用不同的方法:Editor Guidelines。这将在您的代码后面添加垂直列指南。
回答by Charbel.AY
回答by Roland Pihlakas
See also this answerin order to switch the mode conveniently.
另请参阅此答案以方便地切换模式。
Citation:
引文:
I use this feature often enough that I add a custom button to the command bar.
Click on the Add or Remove -> Customize
Click on the Commands tab
Select Edit|Advanced from the list
Find Toggle Word Wrap and drag it onto your bar
我经常使用这个功能,以至于我向命令栏添加了一个自定义按钮。
单击添加或删除 -> 自定义
单击命令选项卡
从列表中选择编辑|高级
查找切换自动换行并将其拖到您的栏上


