Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands


Do you know that, you can easily map custom shortcut keys to Visual Studio commands to ease your life? In this part of my Visual Studio Productivity Tips series, we will learn how to assign custom keyboard shortcut keys to trigger in-built commands of Visual Studio. - Article authored by Kunal Chowdhury on .

While working with Visual Studio, you may some time notice that, there are few Visual Studio commands which are not mapped with any keyboard shortcuts. Thus, working with such commands become very difficult as you need to navigate through the menus every time.

 

Do you know that, you can easily map custom shortcut keys to Visual Studio commands to ease your life? In this part of my Visual Studio Productivity Tips series, we will learn about the steps.


Visual Studio Productivity Tips:


 

Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands

 

In our previous Tips & Tricks about Visual Studio, we learnt how easy it is to navigate from one method to another by using the Visual Studio menu Edit | Next Method and Edit | Previous Method. Wouldn't it be more easy if we had a keyboard shortcut mapped to the functions to perform the said navigation?

 

Yes, it is! Here we will talk about the step-by-step process to map a Visual Studio command with custom keyboard shortcuts.

 

Let's take the previous post as the example. We had the following commands: Next Method and Previous Method, where no keyboard shortcuts have been assigned. Check the below screenshot for reference:

 

Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands

 

Now, to assign keyboard shortcut keys for the mentioned Visual Studio menu commands, navigate to the Visual Studio Options page by clicking Tools | Options... menu items.

 

Now, navigate to Environment | Keyboard, as shown in the below screenshot and then search for the command containing the text nextmethod. This will filter out the result and list Edit.NextMethod as shown below.

 

Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands

 

Click on the input box under the Press shortcut keys and press the keyboard new key combination that you want to assign against the command. In this example, we have assigned Ctrl + Shift + = as the shortcut key. Click the Assign button.

 

Similarly, to assign keyboard shortcut for the other command, search for previousmethod. This will filter out the result and list Edit.PreviousMethod as shown below.

 

Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands

 

Now, click on the input box under the Press shortcut keys and press the keyboard new key combination that you want to assign against the command. In this example, we have assigned Ctrl + Shift + Alt + = as the shortcut key. Click the Assign button and hit OK to save the changes to Global settings.

 

Navigate to Edit menu now. You will see that the assigned keyboard shortcuts against the Next Method and Previous Method menu items have been set to Ctrl + Shift + = and Ctrl + Shift + Alt + = respectively, as shown in the below screenshot:

 

Visual Studio Productivity Tips: Assigning keyboard shortcuts to Visual Studio commands

 

Similarly, when you find another Visual Studio command, for which no keyboard shortcut has been assigned by Microsoft, you can now easily add your custom keyboard shortcut to it.

 

Make sure that, you are not overriding any existing mapping. Also make sure that you are saving the changes in the Global settings, so that, the changes are available in your system for all new instances of Visual Studio.

 

 

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.