Most Useful Visual Studio 2008 Keyboard Shortcuts
I have started my career as a programmer learning (and loving) the Emacs editor; later I used for quite some time the VI editor on a remote server. It’s no wonder that I have become accustomed to use keyboard shortcuts extensively while editing my programs. Luckily, Visual Studio 2008 IDE that I now use on a daily basis comes with its own set of keyboard shortcuts that can make my programming hours more pleasant and productive.
My Favorite Shortcuts
I have tried to collect here the shortcuts I use dozens of times everyday.
I don’t fancy regions too much (I tend to prefer classes with few and short methods, so whenever I feel like I’d need regions to me that is a code smell); that’s why you won’t find them listed here. I also usually don’t care about shortcuts to handle files (new / open, etc…) and adding items to a project, since I am usually quicker using the mouse there. But without further ado, her comes the list.
| CTRL + K, C | Comment selection |
| CTRL + K, U | Uncomment selection |
| CTRL + K, D | Format document (according to the rules you have specified in Tools-Options->…) |
| CTRL + K, F | Format selection (according to the rules you have specified in Tools-Options->…) |
| CTRL + I | Incremental search (Emacs-like search) |
| CTRL + TAB | Cycle through the IDE windows |
| F12 | Go to definition of symbol (class / interface / etc…) |
| SHIFT + F12 | Find all references to this symbol (class / interface / etc…) |
| TAB | Insert the corresponding snippet |
| CTRL + ] | Move to the matching brace (for some reason this does not work when I use an Italian mapping for the keyboard) |
| CTRL + - | Move back to previous editing point(s). |
| F6 | Build solution |
| SHIFT + F6 | Build project |
| F5 | Start debugger / Go to next breakpoint |
| SHIFT + F5 | Quit debugger |
| F10 | Debugger step over |
| F11 | Debugger step in |
| SHIFT + F11 | Debugger step out |
| CTRL + F10 | Run to cursor |
| F9 | Toggle breakpoint |
Microsoft has a nice poster with the complete list of Visual Studio 2008 C# shortcuts. There are other shortcuts that I routinely use that are related to VS plug-ins (e.g. GhostDoc), but that is the topic for another post.
Wish List
There are a few shortcuts that I’d love to have readily available in Visual Studio:
- join a line with the previous (J in VI)
- create an inline comment. That is, move the cursor to a specific column and insert a ‘//’ to start a new comment. (M-; in Emacs)
- format (wrap) multiline comments (M-q in Emacs)
- center screen at current line (CTRL+l in Emacs)
- an interactive replace mechanism (M-% in Emacs)
Leave a Comment