Adding vertical guides to the Visual Studio text editor

來源:互聯網
上載者:User
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:

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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.