Keyboard shortcuts in Visual Studio


Roy Osherove (a TDD expert) recently ran a load of sessions in the UK and posted how by getting delegates to try going “mouse-less” when using VS2008, he observed a 3x increase in productivity. Think about that – that’s a remarkable statistic if true.

Firstly, most people don’t associate keyboard usage with efficiency + productivity, and secondly, most of us (I certainly) wouldn’t have thought that you could use the keyboard to replace the mouse. Then I thought about it and tried to see what I use the mouse for and what I use the keyboard for when using VS, and came up with a list of things that I do use the keyboard for: –

  • find references
  • go to definition
  • tab management
  • navigate through errors
  • compiling
  • run unit tests

But there are some areas that I don’t use the keyboard for, and thought about trying to start using it instead. Here are some areas that I found useful to keyboard-ify. Have a look through these and try them out – some of them are excellent, and I didn’t even know existed in VS until I spent 15 minutes digging around.

File Navigation

This is as basic as navigating through a file. This sounds silly – of course you can use the cursor – but sometimes you want to move a few pages down at a time, or perhaps to the end of the current method etc.

  • Scroll up / down (keeping caret fixed): CTRL + UP / DOWN
  • Move to scope boundary (if the caret is on a start brace, automatically move to end brace): CTRL + ]
  • Incremental Find (finds the next word in the current file – as-you-type!): CTRL + I

I’d like the ability to move from the middle of a method to the start / end of it, though.

Intellisense

Either to get intellisense for a keyword you’re typing, or just to get the helpful tooltip that is shown when hovering over any symbol in VS.

  • Quick Info (same as hovering over a symbol): CTRL + K, CTRL + I
  • Parameter Info (what you get when entering parameters in a method, but on demand): CTRL + K, CTRL + P
  • Complete Word (if you’re halfway through a keyword and want VS to finish it for you): CTRL + SPACE

Outlining

This includes collapsing and expanding different areas of your code, including regions, classes, methods and properties.

  • Collapse / expand current region: CTRL + M, M
  • Collapse all methods / properties in class: CTRL + M, O
  • Expand all methods / properties in class: CTRL + M, P

Solution navigation

This includes finding files that are currently open, as well as moving to another file in the current solution without needing to resort to Solution Explorer.

  • Switch to other open file visually: CTRL + TAB
  • Switch to other frame (e.g. solution explorer, test results): CTRL + TAB, UP/DOWN/LEFT/RIGHT
  • List open files in pop-up menu: CTRL + ALT + DOWN
  • Open solution explorer: CTRL + W, CTRL + S
  • Solution find (find anything in the solution – CodeRushXpress only): CTRL + SHIFT + Q

I’m going to try using the above for a week or two and see how I get on with it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s