I’ve never spent much time learning keyboard shortcuts for Visual Studio – they’ve always seemed hard to remember with multiple key combinations, some commands have multiple shortcut bindings, and some keystrokes simply aren’t intuitive. Recently, however, I’ve met a few IDE Ninjas who have opened my eyes on the productivity gains to be had.
The problem with learning keyboard shortcuts is that they can be a negative self-enforcing loop. If the secret to learning keyboard shortcuts is using them during your day-to-day activities, the act of stopping work to look up an awkward keystroke interrupts your flow, lowers your productivity, and ultimately results in lost time. Lost time and distractions puts pressure on us to stay focused and complete our work, which further discourages us from stopping to learn new techniques, including those that would ultimately speed us up. Oh, the irony.
To break out that loop, we need to:
- learn a few shortcuts by associating them with some mnemonics; and then
- learn a few exercises that we can inject into daily coding flow
The concept of the “kata” is taken from martial arts, where a series of movements are combined into a pattern. Patterns are ancient, handed down from master to student over generations, and are a big part of martial art exams. They often represent a visualization of defending yourself from multiple attackers, with a focus on technique, form, and strength. The point is that you repeat them over and over until you master them and they become instinctive muscle memory. Having done many years of Tae Kwon Do, many years ago, I still remember most of my patterns to this date. Repetition is a powerful thing.
A note about my Visual Studio environment: I’m using the default Visual Studio C# keyboard scheme in Visual Studio 2008. I’ve unpinned all of my commonly docked windows so that they auto-hide when not in use. Unpinning your tool windows not only gives you more screen real estate, but it encourages you to use keyboard sequences to open them.
Today’s Shortcut Lesson
In order to help your retention for each lesson, I’m going to limit what you need to remember to seven simple shortcuts. Read through the shortcuts, try out the kata, and include it in your daily routine -- memorize them and let them become muscle memory. I hope to post a bunch of Katas over the next few weeks.
Tip: You’ll get even better retention if you say the shortcuts out loud as you do them. You’ll feel (and sound) like a complete dork, but it works.
Tool Windows (CTRL+W, …)
Visual Studio’s keyboard scheme does have some reason behind its madness, where related functionality are grouped with similar shortcuts. The majority of the toolbar windows are grouped under CTRL+W. If it helps, think CTRL+WINDOW.
Here are a few of the shortcuts for Tool Windows:
|CTRL+W, S||Solution Explorer|
|CTRL+W, O||Output Window|
|CTRL+W, C||Class View|
Note that the ESC key will put focus in the currently opened document and auto-hide the current tool window.
Opening a Solution Kata
So here is the kata. Try this pattern every morning after you open a solution file.
- Open the Solution Explorer.
- Navigate to a file
- View it’s properties
- Build the current Project
- Build the Solution
- Review the Output
- Check for build Errors
- Open a file by navigating to it in the solution explorer
- Open a file to a specific method in the Class View
- View properties of a currently opened file.