More VS.NET Tips & Tricks
For you keyboard junkies out there:
- Cut the current line - CTRL+L (Saves you that 'long' HOME,SHIFT+END,CTRL+X)
- Delete the current line - CTRL+SHIFT+L (Saves you that 'long' HOME,SHIFT+END,DEL)
- Move to the closing or opening of the current block - CTRL+[
- Here's a nice little macro to turn your selection into a region:
Sub OutlineSelection()
Dim objTextDoc As TextDocument
Dim title As String = InputBox("Enter the title for the outline", "Outline code")
objTextDoc = DTE.ActiveDocument.Object("TextDocument")
objTextDoc.Selection.Insert("#region " & title & vbNewLine, vsInsertFlags.vsInsertFlagsInsertAtStart)
objTextDoc.Selection.Insert(vbNewLine & "#endregion ", vsInsertFlags.vsInsertFlagsInsertAtEnd)
objTextDoc.Selection.SmartFormat()
End Sub
Save it in you macro-editor(ALT+F8) .
then go to tools-options->environment-keyboard and find that macro.
Highlight it and select the shortcut youd like to run it from(I use CTRL+M,CTRL+N).
- Outline a text selection for a Standard Non-Code file (My favorite)
sometimes your opening files in the VS.NET editor that are not code files.
You have no outlining support in these files... or do you?
Select some text in the open editor and press CTRL+M,CTRL+H. tada! your selection is now collapsed.
Press CTRL+M,CTRL+U to stop the outlining