10 Essential Shortcuts in Visual Studio 2019

No Such Dev
4 min readDec 2, 2020

--

Here are the most essential shortcuts I use to get things done quickly when using Visual Studio. I’m mainly coding C# for Unity on Windows these days but these shortcuts are generic and applicable to any programming language. This list of shortcuts is not exhaustive. Just the ones I use as a seasoned developer. At the end of this post I have included links to more complete lists.

If you are on Mac or Linux, you probably use Visual Studio Code, the cross platform solution from Microsoft which is different than Visual Studio itself. Not all the functionality is available there so some of the shortcuts may not work or be different.

Auto Complete

ctrl+space

Very basic but included for completeness. After . s and incomplete words press this shortcut and see VS has to offer.

Format Document and Sort usings

ctrl+K, ctrl+E (format document AND sort usings)
ctrl+R, ctrl+G (sort
usings)
ctrl+K, ctrl+D (format document)

comma in the shortcuts means then. There are so many commands in IDEs today that they are categorized into groups that have their own shortcuts.

One of the most useful shortcuts. Before committing to my version control (git), I run this on my edited files to get rid of unused usings statements and have them sorted.

Go to Definition

ctrl+click
F12

This is the key shortcut for navigating code. Often times we want to see the definition of a type, method or variable and this takes us directly there. Paired with ctrl+- to navigate back, it is a powerful shortcut to move around code.

Doing this on override keyword takes us to the method definition in the parent class!

Block Comment

ctrl+shift+/

Use this to quickly comment out / uncomment blocks of code, methods or entire files.

Semantic Find (Quick Launch)

ctrl+Q

Use this to quickly find classes, files, etc. I use this all the time to go to a file I want to edit or find a class in my codebase.

Find and Replace Text

You can find and replace text in the current document or in the entire solution.

ctrl+F (find inline)
ctrl+H (replace inline)
ctrl+shift+F (find in files)
ctrl+shift+H (replace in files)

Inline UI is the compact panel that shows at the corner of the document. You can still change the scope to project, solution, etc.

“Find in Files” shows you a more elaborate UI for finding and replacing text in your document, project, solution, etc.

Inline UI
Windowed UI

Smart Tag

ctrl+.

Visual studio is pretty smart and suggests modifications and refactors to the code. Wherever there are red / yellow / green lines under your code, you can press this shortcut to see what the suggestions are. Even if there are no underlines, there may be options available in this menu. I use them only when they are red or yellow (error and warning levels).

Sync Current Document With Solution Explorer

ctrl+[, S

This will select the current document in the “Solution Explorer” window and focus that window.

Semantic Rename

ctrl+R, ctrl+R

Have your caret on the name you want to change. It could be a variable or a type (class, struct, enum, etc.) or method name. Your changes will be reflected on all the occurrences of that name in your solution.

Use this when there are no compile errors. Visual Studio uses compiler references to know which names to change.

Conclusion

This list is by no means exhaustive. You can see a more comprehensive list of shortcuts on Microsoft’s website. In Visual Studio you can open the options window (Tools -> Options) and then navigate to Environments ->Keyboard. There you can see the list of all available actions and their respective shortcuts and modify them.

I have been developing Software and using Visual Studio for 20 years and use these shortcuts to boost my productivity. If you use other shortcuts and tools in Visual Studio that help with your productivity, feel free to leave a comment and share them with the community.

--

--

No Such Dev
No Such Dev

Written by No Such Dev

Software Engineer | Indie Game Developer | Founder of No Such Studio. Follow me to learn how to make video games with Unity. http://www.nosuchstudio.com