My Favourite Shortcuts - Visual Studio 2017
![]()
I've been using Visual Studio since I started programming. At first I used a lot my mouse to scroll, select, copy, paste text. Or to open or switch between windows. When I started getting better I realized that the time moving my hand to the mouse, doing the task, and moving my hand back to the keyboard is slowing me down. So I started learning some of the useful shortcuts of Visual Studio and I'm coding much faster now.
Selecting / manipulating text
- So you obviously know
CTRL + CandCTRL + VandCTLR + Xtoo! But did you know that if you want to copy a line you don't have to select it, just move your cursor to the line (with the arrow keys) and pressCTRL + C. - Or did you know Visual Studio holds some of your recent clipboard values. Press
CTRL + Vmultiple itimes to get your clipboards before your current one! - If you missed the clipboard value you can press
CTRL + SHIFT + Vto go backwards! CTRL + SHIFT + Lremoves a line without copying it to the clipboard.CTRL + UP/DOWN ARROWScrolls the text without moving your cursor.CTRL + Wselects a word.CTRL + LEFT/RIGHT ARROWmoves the cursor from word to word. Combine that withSHIFTand you can select text much faster.- After you've selected a text you can use
ALT + UP/DOWN ARROWto move the text up or down a line!
Navigation
- You can move your cursor to a variable/method/class and press
F12to go to the definition of it. - You can move your cursor to a variable/method/class and press
SHIFT + F12to Display all references to it. - Obviously you can press
CTRL + Fto bring up the find window and find a text in your source file - You can press
CTRL + Hto bring up the replace window and pressALT +Ato replace all occurances - You can press
CTRL + Tand type in the name of a variable, class, method, select if from the list and press enter to go to it's definition - You can press
CTLR + K + Kit means you hold downCTRLand pressKtwice to insert a bookmark at the current line
Formatting
- Select something and press
CTRL + K + Fto format that text, insert/remove whitespaces - Press
CTRL + M + Mto collapse/open a code block. You can collapse anything that has{and} - Press
CTRL + R + Gto remove unused using statements and sort them alphabetically - Press
ALT + ENTERon something to bring up the Suggestions menu, navigate with the arrow keys and press eneter to apply a suggestion
Windows
- Press
CTRL + ALT + Oto bring up the output window - Press
CTRL + \ + Eto bring up the errors window - Press
CTRL + K + Wto bring up the bookmark window, you can select a bookmark with the arrow keys and pressF2to rename that bookmark - Press
F7in designer view to view the source code of the form, you can pressSHIFT + F7in the source code view to open the designer view of the form - Hold down
CTRL + TABto navigate between open windows and pressTABto move forward orSHIFT + TABto move backwards, additionally you can keep theCTRLheld down and use the arrow keys to navigate between windows. When the window you want is selected just release theCTRLkey, and you will go to that window. - Press
CTRL + ALT + Lto open the solution explorer.
Debugging
- Press
F5to start/continue the application,CTRL + F5to stop the application orCTRL + SHIFT + F5to stop the application - Press
F9to insert a breakpoint - Press
CTRL + ALT + BREAKto pause an application - When in break mode:
- Press
F10to execute a statement and step over it - Press
F11to execute a statement and step inside of it - Press
SHIFT + F11to execute a statement and step out of it
- Press
Summary
So that was my list of the shortcuts I find really useful. There are far more shortcuts than in this list, so if I missed something you can always lookup the shortcuts your looking for in VS itself under Tools > Options > Envinroment > Keyboard. Comment down below your favourite shortcuts!
I hope this helps you to speed up your coding too!