Visual Studio 2013 Shortcuts and Tips

Visual Studio 2013 Shortcuts and Tips

In this post I’ll briefly highlight some cool features in Visual Studio that I think not all developers are familiar with as well as some tips. Some of these features have been present in VS 2013 for a while and some in earlier versions but I thought I’d share some of them with you anyways.

Visual Studio 2013 Shortcuts & Tips

First of you’ll most likely be familiar with F12 shortcut already and navigate forth and back using F12 and Ctrl + – to go back.  However there are times where you’d wish you could just get a preview instead of going back to the definition.

Alt + F12

With the Alt + F12 shorcut you are  able to do just that. You get a very nice preview window just like below while still staying in the current class. You can scroll and actually make changes in the preview window as well!

Alt + F12 Shortcut

Scroll Bar Code map

You might be familiar with the scroll bar code map already from other editors such as Sublime Text. I think it’s super awesome as it makes it easier to drag around in the code and is much faster.  It’s also possible to get a preview of the code in your current class by simply hovering over the scroll bar.

Scroll Bar Code Map
You can enable this feature by going to Tools – Options – Text Editor – All Languages – Scroll Bars or simply search in quick launch by pressing Ctrl + Q and typing ‘scroll bar’.

Disable Copy of Empty Lines

Another nice feature is the option to disable the possibility of copying blank lines. How many times did you try to copy something and then just as you are about to paste it by pressing Ctrl + V you accidentally press Ctrl + C and get a blank line in your buffer?

You can disable it by going to Tools – Options – Text Editor – All Languages – General and then uncheck the box saying ‘Apply Cut or Copy commands to blank lines when there is no selection’.

Ctrl + Shift + V and cycle through previous pastes

Once in a while you suddenly need something you pasted previously but you have already copied other lines of code in your buffer mean while. How to quickly get it back?

Ctrl + Shift + V
With Ctrl + Shift + V you can cycle through previous copies in your buffer and Visual Studio will even highlight them in your code as shown above. It’s pretty neat!

Collapse a block of code

There are lots of commands to expand and collapse regions of code however sometimes you might want to create a collapsible region around a block of code.

Collapse Code
You can do this by Ctrl + M + H to create a collapsible block of code and Ctrl + M + U to remove the collapsible block.

Visual Studio is freezing or lagging

I am not sure if this final tip is still relevant however when VS 2013 was released and for a good while after people had issues with performance and VS freezing up. I thought I’d just mention this last tip in case anyone still experiences.

What helped me was disabling Hardware Graphics Acceleration under Tools – Options – Environment.
Hardware Graphics Acceleration

That’s all for now!