Tuesday, August 01, 2006

Another Simple Thing

Sometimes I can get a little long-winded when naming variables or methods. Combine that with a secret desire to write a complete program with one line of code and you can imagine what my code can look like if I don’t exercise a little constraint. With that in mind, I came across this little trick to add vertical guidelines in my editor window. They serve as a reminder that my lines shouldn’t get too long. I have seen this trick before, and actually used it at one time, but forgot about it until recently. Here is what it looks like. Notice the vertical red lines in the editor window.



Ok, how do we get there from here? Crank up Regedit.exe and get ready for some registry surgery (insert the usual warnings about the possible dire consequences of registry editing, etc. here).

Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<your version number (7.1, 8.0, etc.)>\Text Editor and add a new string named “Guides” with the following value: RGB(r,g,b) gl1 gl2 … where r, g, and b are the values (0 .. 255) of the color you want for your guide lines. gl1, gl2, etc. are the column number where you want your guide lines to appear. My guidelines are light red and are located at columns 80 and 110. My registry entry is shown below.



Enjoy, and keep those lines of code short enough to be readable.

0 Comments:

Post a Comment

<< Home