Menu:  Tools -> Options -> Keyboard
Command:  Tools.CustomizeKeyboard
Versions:  2008,2010
Published:  8/4/2010
Code:  vstipTool0063

 

So you want to create a new keyboard shortcut but don't know how to do it?  Let's walkthrough an example to show you how!  First, go to Tools -> Options -> Keyboard:

image

 

 

Now let's assume we want to modify the "View.ViewCode" command to include a new shortcut.  Notice the existing shortcuts (assuming no additional keyboard mapping schemes):

image

 

We want to add CTRL + Z as the shortcut so click in the "Press shortcut keys" area and press CTRL + Z:

image

 

But there is a problem!  Looking down at the "Shortcut currently used by" area we see that CTRL + Z is already mapped to the "Edit.Undo" command.  Since that is an important key combination to us, we will try a new set of shortcut keys.  How about CTRL + ALT + 4?

image

 

Sweet!  It isn't being used by anything currently.  BUT we aren't done yet.  We have to decide WHERE we want this shortcut to be available at.  The default scope is "Global" so you can use it at any time.  However, you can narrow the scope down to a specific area:

image

 

For example, if I wanted to have this shortcut only available when I'm editing XML, I would change "Global" to "XML (Text) Editor".  For now, we will keep it "Global":

image

 

Once we've decided on the scope and the shortcut keys all we have to do is click the Assign button to make the shortcut available:

image

 

If you mess up here, you can choose the shortcut key and click the Remove button to start over.

 

WARNING:  You can remove just about any shortcut so be careful to only remove the shortcuts you want to be gone. 

 

 

Click OK and let's go test our new shortcut.  Go to any design view:

image

 

Press CTRL + ALT + 4 to see the result:

image

 

It works!  Congratulations!  You now know how to map new keyboard shortcuts.