Here’s five of my favorite keyboard shortcuts in Visual Studio, I think there’s a good chance there is at least one of them you haven’t seen before!
Find more Visual Studio tips and tricks here
Move code ALT+UP/DOWN
This keyboard shortcut is new in Visual Studio 2013. If you put the cursor on a line of code and use the <ALT><UP ARROW> key the line of code you have selected moves up. If you use the <ALT><DOWN ARROW> the line of code selected moves down.
Create Collapsible Region CTRL+M+H/CTRL+M+U
Chances are you have noticed the “+” and “-“ symbols in the margins that allow you to collapse and expand your classes and functions. Did you know you can create your own collapsible regions? If you select a section of code and then use the key sequence <CTRL><M><H> you turn that region into a collapsible/expandable region. The key sequence <CTRL><M><U> will remove the collapsible region (it doesn’t delete the code, it just removes the icon that allows you to expand and collapse.
Comment code block CTRL+K+C/CTRL+K+U
Whether it’s because you are trying to track down a but, or experimenting with code change, from time to time you will want to comment and uncomment blocks of code. If you select a block of code and use the key sequence <CTRL><K><C> will comment out the section of code. <CTRL><K><U> will uncomment the code.
Peek Definition ALT+F12
When you are going through your code and you want to examine the code in the method you are calling, many programmers will use the <F12> key or the pop-up menu option Go To Definition. Go To Definition will navigate to the called method, however many times you don’t need to navigate to the code. Sometimes, you just want a quick look at the method. If you have installed Visual Studio 2013 there is a new keyboard shortcut <ALT><F12> which will give you a preview of the method being called inline. You can use the <ESC> key to close the preview.
Navigate Forward/Backward CTRL - /CTRL SHIFT -
When you have multiple files open at the same time you may want a way to quickly move back and forth between two or three different locations in your code. If you have moved from one location to another you can use the keyboard sequence <CTRL><-> to move to the previous location and then you can return using <CTRL><SHIFT><->
Where do I get Visual Studio 2013?
Students can download Visual Studio 2013 Professional at DreamSpark
MSDN subscribers can download it from MSDN
Anyone can get express versions of Visual Studio for free or 90 day trials of Visual Studio Professional, Premium, or Ultimate at the Visual Studio downloads center.
Learn more about the new features of Visual Studio by watching the Visual Studio 2013 New Features at Microsoft Virtual Academy