When teaching programming, I tend to do a lot of live coding. Coding in front of a live audience is special, and I take special care to try to do it right the first time, and also do it as quickly as possible at the same time.
Keyboard shortcuts help a lot!
I became way more efficient when I really got into keyboard shortcuts, and I get a lot of feedback from my students about this when they see me using it so heavily. They start taking notes and want to learn.
So welcome to your first handfull of VS2008 keyboard shortcuts!
I expect you know the standard shortcuts that work with most windows programs, like CTRL+X for cut, CTRL+C for copy, CTRL-V for paste, CTRL+Z for undo and CTRL+S for save. So I won’t even mention them… ;-)
Shortcuts every developer should know
When writing code, you should learn these first:
- SHIFT+SPACE for autocomplete/Intellisense
- SHIFT+CTRL+SPACE to see the tooltip. (No more deleting and retyping the opening paranthesis for that)
- CTRL+. for expanding smart tags. (See? You didn’t need the mouse!) Smart tags are Visual Studio’s way of asking: “Can I help you?” You’ll get help to generate method stub, implement an interface or an abstract class, rename something etc.
For navigating within code and between windows in Visual Studio, learn these:
- F12 to go to definition (Ie. go to the code where a variable, field, property, method, class, interface, enum or delegate is declared.) (Also: try F12 on a framework type or method, like string or Console.WriteLine()…)
- CTRL+- (minus) goes back to where you where before navigating away. (Much like the back-button in a web browser. SHIFT+CTRL+- is the forward-button equivalent.)
- CTRL+TAB to switch between open documents. (Very similar to the wellknown ALT+TAB to switch between apps.) If you don’t release the CTRL button, you can navigate the list with arrow keys too. That will give you access to the properties window, solution explorer and more as well…
- F4 will always show the properties window.
- F7 and SHIFT+F7 will let you switch between designers and code.
- CTRL+F4 closes the current document. (Similar to ALT+F4 which exits an app.)
And for running and debugging code, start with these:
- F5 to start debugging (Ie. run your program in the debugger)
- SHIFT+F5 to end debugging when your program is paused in the debugger
- F9 to set a breakpoint on the current line
- F10 to step to next statement
- F11 to step into the current method (or property/constructor)
- SHIFT+F11 to step out of the current method
If you aren’t using keyboard shortcuts yet, start with these. I’ll post a second handfull for you in a couple of days…