DEV Community

Simon Foster
Simon Foster

Posted on • Originally published at funkysi1701.com on

Visual Studio Keyboard Shortcuts

I use keyboard shortcuts all the time, mostly without thinking, but they can be quite a time saver especially for frequently used tasks.

I recently came across this list of Visual Studio ones. https://docs.microsoft.com/en-us/visualstudio/ide/default-keyboard-shortcuts-in-visual-studio?view=vs-2022

I was going to do a top ten, but not really sure how you rank keyboard shortcuts, so instead I will mention some of my favourites.

Build solution

If you are using Visual Studio you need to build your code. If you are anything like me, after even the smallest change I want to see what affect that has had so a rebuild is often needed.

  • Ctrl + Shift + B / Build Solution
  • F5 / Run
  • Ctrl + F5 / Run with no debugging

Cut, Copy, Paste, Undo, Redo

Programming is sometimes refered to as copying and pasting from StackOverflow, but they are always times you want to copy and paste stuff so the standard keyboard shortcuts are all here.

  • Ctrl + C / Copy
  • Ctrl + X / Cut
  • Ctrl + V / Paste
  • Ctrl + Z / Undo
  • Ctrl + Y / Redo (or Undo your Undo)

Comments in your code

Often we like to temporarily comment out a line of code to see what affect it has.

  • Ctrl + K, Ctrl + C / Comment selection
  • Ctrl + K, Ctrl + U /Uncomment selection

Using statements

I like to keep my using statements tidy, and not clutered up with ones that aren’t used anymore.

  • Ctrl + R, Ctrl + G / Remove and Sort Usings

Go to Implementation

I like to move quickly between methods that a class is calling to find out what is happening so the go to implementation and go to definition shortcuts are very useful. I tend to use the right click option more than the sortcut, but I would save myself a heap of time if I learnt these shortcuts.

  • F12 / Go to Definition
  • Alt + F12 / Peek Definition
  • Ctrl + F12 / Go to Implementation

Find file in Solution Explorer

You are editing a file and you have no idea what folder it is in the Solution Explorer. There is a shortcut to find out where you are.

Ctrl + [, S / Select Active File in Solution Explorer

Search

Finding references or a certain string is a common activity

  • Ctrl + F / Find in current file
  • Ctrl + H / Replace
  • Ctrl + Shift + F / Find in all files

Visual Studio tries to be helpful

Often Visual Studio will try and be helpful with a lightbulb or similar icon, instead of clicking you can press this shortcut to

  • Ctrl + . / Show Visual Studio suggestion

Learn some more

As I said before keyboard shortcuts are great time savers. Go check out the complete list and share with me the ones you found most useful.

Top comments (0)