In this post I will share some of my favourite and performance optimising shortcuts. These shortcuts make life easier as a developer and may reduce some frustrating manual tasks. I will stick to shortcuts that have to do with Visual Studio and not resharper. So I will not be mentioning alt + enter in this, even though that may be my most used key binding. They are in no particular order.
Do you know what quick launch is? It is a great feature in Visual Studio which lets you search the menu items. Often you would like to search items in your solution but this one is for finding menu items. Such as the nuget package manager, settings or perhaps you need to see your key bindings. Using ctrl + q (Window.QuickLaunch binding) you instantly go to quicklaunch which per default is located in the upper right corner:
Now you can just type "manage nuget packages" and hit enter. This will open that dialog.
Locate in solution explorer
Have you ever used "goto implementation" so many times that you have no idea where you are in the solution explorer? In visual studio you can use the keybinding SolutionExplorer.SyncWithActiveDocument which per default is ctrl + ´, ctrl + s (´ is the sign next to 0). This will find the document you currently have open in the solution explorer.
Open in file explorer
So with the previous command we can now find items in our solution explorer. Often we wish to access the folder structure of this item. This can be done by using the keybinding File.OpenContainingFolder. This has no default binding to it, it is unassigned per default. I have this as alt + shift + x. I am not sure why I chose this combination but it is built into my fingers by now - I can't change it. But this opens the folder of the item you currently have selected in the solution explorer.
Edit multiple lines
Alt + shift + down/up is something that works in many IDEs and text editing programs (I have noticed notepad++ uses this too). It is a simple and great way to edit several lines at a time. In the below image I am about to change the isolation level of two properties at the same time:
Normally I would have to delete the "public" part one at a time. But here I can edit both lines simultaneously.
This might seem pretty straight forward. Why do I even use a shortcut for this? Well to delete a line, you could choose to go to the end or start of it, then select the whole line with shift + end/home - then hit delete. I'd rather prefer Edit.LineDelete which is defaulted to ctrl + shift + l (I use shift + delete though). This is also handy if you wish to delete several lines - you just hit it as many times as you want rows to go away.
Go to all (ctrl + shift + T in resharper)
Most people using Resharper will know this as ctrl + shift + t. However per default this is known as ctrl + , (Edit.GoToAll binding) in Visual Studio. This will create a search field where you can search for anything within your solution explorer. Classes, files and configurations are easily found using this:
This is great when you need to find a class, but you cannot remember where it is located - or you just don't care - you just wish to edit it.
Move line up and down
This is close to editing multiple lines. In most editors you can do this by hitting alt + up or down. This switches the lines. Moving your current line one up or down. You can also do this to a whole codeblock if you wish. As it will move what you have highlighted.
Wrapping it up
These are my favourite keybindings/shortcuts in Visual Studio. Besides the obvious copy/paste and cut/paste of course (probably the ones I use the most still). I hope you liked it, let me know if you did in the comments.