Tuesday, January 22, 2019 ..:: Home ::.. Register  Login
All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
   TechTidBits (Blog)  

Save Development Time With These Visual Studio Keyboard Shortcuts

Aug 19

Written by:
Tuesday, August 19, 2008 11:27 PM  RssIcon

Here are some of my favourite Visual Studio keyboard shortcuts I use to save coding time.  Anything that helps me keep thinking about what I want to do instead of thinking how I want to do it, is awesome IMHO.

I've always been known as a keyboard junkie. Even with GUI IDEs, I used to look for the keyboard shortcuts to speed things up. Unfortunately some people think keyboard shortcuts are a hinderance and slow you down. That's only the case if you can't remember the keystrokes (read more for tips on that) or if you're new to the tool and are learning/practising.


Note: Most of these tips apply equally to VS05 as they do VS08 (and some even apply to VS03 too).
Note: click this link to jump to Visual Studio Keyboard Shortcuts.

First we have to make sure we're all at the same starting place.

Have you ever been told to hit such'n'such a keystroke only to have it do nothing? Well, that other person has a different set of mappings from you. This is how you change/save/backup your current settings (not just keyboard, window locations, and other great stuff).

This setting is not found in the place you'd probably think, Tools|Options but it's still off the Tools menu in the Import and Export Settings... menu options. Select that menu option and then next you'll be prompted to Export, Import or Reset all settings. Select the Import radio button option then click Next where you'll be able to backup your current settings (keyboard and otherwise). If this is your first time here, it might be a good idea to back up your current config (you'll thank me later! :>). Click the appropriate setting and then the next button. Afterwards, you'll see a dialog to pick the type of dev work you do as well as other exported/backup settings.

Choose A Collection Of Settings To Import
After you click next, you'll be prompted to select which settings you want to import. Clicking finish and you have now remapped your keyboard.

Before we continue, I would strongly suggest setting up the following two custom keystrokes as they will make your life sooooo much easier in the future. They give you instant access to your Options and Keyboard Options (you know, for when you forget the hundred or so keystrokes :>). After this, you'll be ready to explore the wide world of VS keystroke shortcuts.

Grouping Description Keystroke Custom Comments
Ease of Use Tools.Options CTRL+SHIFT+ALT+O Y Direct access to view and change VS options.
Tools.CustomizeKeyboard CTRL+SHIFT+ALT+? Y Direct access to keyboard shortcuts.

Once you have these setup, please check out the Customize Keyboard dialog. I want to point out two key points.

  1. If you remember something about the name, type it in the Show Commands containing and you'll do a wildcard search for your command.
  2. If you are hitting some keystroke or chord but don't know what it does, type it in the Press shortcut keys textbox and you'll immediately see what it does. What's a chord you ask? When you type out a sequence of keystrokes. For example in my case (C# mapping), when I hit the CTRL+E followed by CTRL+D I get the Edit.FormatDocument option, that's the chord (CTRL+E with CTRL+D). Here are some key keystrokes I LOVE to use and some other friendly ones. :>

The power of having the above keystroke handy is that you don't necessarily have to print out these keystrokes or even memorize them.  As you use them, the more you'll become familiar with them.  And the more familiar with them the more you'll use them.  The ones you can't remember?  Ah well, you were using the mouse to get to those features anyways weren't you? :> Without further adieu, here are some of my useful keystrokes for VS.

Visual Studio Keyboard Shortcuts

Grouping Description Keystroke Custom Comments
Editing Close All But Me CTRL+SHFT+F4  Y Sometimes you just want to narrow your focus to the one file you're currently editing.
Close All CTRL+ALT+F4   And sometimes you want to start over from scratch.
Cycle Clipboard CTRL+SHFT+V   For when you want what you cut two/three/four times ago.  Similar to VI Registers or Named Buffers.
Delete Line CTRL+L Y* Delete the entire line right now.  Similar to VI LL.
Show Smart Tag CTRL+.   Sometimes VS wants to help you out but doesn't want to get in your way, it's like a tap on the shoulder, you can ignore if you want but sometimes it's very useful.
Toggle Full Screen SHFT+ALT+ENTER   Sometimes you just want to see thee bigger picture.
Move to Nav Bar CTRL+F2   Sometimes you just want to goto the Nav Bar (shows current classes in file being edited, but more importantly, you then hit Tab and you can navigate through all the methods/properties/fields in your class.  All via shortcuts.
Del Whitespace CTRL+K, \   Kind of like a String.Trim() for your code.
Transpose Line SHFT+ALT+T   For when you codes a bit dyslexic.
Word Wrap CTRL+E, W   When you or someone else forgot to use the Enter key.
Select Whole Word CTRL+SHFT+W   From anywhere in the middle, select the entire word.
Bookmarks Toggle CTRL+* Y If you use Bookmarks, you'll love being able to turn them on/off quickly.
Clear All CTRL+B, C    
Next in Class CTRL+NUM6 Y  
Next in Solution CTRL+NUM9 Y Quickly scan your bookmarks, great for debugging or when you have code all over the place.
Prev in Class CTRL+NUM4 Y  
Prev in Class CTRL+NUM7 Y  
Find Incremental CTRL+I    
All References SHIFT+F12    
Symbol ALT+F12    
Quick Find Symbol SHFT+ALT+F12    
Refactoring Rename F2   Same keystroke as in Windows Explorer.  There is another one, but why bother when you already know this one.
Show Smart Tag CTRL+.    
Extract Method CTRL+R, CTRL+M    
Encapsulate Field CTRL+R, CTRL+E    
Extract Interface CTRL+R, CTRL+I    
Make Local Parameter CTRL+R, CTRL+P    
Remove Parameter CTRL+R, CTRL+V    
Reorder Parameters CTRL+R, CTRL+O    
Generate Method Stud CTRL+K, CTRL+M    
Surround With CTRL+K, CTRL+S   For when you have code you want to surround it with a foreach, or #region or something else, let the Code Snippets do the heavy lifting for you.
Snippets CTRL+K, CTRL+X    
Upper/Lower Case CTRL+SHFT+U/CTRL+U    
HTML Editing Add Row/Col CTRL+A + Arrows    
Edit Master CTRL+M, CTRL+M    
Build Page CTRL+ALT+SHFT+F6 Y When you want to focus on one page and only one page.
Windows Solution CTRL+ALT+L    
Properties F4    
Servers CTRL+W, L    
Toolbox CTRL+ALT+X   Great one to let you Auto Hide the toolbox but still have it immediately accessible.
Class View CTRL+W, C    
Object Browser CTRL+W, J    
Errors CTRL+W, E    
Output CTRL+W, O   This is great when you're debugging.
Bookmarks CTRL+W, B    
Document Outline CTRL+W, U   Cool way to see your html's big picture.
Pending Checkins CTRL+W, G   If you're working with source control this one is invaluable.
Code Definition CTRL+W, D    
Task List CTRL+W, T   if you use ///todo this is a great shortcut to know. Warning, ///todos only show up here when the file is currently opened, it doesn't grep the solution.  There are other tools you can use to do that for you.
Code Snippet Manager CTRL+K, CTRL+B    
Split Editor Window In Two Horizontally CTRL+SHFT+ALT+V Y VERY useful on widescreen LCDs to compare two files side by side.
Debug Run To Cursor CTRL+F10   When you're at a breakpoint, want to run code but skip over it to another line you're interested in looking at.
Execute THIS Next Statement CTRL+SHFT+F10   For when you want to skip over suspect code.
Exception Info ALT+SHIFT+F10    
Quick Watch SHFT+F9    
Delete All Breakpoints CTRL+SHFT+F9    
Add Watch CTRL+D, NUM* Y To quickly add a variable to the Watch window.
Debug Windows Autos CTRL+D, A    
Breakpoints CTRL+D, B    
HTML Editing Add Row/Col CTRL+A + Arrows    
Immediate Mode CTRL+D, I    
CallStack CTRL+D, C    
Watches CTRL+D, W    

* Remove all other settings in order to make this work predictably

Location: Blogs Parent Separator TechTidBits

5 comment(s) so far...

Re: Save Development Time With These Visual Studio Keyboard Shortcuts

ES send me a link to the MS VS08 keyboard shortcut poster, thanks ES! :>

By phenry on   Friday, September 19, 2008 10:18 AM

Re: Save Development Time With These Visual Studio Keyboard Shortcuts

Another comprehensive link.

By phenry on   Wednesday, October 22, 2008 1:09 PM

Whitespace navigation

This article was fantastic for me. I too am somewhat of a keyboard junkie in the sense that I hate to have to switch from the keyboard to the mouse and then back to the keyboard to perform some mundane type of operation. However, I am not a fan of non-standard physical keyboards because I learned early on that I never want to be dependent upon a non-standard piece of hardware because that hardware is rarely available and not something that you can fit in your pocket.

With respect to the chords as you call them, I have been looking for a a way to navigate whitespace backwards (like [Ctrl + left arrow] but I only want it to back backwards to the end of the last word and not the beginning), so I could record some quick macros when I am modifying code.

Are you aware of any type of chord for performing that type of operation???

This article was fantastic because it showed me that there was a 'Select Whole Word' operation, which was more than sufficient for my needs. If I setup my macros to always start from the beginning of the line, I can pretty much use the select whole word operation to satisfy my needs.

The only issue I did run into was that [Ctrl+Shift+W] was already mapped. This was very easy to do and I don't use the menu item that it was mapped to anyway, so I am not all that concerned with the remapping. However, similar to my distate for using non-standard hardware, I am not a fan of using non-standard keyboard mappings because they too are not portable from system to system (in the sense that they are not available when I am using someone else's system). I know that they can be exported and imported for the systems that are completely under my control, but when I go to one of my consultants desks and need to modify some code I don't want to get overly frustrated that there system is not setup the way mine is.

By Jim Cleveland on   Monday, November 10, 2008 12:30 PM

Re: Save Development Time With These Visual Studio Keyboard Shortcuts

Thanks Jim for the feedback (sorry for the delay in replying :<).

re non standard HW
Very true, which unforutunately for me means I usually have to go buy my own keyboard and mouse when I change jobs. I personally love the MS keyboard 4000 and Explorer mouse (lots of extra keys/buttons and very customizable). Although it means I'm tied to that hardware, I find it much more productive. But that's just me. :>

re navigating words
Something I just found recently was CodeRush Xpress (look at this blog entry for more information, Are you looking to get more out of Visual Studio? Do you use a special refactoring tool? With an ALT+arrow keys you'll navigate case words which will include the end. Unfortunately it's not perfect (it won't jump immediately to the end of the word) but it is an alternative and you might find something better in the full product.

re chords
Oh, sorry, I didn't mean to come across as that being my term. That's in fact what MS calls those things (here's one reference I found to it, Don't want to confuse things more if I can help it. :>

re select entire word
Very cool, glad I was able to help out. You mentioned CTRL+SHIFT+W was mapped for you? Are you using the C# Development Settings? It wasn't setup/bound like that for me after a virgin install. Odd. I'm not disagreeing with you, just that I haven't seen that before.

re remapping keystrokes
I used to remap JBuilder to the hilt in my Java days. After switching versions every 6m, I got VERY tired of having to remap all my special keystrokes. :< Then I started learning the default ones, I figured it was easier to "join'em" than bean'em. In fact I used to use a Belkin Nostromo N50 ( but like you said, when someone came over to help me out, they were utterly confused at my keyboard mappings. :< I still have the unit but haven't hooked it up in years. I might do it again someday but no plans yet.

Have a good week and thank you for your comments! :>

By phenry on   Tuesday, January 20, 2009 11:09 PM

Re: Save Development Time With These Visual Studio Keyboard Shortcuts

I forgot about the keystroke for collapsing/expanding the Toolbox. Using numpad "/" and "*" you can expand/collapse all the Toolbox entries.Check out Sara Ford's blog entry for futher details.

By phenry on   Tuesday, January 27, 2009 11:33 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement