A major aim of everyone is (or should be) to increase his personal productivity. Now productivity is a vast term actually. It can be related to individual programming productivity focusing on code quality problems but it can also be related to management issues and so on.This post targets the individual human-computer-interaction topics, more specifically on how you interact with your Visual Studio IDE during development. Personally what I don't like is when I have to use the mouse. Yes, I'm a keyboard fanatic ;) , just use your mouse if you have no other possibilities. Mouse interactions cost time! Take for instance the following situation:
You're currently going over some code in your editor, you see a line which looks suspicious and really shouldn't be there. Your approach: comment the line and launch the app to check it. I assume your hands are on the keyboard (as they should be ;) )
- Move your hand (right/left depending on your orientation) from your keyboard to the mouse.
- Move the mouse pointer up to point to the right symbol on the toolbar for commenting out the current line (ensure you have the focus on that line, otherwise you have to position it first)
- Click the toolbar button for commenting that line of code (hopefully you hit it correctly, otherwise the steps will increase for the according undo operation)
- Move your mouse pointer to the save button (let's save explicitly)
- Click the save button (again, hopefully you hit it correctly)
- Move your mouse pointer to the toolbar button for launching the app
- Click the toolbar button for launching the app.
- Press Ctrl + K,C (on VS2008).
- Press Ctrl + S (to save explicitly)
- Press F5 to launch in debug mode or Ctrl + F5 to launch without debugging.
Below there is a small list of the top shortcuts I'm using in my everyday working with Visual Studio. I tried to just pick the most frequently used and unfortunately they're taken to my working experience related to VS2008. Most of them should work with VS2010 too, however. I'll update the list below as I find more useful ones.
Pos 1 and End
These are quite useful for quickly jumping to the beginning/end of line. Try combining them with Shift for selecting whole rows, like Shift (right) + End.
Ctrl + (Arrow up/down)
Scroll the code editor without moving the cursor.
Predefined VS2008 Shortcuts
F5 or Ctrl + F5
First to launch in debug, second to launch the app without debugging.
Alt + Shift + F10
Open the suggestion context menu which appears beneath code statements, i.e. for implementing an interface, creating a method which doesn't exist but is referenced and so on.
Ctrl + - / Ctrl + Shift + -
This allows you to navigate back and forth in your cursor position history. This is veeery useful. Try it out.
Ctrl + Tab / Ctrl + Shift + Tab
Easy, for navigating among the open code editor windows.
Ctrl + Shift + B
Start a build.
Ctrl + K, D
Auto-formats your code.
Ctrl + R,R
Refactor > Rename.
Ctrl + K, C
Comment out code.
Ctrl + K, U
Un-comment a commented code part.
Custom defined VS2008 Shortcuts
Ctrl + W
Close the active code editor window. This is a must to quickly navigate.
Ctrl + R, S (combined shortcut)
Rebuild the entire solution. Scrolling up the Solution Explorer and right-clicking on that solution icon takes just too much time :)