MSDN Flash: Keyboard Visual Studio Tips & Tricks for Dec 15. 2008
Originally, I was going to focus on shortcuts for the various build/compilation options within Visual Studio 2008. However, things become a little more complicated in terms of which keyboard shortcut to use because it depends on your keyboard mapping scheme. In this edition, therefore, I am going to discuss the Keyboard Options dialog - where different keyboard schemes are available for selection.
During the first launch of Visual Studio 2008, you are prompted with which keyboard scheme to use. The typical options are (Default), Visual C# 2005, and Visual Basic 6. Fortunately, you can change your selection via the Tools->Customize... menu and the Keyboard... button on the ensuing dialog (Alt+T, Alt+C, Alt+K). The same dialog is available from Tools->Options... and the Keyboard node of the environment.
The first dropdown on the right hand side of the dialog is where you can change your keyboard mapping scheme. (In this write-up, we will ignore the left hand tree of the dialog except to say the same dialog is used for the rest of Visual Studio's options as well.) After selecting which scheme you want, push Reset (Alt+E) to have all the keyboard settings for the selected scheme mapped.
Once you have the scheme you want, type within the Show commands containing text box. Notice that the commands list automatically filters down to those which contain the value entered anywhere within the name. In the screen shot above, "build" is used to filter the commands to those that have "build" in them. There are numerous functions within Visual Studio that do not map to menu options and, therefore, there is no intuitive way to know of their existence except from the Keyboard Options or the Customize... options dialog. The Show commands containing text box makes finding commands relatively easy, however. Consider, for example, determining the keyboard shortcut for deleting the current line. In the Show commands containing text box, type "delete" or "line" and then browse through the available commands to discover that such a command exists (Edit.LineDelete) and that by default Ctrl+Shift+L will invoke it.
Within the list of commands, you can select one of the commands and view the shortcut it is mapped to, if any. Build.BuildSelection is shown here to map to Shift+F6 (Global), where "Global" here means that this keystroke will work regardless of the context within Visual Studio (such as whether the Text Editor or Class Designer windows are active). It is helpful to browse through the various commands and see what they are mapped to. Furthermore, if you wish to map a new or different keystroke, you can type it in the Press shortcut keys text box. What is helpful, is that if the key typed already has a mapping, the existing mapping will show up in the Shortcut currently used by text box, allowing visibility as to whether you want to change the mapping or perhaps select a different keyboard shortcut.
In summary, the Keyboard Options dialog is a great technique within Visual Studio for determining what commands are available, what commands are mapped to which keyboard shortcuts, and for mapping new keyboard shortcuts to the commands.
Friday, December 05, 2008 1:44:03 PM (Pacific Standard Time, UTC-08:00)
Computer Related | .Net