I am working with Visual Studio 2008 editor. Is there a way to take a piece of text for example, highlight it and use shortcuts to quickly add markup?
For example, lets say I have a text, I went to: the store
and I want to bold it, I have to type <b>the store</b>
. Is there a quicker and easier way to do this?
Asked
Active
Viewed 3,494 times
5
-
Try the following post http://stackoverflow.com/questions/22171132/visual-studio-how-to-quickly-wrap-text-in-html-tags/42334460#42334460 – Dmitry Feb 20 '17 at 01:29
2 Answers
32
Select text, Ctrl+X, type in your tags which will be autoclosed by vs, Ctrl+V
-
1+1 because it's much more fluid when typing rapidly and has less "configuration" needed. 8^D – Dillie-O Mar 22 '13 at 18:58
-
2
With HTML Editor just press Ctrl+B...
With regular text editor VS does not provide something build-in, but you can add custom macros. Something like the following will do job for you.
Sub MakeSelectionBold()
DTE.ActiveDocument.Selection.Text = "<b>" + DTE.ActiveDocument.Selection.Text + "</b>"
End Sub
You can then assign it to the short-cut or add button to your toolbar.

shA.t
- 16,580
- 5
- 54
- 111

Mike Chaliy
- 25,801
- 18
- 67
- 105
-
-
The problem is that VS supports only VB macroses. Or I missed something. This is built-in functional, you can find Macro Explorer window, or Tools/Macros/... – Mike Chaliy Feb 17 '09 at 14:17