Wednesday, June 06, 2007

Visual Studio Tips.. 80 Character Guideline

Enabling Guidelines in Visual Studio

Lots of people wants to limit the number of character in one line of their code to be maximum of 80/100. This is done basically for readability. Believe me, code looks really readable if you follow the character limit for one line. Here is the way to have character guidelines in microsoft visual studio editor.

First, shut down Visual Studio if already started.Open Registry editor (start>run>regedit.exe). Browse to

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Text Editor]

[here 7.1 is used for visual studio 2003, look for 8.0 if you use vs 2005, or 9.0 for vs 2008]. Create a string value called

Guides

Set Guides to the following

RGB(x,y,z) n1,...,n13

Where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines. For example set the Guides value data to,

RGB(128,0,0) 80,100

This will place a Red guideline at column numbers 80 and 100.
And now launch VS and open any text file.

Disabling Guidelines
Just delete the Guides keys you created above. Restart VS, and no more guidelines.

Easier Way:
You can download following registry file and run which will do the same thing.
vs2003_guideline.reg
vs2005_guideline.reg
vs2008_guideline.reg
vcs2008ExpressEdition_guideline.reg

If you find this post useful, you might also like [this] and [this] post by me as well.

Thanks
Post a Comment