前进的道路不是一帆风顺的,要随时迎接挑战,敢于战胜困难!

坚持一下,找人聊聊天,释放一些压力!

 

Adding vertical guides to the Visual Studio text editor

Adding vertical guides to the Visual Studio text editor

Something that I’ve done and liked since VS2005, has been to add vertical guides to the VS text editor. For example:

image

I like putting them at the first several tab stops as it helps keep track of indenting. I also have one at position 79 so I know where to wrap lines and comments. So, how do you do this? Well, it’s a registry entry. Here are the entries for each version of Visual Studio:

Visual Studio 2005:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor]
"Guides"="RGB(230,230,255) 4, 8, 12, 16, 20, 24, 28, 32, 79"

 

 

 

Visual Studio 2008:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor]
"Guides"="RGB(230,230,255) 4, 8, 12, 16, 20, 24, 28, 32, 79"

Visual Studio 2010:

Bad news, here. Since the text editor is VS2010 is now a WPF control – this same registry entry doesn’t have any affect. If I find the equivalent of this for VS2010, I will try to post it up here.

UPDATE (4/24/2010): I found this was reported for VS2010, but it will not be implemented. Although there is a link in there of how you might be able to write your own extension that does this. See: https://connect.microsoft.com/VisualStudio/feedback/details/490930/text-editor-guides

Meanwhile, I just found that on the Visual Studio Gallery, someone implemented this. It's just a quick download and the same registry entry (exception "10.0" vs "8.0", below) works!!!

Download: http://visualstudiogallery.msdn.microsoft.com/en-us/0fbf2878-e678-4577-9fdb-9030389b338c

You can either go modify the registry by hand (WARNING: standard “do not modify the registry!” warnings apply) – or you can copy/paste the contents above into a text file and name it something like “VerticalGuides.reg” – then double-click it to run it.

Also, the RGB is what you might expect – this is what sets the color of the line. So (255,0,0) is all red, (0,255,0) is all green, and (0,0,255) is all blue – and combinations of those are somewhere in-between. After that, the comma-separated list is a list of the vertical positions where you want the actual lines.

Lastly, to remove the guides, just create another file called “RemoveVerticalGuides.reg”, paste the contents below and double-click to run:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor]
"Guides"=-

 

 

 

Setting a value to “-“ in a .reg file deletes that entry. Anyhow, I find this very useful so I thought I would post it.

posted on 2010-07-26 11:43  山径山精  阅读(328)  评论(0编辑  收藏  举报

导航