Keyboard shortcuts are extremely useful when you use a particular option repeatedlylike when you select menus or toolbars manually. Sometimes, the default shortcut is cryptic and you cannot remember it. Otherwise, the shortcuts do not exist at all. Here is how you can assign your own custom shortcuts to the actions you use very often.
- Start Visual Studio.
- Choose Tools>Customize.
- Click on the button Keyboard.
- A complex looking dialog will appear.
- The left section lists the various items which are customisable. Keyboard will be selected in this case.
- The settings you change may interfere with settings of other users who may share your machine. To avoid this, save your settings as a collection of named settings. Before you customise anything, click on Save As and choose a different name for your collection of settings.
- Type part of the menu or toolbar button for which you would like to assign a shortcut key in the textbox Show Commands Containing. This launches a substring search on all the commands and returns a filtered list. Browse the set of commands and locate the one you want.
- If the command already has a key assigned, view it. It is possible that there is a shortcut key that is not shown in the menus. If this is the case, memorise the shortcut and exit this dialog. No customisation is required.
- If there's no shortcut, or you dont like the default shortcut, customise it. Locate the command and go to the Press shortcut key(s) textbox. Press the required combination. VS understands which keys you pressed and puts their names there. Remember that you can specify multiple shortcuts for a single command.
- It's possible that the keyboard shortcut that you are trying to use is already used by VS.NET for some other existing command. If so, this command will be listed. You can override this shortcut and map it to the command selected by you. If you dont want to disturb the current assignment, type a new keyboard shortcut. Remember to delete the existing shortcut before you type the new one.
- Click on Assign.
This can dramatically increase your productivity and efficiency while working on VS.NET.
Note: It is possible that you need different types of shortcuts depending upon the type of project (winform/Webform) or the type of file being edited. For such custom requirements, save your shortcut settings under different names and load the appropriate collection as per your needs.