Reputation: 58685
Is there any way to make Visual Studio word-wrap at 80 characters? I'm using VS2008.
Upvotes: 144
Views: 193389
Reputation: 4695
https://csharpier.com/ wraps to less than 80 characters. It's a good option for legibility.
Upvotes: 1
Reputation: 1761
I have created a .NET analyzer to get warnings (code LK0080) on your warnings list whenever you cross the 80 chars limit. It is NuGet package: LeetKean.Analyzers.LineLength
Upvotes: 0
Reputation: 69928
VS only supports Word Wrap. At least up until latest 17.7.4 version available today.
There is a issue to support max_line_length
for editorconfig
but it probably wont be implemented anytime soon. The issue has been there since 2019.
On another note I think you should read Linus Torvalds note from Linux Kernel Mailing List on 80 characters per row limit here. Good points about why excessive line breaks can be bad.
Upvotes: 3
Reputation: 31548
Unless someone can recommend a free tool to do this, you can achieve this with ReSharper:
ReSharper >> Options... >> Languages/C# >> Line Breaks and Wrapping
Upvotes: 134
Reputation: 1
You can enable word wrap and set zoom of code for 207% and that will show wrap every line of code that is over 80 characters in length.
Upvotes: 0
Reputation: 3902
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.
Upvotes: 4
Reputation: 395
I stumbled upon this question when was actually searching for an answer to this one (how to add a visual line/guideline at char limit). So I would like to leave a ref to it here for anyone like myself.
Upvotes: 5
Reputation: 514
You can also use
Ctrl+E, Ctrl+W
keyboard shortcut to toggle wrap lines on and off.
Upvotes: 26
Reputation:
Adds vertical column guides to the Visual Studio text editor. This version is for Visual Studio 2012, Visual Studio 2013 or Visual Studio 2015.
See the plugin.
Upvotes: 5
Reputation: 4573
See also this answer in 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
Upvotes: 0
Reputation: 11916
To do this with Visual Assist (another non-free tool):
VAssistX >> Visual Assist X Options >> Advanced >> Display
Upvotes: 9
Reputation: 14449
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.
Details on inserting a guideline at 80 characters for 3 different versions of visual studio.
Upvotes: 38
Reputation: 4001
Tools >> Options >> Text Editor >> All Languages >> General >> Select Word Wrap.
I dont know if you can select a specific number of columns?
Upvotes: 85