I'm clearly not the oldest knife in the drawer, nor am I the youngest. I got involved with computers in my youth just about the time Bill Gates was positioning himself to put a PC in every home. What this means is, I grew up on PCs with no mice; pre-Windows, pre-GUI. I learned how to write "menu" programs that utilized a broader range of ascii characters than most people are familiar with today. The point is, everything I did on the computer I did with the keyboard.
I recall in high school, a new kind of computer with this funny bulbous thing connected to it at the end of a wire. The screen was even more compelling. There was an arrow on the screen and you were supposed to use a "mouse" (the bulbous thing) to move it around. Our teachers loaded something called Hypertext and told us to play around with it. I have to admit, it was not love at first sight. I had a lot of trouble making the arrow do what I wanted.
Today, it is second nature to use a mouse to manipulate icons, text, forms, etc. on the screen. Many people use touch screens in their daily lives. As a developer who writes code, sometimes the mouse can get in the way. The mouse is so integral that it can be hard to break free. The mouse has its place; but, in my opinion, is should play a very small role in writing code.
I am constantly surprised at how many "experienced" developers are unfamiliar with the tools that they are using. Below is a list of commands that I find useful with Microsoft Visual Studio, specifically for C# and asp.net. Of course, you can change any of these and you can add your own by customizing Visual Studio. Many of these you will already know. Hopefully there are a few new ones here to boost your productivity.
These are just the basics. Imagine what you can do with code acceleration tools like CodeRush, ReSharper, and others.
|Keystroke ||Action |
|F12 ||Go to Definition. Jumps to the definition of the Class, Method, Property, etc of the item currently occupied by the cursor. This works best if you have the source code. |
|Ctrl - ||Navigate Forward: Jumps to last line of visited code. Jumps between source files. Can be used repeatedly. |
|Ctrl-Shift - ||Navigate Backward: Jumps to next line of visited code. These are similar to going back and forward in your browser history. |
|Ctrl-Shift-F ||Find in files |
|Ctrl-G ||Go To Line. Useful if someone says your code is failing at line 1739 of 2341. Hopefully this never happens to you. |
|Ctrl-W S ||Activate Solution Explorer |
|Ctrl-W P ||Activate Properties Window |
|Ctrl-W O ||Activate Output Window |
|Ctrl-W E ||Activate Errors List |
|Ctrl-Shift-R ||Record temporary macro |
|Ctrl-Shift-P ||Play temporary macro. I use these two to perform repetitive editing that refactoring tools cannot help with. As refactoring tools have gotten better, I have found that I use this less often. |
|Ctrl-Shift-S ||Save All |
|Ctrl-Shift-H ||Replace in files |
|Alt-A ||(When in Find and Replace dialog) Replaces all occurrences with the new text. |
|Ctrl-U ||Make lowercase |
|Ctrl-Shift-U ||Make uppercase |
|Ctrl-Space ||Complete a word (IntelliSense) |
|F2 ||Refactor Rename (I believe this is new to VS2008). Will search entire solution to update any references. Does a pretty good job with aspx too. |
|Ctrl-E D ||Format Document. Useful for aspx and xml (if you don't mind Microsoft's formatting rules |
|Ctrl-M M ||Toggle outline expansion (note: the capital M here does not imply a "Shift", just used for readability) |
|Ctrl-M L ||Toggle All outlining |
|Building and Debugging |
|Ctrl-Shift-B ||Build All / Build Solution |
|Ctrl-F5 ||Start without debugging. |
|F9-Toggle breakpoint ||The first time I used visual studio I switch F5 and F9. Bonus points to anyone who knows why. |
|F5 ||Run with debugger |
|F10 ||Step over |
|F11 ||Step into |
|Shift-F11 ||Step out of |