There's two main related places I believe make the most sense to start, and that I believe will help drive out learning what other bells and whistles and sirens and synthesizers VS has to offer:
- Let go of the mouse
- Touch fewer keys
That's it. Just those two things should give us a really solid start at becoming much faster and more efficient when coding in VS.
I'm guessing I don't really have to convince most of the people reading this that this is correct. But, you know, it's low hanging fruit, so I'm going for it anyway... Maybe you like the mouse. Maybe you read that one ancient article from the early Mac days that says using the mouse is actually more efficient than the keyboard. OK. Tell me, how often do you save the file you are editing by:
- Grabing the mouse
- Dragging waaaaaaaaaaaaaaaaaaaaaaay over (monitors are BIG these days) to the File menu, clicking it
- Dragging down to the save item, clicking it
Or do you just hit Ctrl+S like 100,000 times subconsciously every time you stop to think about what to do next?
I thought so.
That's the thing about keyboard shortcuts, once you have practiced them to the point where they are engrained in your muscle memory, they are fast and require no thought and no time lag, allowing you to forget the physical steps of editing and focus on the more abstract ideas of what you are editing. But lets not skim over the most important part of that last sentence: practice! Real practice. The kind of practice familiar to most people who have played a musical instrument of some kind, which mainly consists of repetition, repetition, repeating yourself, doing it again, and again, repetition, slow repetition, fast repetition, and then more repetition. And if you didn't study music but instead spent your time going to sporting rehearsals (is that what they're called?), you probably experienced much the same thing.
So, if we are going to let go of the mouse, and touch fewer keys, we're going to have to practice shortcut keys. For me that practice usually looks like:
- Learning a new shortcut key
- Writing it down
- Trying it out a few times
- Purposefully finding opportunities to use it
- Paying close attention to my coding and if I miss a chance to use it,
- leaning on undo
- doing it again with the shortcut
Repeat, repeat, repeat, repeat, repeat. It's also important not to stretch yourself too thin all at once. Focus on a couple things at a time, work 'em to death, then do some other things, then go back to the first things again, etc. Some of this is going to be extra-curricular. Some of it can happen on the job. Some of it will slow you down a bit. It's OK, you're going to be happier for it soon. And it's not going to take as long as it feels like it does. I have no studies to prove this, I believe it on blind faith alone, and encourage you to take my word for it. We're software developers after all and that's how we do this.
OK, cool. So we need some shortcut keys to learn.
These are the essentials, chances are anyone who's used VS for any amount of time knows these already, so let's get them out of the way.
|F6 or Ctrl+Shift+B||Build|
|F10||Debugger Step Over|
|F11||Debugger Step Into|
|Ctrl+R, T||Run Tests|
|These you already know||cut, copy, paste, undo, redo, save|
Slightly Better Than Basic
Moving a tiny bit up the scale toward shortcuts that are still bread and butter, but might be slightly less well known.
|Ctrl+E, C||Comment Selection|
|Ctrl+E, U||Uncomment Selection|
|Ctrl+M, M||Toggle Outlining|
|Ctrl+M, L||Toggle All Outlining|
|Ctrl+G||Go to Line|
|Shift+F6||Build Current Project Only|
Learning shortcut keys isn't all there is to mastering an editor, but it's a big part, and it's certainly the first step. With these basics out of the way, we can move on to more interesting stuff.