A lookup table of Visual Studio Keyboard Shortcuts (KeyBindings)

I’ve really wanted to be faster at my VS 2010 work, and to that end I think that getting to know and and practice the keyboard shortcuts is a good idea….

I know there are quite of overviews out there like Scott Guthrie’s and DoFactory’s, but I wanted my own structured data to be able as filter, group and search as I please.

Much googling took me here at MSDN where Kevin Buchs has added a nice VS 2010 macro for extracting the data.

I’ve modified Kevin’s implementation a bit, in order to be able to import it more easily into an Excel sheet (download sample here with the default bindings), so here’s my version of the macro:

Sub GetAllCommands3()
        ' http://msdn.microsoft.com/en-us/library/ms247076.aspx#1

        Dim new_window = DTE.ItemOperations.NewFile("General\Text File")
        Dim doc = new_window.Document
        Dim textDoc = CType(doc.Object("TextDocument"), TextDocument)
        textDoc.StartPoint.CreateEditPoint() ' Creates an "edit point" at the beginning of the document

        ' Tab-separated per command / binding
        For Each cmd In DTE.Commands
            If Not cmd.Name.Trim().Equals("") Then
                Dim line1 = cmd.Name.ToString().Split(".")(0) + vbTab + cmd.Name.ToString()

                For Each binding In cmd.Bindings
                    Dim split = binding.ToString().Split("::")
                    Dim line2 = line1 + vbTab + split(0) + vbTab + split(2) + vbCrLf
            End If
    End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s