Weekly Keyboard Shortcut #3: ReSharper's Expand/Shrink Selection
If you’re new to my Weekly Keyboard Shortcut series - it’s hard to find the time to stop and be aware of what you’re doing in your Visual Studio/ReSharper workflow. It’s actually hard to stop and be aware in a lot of situations, but that’s a whole other topic…
You might be so busy trying to get code written that you don’t realize you’re using the mouse to do something in Visual Studio/ReSharper over and over again. Using the mouse is going to be slower than keeping your hands on the keyboard and using a shortcut.
Now, say you’re ready to start learning new shortcuts and making them stick in your workflow… is there a good strategy?
One micro-strategy that will help is to choose the right keyboard shortcuts to learn. Once you choose the right ones to learn for your workflow, practice them deliberately. I know it’s easier said than done, but keep an eye out for more specific strategies from me later.
Extend/Shrink Selection
The Problem
You select text in the Visual Studio Text Editor constantly. If you’re constantly doing it with the mouse, you’re likely following a roughly 7-step process:
- Take your hand off the keyboard
- Grab the mouse
- Find the desired start position for the selection with your eyes
- Navigate to the desired start position for the selection with the mouse
- Click and hold the Left Click Button
- Find the desired end position for the selection with your eyes
- Drag down to the desired end position for the selection with your mouse
The Shortcut: Ctrl + Alt + Right / Ctrl + Alt + Left
or Ctrl + W / Ctrl + Shift + W
Quick heads up: ReSharper's Visual Studio default shortcut scheme will use: Ctrl + Alt + Right / Ctrl + Alt + Left
. This may clash with a Windows 7 shortcut to CHANGE YOUR SCREEN ORIENTATION. If so, the ReSharper 2.x/Intellij IDEA scheme's Ctrl + W / Ctrl + Shift + W
will also work.
The Expand/Shrink Selection shortens the selection process to a few keystrokes:
- Select something (try to get there without the mouse)
Ctrl + Alt + Right
to expand the selection to the next level (statement, block, etc.)- Continue to press
Ctrl + Alt + Right
to continue expanding the selection - If you go to far, press
Ctrl + Alt + Left
to shrink the selection back
Something you might notice with using this shortcut - it helps take your eyes out of the process of finding the start and end of the selection.
Summary
Text editing shortcuts are my favorite to work on. They give me the biggest benefit for my workflow because that’s where I’m the weakest in. By choosing the best shortcuts for my workflow, I’ll get closer to taking advantage of the vast amount of help Visual Studio and ReSharper gives me.
I hope you get the chance to try this Weekly Keyboard Shortcut if you don’t already use it. I’m still building a good list, so make sure you sign up for my newsletter to be the first to get the next one!
Related posts: